Commit c7862e4 Jay9971
committed
1 parent 8a50385 commit c7862e4 Copy full SHA for c7862e4
File tree 3 files changed +15
-19
lines changed
3 files changed +15
-19
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,9 @@ namespace Robot {
44
44
*/
45
45
void AutoDrive (Intake &intake, Latch &latch);
46
46
47
+ void AutonSwitcher ();
48
+
49
+
47
50
/* *
48
51
* @brief Switches the autonomous program.
49
52
*
Original file line number Diff line number Diff line change @@ -39,20 +39,6 @@ class Drivetrain {
39
39
*/
40
40
void run ();
41
41
42
- /* *
43
- * @brief Sets the joystick deadzone.
44
- *
45
- * @param newDeadZone The new deadzone value.
46
- *
47
- * The deadzone is a range around the joystick's resting position where no movement is registered.
48
- * This function allows you to set the deadzone value to filter out small joystick movements.
49
- *
50
- * @details The deadzone value determines the sensitivity of the joystick inputs.
51
- * A higher deadzone value will require larger joystick movements to register any movement in the drivetrain.
52
- * Conversely, a lower deadzone value will make the drivetrain more responsive to small joystick movements.
53
- */
54
- void setdeadzone (int newDeadZone);
55
-
56
42
enum Mode {
57
43
CURVATURE_DRIVE,
58
44
ARCADE_DRIVE,
@@ -80,7 +66,7 @@ class Drivetrain {
80
66
* Arcade drive uses the left joystick for forward and backward movement, and the right joystick for left and right movement.
81
67
* Tank drive uses the left and right joysticks for controlling the left and right sides of the robot.
82
68
*/
83
- void SwitchDrive ();
69
+ static void SwitchDrive (int driveNum );
84
70
85
71
86
72
Mode driveMode; // /< The current drive train mode
@@ -92,6 +78,8 @@ class Drivetrain {
92
78
*/
93
79
Drivetrain ();
94
80
81
+ std::string toggleDrive ();
82
+
95
83
private:
96
84
/* *
97
85
* @brief Drives the robot using arcade drive.
@@ -117,4 +105,6 @@ class Drivetrain {
117
105
*/
118
106
void TankDrive ();
119
107
};
108
+
109
+
120
110
} // namespace Robot
Original file line number Diff line number Diff line change @@ -65,23 +65,26 @@ std::string Drivetrain::toggleDrive() {
65
65
}
66
66
67
67
// Switch the drivetrain control mode between arcade and tank drive with the down button(between 1 and 2)
68
- std::string Drivetrain::SwitchDrive () {
68
+ std::string Drivetrain::SwitchDrive (int driveNum ) {
69
69
if (drivetrainToggleSwitch.get_new_press ()) {
70
70
71
- if (Drivetrain::driveMode == TANK_DRIVE ) {
71
+ if (driveNum == 0 ) {
72
72
Drivetrain::driveMode = CURVATURE_DRIVE;
73
73
std::cout << " Curvature Drive" << std::endl;
74
74
return " Curvature Drive" ;
75
75
}
76
- else if (Drivetrain::driveMode == CURVATURE_DRIVE ) {
76
+ else if (driveNum == 1 ) {
77
77
Drivetrain::driveMode = ARCADE_DRIVE;
78
78
std::cout << " Arcade Drive" << std::endl;
79
79
return " Arcade Drive" ;
80
80
}
81
- else {
81
+ else if (driveNum == 2 ) {
82
82
Drivetrain::driveMode = TANK_DRIVE;
83
83
std::cout << " Tank Drive" << std::endl;
84
84
return " Tank Drive" ;
85
+ } else {
86
+ std::cout << " Error" << std::endl;
87
+ return " Error" ;
85
88
}
86
89
}
87
90
}
You can’t perform that action at this time.
0 commit comments