mirror of
https://github.com/Team4388/RiseOfRidgebotics2020.git
synced 2026-06-09 00:38:00 -06:00
Fixed Drive Train the right way, switched gear buttons for Josh
This commit is contained in:
@@ -133,11 +133,11 @@ public class RobotContainer {
|
||||
/* Driver Buttons */
|
||||
// sets solenoids into high gear
|
||||
new JoystickButton(getDriverJoystick(), XboxController.RIGHT_BUMPER_BUTTON)
|
||||
.whenPressed(new InstantCommand(() -> m_robotPneumatics.setShiftState(false), m_robotDrive));
|
||||
.whenPressed(new InstantCommand(() -> m_robotPneumatics.setShiftState(true), m_robotDrive));
|
||||
|
||||
// sets solenoids into low gear
|
||||
new JoystickButton(getDriverJoystick(), XboxController.LEFT_BUMPER_BUTTON)
|
||||
.whenPressed(new InstantCommand(() -> m_robotPneumatics.setShiftState(true), m_robotDrive));
|
||||
.whenPressed(new InstantCommand(() -> m_robotPneumatics.setShiftState(false), m_robotDrive));
|
||||
|
||||
/* Operator Buttons */
|
||||
//TODO: Shooter Buttons
|
||||
|
||||
@@ -39,26 +39,32 @@ public class DriveWithJoystick extends CommandBase {
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
public void execute() {
|
||||
double moveInput = m_controller.getRightXAxis();
|
||||
double steerInput = -m_controller.getLeftYAxis();
|
||||
double moveInput = -m_controller.getLeftYAxis();
|
||||
double steerInput = m_controller.getRightXAxis();
|
||||
double moveOutput = 0;
|
||||
double steerOutput = 0;
|
||||
if (steerInput >= 0){
|
||||
steerOutput = -Math.cos(1.571*steerInput)+1;
|
||||
if (moveInput >= 0){
|
||||
moveOutput = -Math.cos(1.571*moveInput)+1;
|
||||
} else {
|
||||
steerOutput = Math.cos(1.571*steerInput)-1;
|
||||
moveOutput = Math.cos(1.571*moveInput)-1;
|
||||
}
|
||||
|
||||
double cosMultiplier = 1.0;
|
||||
double deadzone = .1;
|
||||
if (moveInput > 0){
|
||||
moveOutput = -(cosMultiplier - deadzone) * Math.cos(1.571*moveInput) + cosMultiplier;
|
||||
} else if (moveInput < 0) {
|
||||
moveOutput = (cosMultiplier - deadzone) * Math.cos(1.571*moveInput) - cosMultiplier;
|
||||
if (steerInput > 0){
|
||||
steerOutput = -(cosMultiplier - deadzone) * Math.cos(1.571*steerInput) + cosMultiplier;
|
||||
} else if (steerInput < 0) {
|
||||
steerOutput = (cosMultiplier - deadzone) * Math.cos(1.571*steerInput) - cosMultiplier;
|
||||
} else {
|
||||
moveOutput = 0;
|
||||
steerOutput = 0;
|
||||
}
|
||||
|
||||
|
||||
if (moveOutput > 0.5) {
|
||||
moveOutput = 0.5;
|
||||
} else if(moveOutput < -0.5) {
|
||||
moveOutput = -0.5;
|
||||
}
|
||||
|
||||
SmartDashboard.putNumber("Steer Output Test", moveOutput);
|
||||
m_drive.driveWithInput(moveOutput, steerOutput);
|
||||
}
|
||||
|
||||
@@ -322,7 +322,7 @@ public class Drive extends SubsystemBase {
|
||||
* using the Differential Drive class to manage the two inputs
|
||||
*/
|
||||
public void driveWithInput(double move, double steer) {
|
||||
m_driveTrain.arcadeDrive(move, steer);
|
||||
m_driveTrain.arcadeDrive(steer, move);
|
||||
m_leftBackMotor.follow(m_leftFrontMotor);
|
||||
m_rightBackMotor.follow(m_rightFrontMotor);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user