Skip to content

Commit

Permalink
Task 3 Completion
Browse files Browse the repository at this point in the history
  • Loading branch information
PriyanshuK-ACL committed Oct 24, 2024
1 parent cdecd30 commit a33abd6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
7 changes: 5 additions & 2 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,14 @@ public RobotContainer() {
//This causes the xrp to drive based on the left joystick y and right joystick x of the controller by default.
//It uses lambdas to make the parameters suppliers, which means that instead of them being constant, they rerun each time the command is scheduled.
//The values are negated because the axes are flipped for some reason.
m_xrpDrivetrain.setDefaultCommand(DriveCommands.arcadeDriveCommand(()-> -m_controller.getLeftY(), () -> -m_controller.getRightX()));
//m_xrpDrivetrain.setDefaultCommand(DriveCommands.arcadeDriveCommand(()-> -m_controller.getLeftY(), () -> -m_controller.getRightX()));
//TODO: Task 4-Comment out the above line by adding // to the left of it. Then, set the default command to be your tankDriveCommand.
//HINT: In tank drive, the left wheel is controlled by the y axis of the left joystick and the y axis of the right joystick.
}

public void RobotContainer1() {
configureButtonBindings();
m_xrpDrivetrain.setDefaultCommand(DriveCommands.tankDriveCommand(()-> -m_controller.getLeftY(), () -> -m_controller.getRightX()));
}
/**
* Use this method to define your button->command mappings. Buttons can be created by
* instantiating a {@link edu.wpi.first.wpilibj.GenericHID} or one of its subclasses ({@link
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/frc/robot/commands/DriveCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -244,13 +244,13 @@ public static Command driveDistance1(double m_distance){
() -> {return Math.abs(m_diffDrive.getAverageDistanceInch()) >=m_distance;},m_diffDrive);

}
public static Command tankDriveCommand1(Supplier<Double>m_leftMotor, Supplier<Double>m_RightMotor){
public static Command tankDriveCommand1(Supplier<Double>m_leftMotor, Supplier<Double>m_rightMotor){
XRPDrivetrain m_diffDrive=RobotContainer.m_xrpDrivetrain;
return new InstandCommand(()-> {
m_diffDrive.tankDrive{m_leftMotor.get(), m_rightMotor.get()}, m_diffDrive
}
);}

return new InstantCommand(()->m_diffDrive.tankDrive(m_leftMotor.get(), m_rightMotor.get()),
m_diffDrive
);
}



Expand Down

0 comments on commit a33abd6

Please sign in to comment.