From a33abd6a4a99816ff40a93adbddf5bed7327709c Mon Sep 17 00:00:00 2001 From: PriyanshuK-ACL <1021693@lcps.org> Date: Wed, 23 Oct 2024 21:25:11 -0400 Subject: [PATCH] Task 3 Completion --- src/main/java/frc/robot/RobotContainer.java | 7 +++++-- src/main/java/frc/robot/commands/DriveCommands.java | 12 ++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 232bff6..5a19670 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -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 diff --git a/src/main/java/frc/robot/commands/DriveCommands.java b/src/main/java/frc/robot/commands/DriveCommands.java index ac21e01..e61814a 100644 --- a/src/main/java/frc/robot/commands/DriveCommands.java +++ b/src/main/java/frc/robot/commands/DriveCommands.java @@ -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(Supplierm_leftMotor, Supplierm_RightMotor){ + public static Command tankDriveCommand1(Supplierm_leftMotor, Supplierm_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 + ); + + }