Skip to content

Commit

Permalink
Drivetrain and arcadedrive now work
Browse files Browse the repository at this point in the history
  • Loading branch information
BobSaidHi committed Mar 10, 2022
1 parent e0e07e4 commit fddeb6b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/main/java/frc/robot/commands/ArcadeDrive.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ public ArcadeDrive(Drivetrain dt) {
@Override
public void initialize() {}

//

// Called every time the scheduler runs while the command is scheduled.
@Override
public void execute() {
//double speed = Robot.m_oi.getAxis(RobotMap.JOYSTICK_DRIVE_FORWARDS_ID) * -1;
//double rotation = Robot.m_oi.getAxis(RobotMap.JOYSTICK_DRIVE_ROTATION_ID)
double speed = RobotContainer.controller.getRawAxis(1);
double rotation = RobotContainer.controller.getRawAxis(0);
double speed = RobotContainer.controller.getRawAxis(0);
double rotation = RobotContainer.controller.getRawAxis(1)*-1;
//double speed = RobotContainer.controller.getLeftX();
//double rotation = RobotContainer.controller.getLeftY();
driveTrain.aDrive(speed, rotation);
}

Expand Down
11 changes: 7 additions & 4 deletions src/main/java/frc/robot/subsystems/DriveTrain.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@ public class Drivetrain extends SubsystemBase {
CANSparkMax rightMotor1 = new CANSparkMax(Constants.MOTOR_RIGHT_FRONT_ID, MotorType.kBrushless);
CANSparkMax rightMotor2 = new CANSparkMax(Constants.MOTOR_RIGHT_BACK_ID, MotorType.kBrushless);

// Invert Right side (Correct backwardness.)
//rightMotor1.setInverted(true);

// Motor Controller Group Objects
MotorControllerGroup leftMotors = new MotorControllerGroup(leftMotor1, leftMotor2);
MotorControllerGroup rightMotors = new MotorControllerGroup(rightMotor1, rightMotor2);

// Invert Right side (Correct backwardsness.)
rightMotors.setInverted(true);
// Invert Right side (Correct backwardness.)
//rightMotors.setInverted(true);

DifferentialDrive dualDrive = new DifferentialDrive(leftMotors, rightMotors);

Expand All @@ -38,13 +41,13 @@ public Drivetrain() {
* @param rotation
*/
public void aDrive(double speed, double rotation){
dualDrive.arcadeDrive(speed,rotation);
dualDrive.arcadeDrive(speed, rotation);
}

/**
*
* @param leftSPeed
* @param righSpeed
* @param rightSpeed
*/
public void dDrive(double leftSpeed, double rightSpeed) {
dualDrive.tankDrive(leftSpeed, rightSpeed);
Expand Down

0 comments on commit fddeb6b

Please sign in to comment.