Skip to content

Commit c7862e4

Browse files
author
Jay9971
committed
merge
1 parent 8a50385 commit c7862e4

File tree

3 files changed

+15
-19
lines changed

3 files changed

+15
-19
lines changed

include/robot/auton.h

+3
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ namespace Robot {
4444
*/
4545
void AutoDrive(Intake &intake, Latch &latch);
4646

47+
void AutonSwitcher();
48+
49+
4750
/**
4851
* @brief Switches the autonomous program.
4952
*

include/robot/drivetrain.h

+5-15
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,6 @@ class Drivetrain {
3939
*/
4040
void run();
4141

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-
5642
enum Mode {
5743
CURVATURE_DRIVE,
5844
ARCADE_DRIVE,
@@ -80,7 +66,7 @@ class Drivetrain {
8066
* Arcade drive uses the left joystick for forward and backward movement, and the right joystick for left and right movement.
8167
* Tank drive uses the left and right joysticks for controlling the left and right sides of the robot.
8268
*/
83-
void SwitchDrive();
69+
static void SwitchDrive(int driveNum);
8470

8571

8672
Mode driveMode; ///< The current drive train mode
@@ -92,6 +78,8 @@ class Drivetrain {
9278
*/
9379
Drivetrain();
9480

81+
std::string toggleDrive();
82+
9583
private:
9684
/**
9785
* @brief Drives the robot using arcade drive.
@@ -117,4 +105,6 @@ class Drivetrain {
117105
*/
118106
void TankDrive();
119107
};
108+
109+
120110
} // namespace Robot

src/subsystems/drivetrain.cpp

+7-4
Original file line numberDiff line numberDiff line change
@@ -65,23 +65,26 @@ std::string Drivetrain::toggleDrive() {
6565
}
6666

6767
// 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) {
6969
if(drivetrainToggleSwitch.get_new_press()) {
7070

71-
if (Drivetrain::driveMode == TANK_DRIVE) {
71+
if (driveNum == 0) {
7272
Drivetrain::driveMode = CURVATURE_DRIVE;
7373
std::cout << "Curvature Drive" << std::endl;
7474
return "Curvature Drive";
7575
}
76-
else if (Drivetrain::driveMode == CURVATURE_DRIVE) {
76+
else if (driveNum == 1) {
7777
Drivetrain::driveMode = ARCADE_DRIVE;
7878
std::cout << "Arcade Drive" << std::endl;
7979
return "Arcade Drive";
8080
}
81-
else {
81+
else if (driveNum == 2) {
8282
Drivetrain::driveMode = TANK_DRIVE;
8383
std::cout << "Tank Drive" << std::endl;
8484
return "Tank Drive";
85+
} else {
86+
std::cout << "Error" << std::endl;
87+
return "Error";
8588
}
8689
}
8790
}

0 commit comments

Comments
 (0)