[examples] Update all examples to use NWU coordinate conventions (#4725)

This commit is contained in:
Ryan Blue
2022-11-28 16:49:49 -05:00
committed by GitHub
parent cb38bacfe8
commit 2b2aa8eef7
40 changed files with 55 additions and 56 deletions

View File

@@ -32,6 +32,6 @@ public class Robot extends TimedRobot {
// Drive with arcade drive.
// That means that the Y axis drives forward
// and backward, and the X turns left and right.
m_robotDrive.arcadeDrive(-m_stick.getY(), m_stick.getX());
m_robotDrive.arcadeDrive(-m_stick.getY(), -m_stick.getX());
}
}

View File

@@ -32,6 +32,6 @@ public class Robot extends TimedRobot {
// Drive with split arcade drive.
// That means that the Y axis of the left stick moves forward
// and backward, and the X of the right stick turns left and right.
m_robotDrive.arcadeDrive(-m_driverController.getLeftY(), m_driverController.getRightX());
m_robotDrive.arcadeDrive(-m_driverController.getLeftY(), -m_driverController.getRightX());
}
}

View File

@@ -41,7 +41,7 @@ public class RobotContainer {
Commands.run(
() ->
m_robotDrive.arcadeDrive(
-m_driverController.getLeftY(), m_driverController.getRightX()),
-m_driverController.getLeftY(), -m_driverController.getRightX()),
m_robotDrive));
}

View File

@@ -39,7 +39,7 @@ public class RobotContainer {
// A split-stick arcade command, with forward/backward controlled by the left
// hand, and turning controlled by the right.
m_robotDrive.arcadeDriveCommand(
() -> -m_driverController.getLeftY(), () -> m_driverController.getRightX()));
() -> -m_driverController.getLeftY(), () -> -m_driverController.getRightX()));
}
/**

View File

@@ -46,7 +46,7 @@ public class RobotContainer {
Commands.run(
() ->
m_robotDrive.arcadeDrive(
-m_driverController.getLeftY(), m_driverController.getRightX()),
-m_driverController.getLeftY(), -m_driverController.getRightX()),
m_robotDrive));
}

View File

@@ -65,7 +65,7 @@ public class RobotContainer {
Commands.run(
() ->
m_robotDrive.arcadeDrive(
-m_driverController.getLeftY(), m_driverController.getRightX()),
-m_driverController.getLeftY(), -m_driverController.getRightX()),
m_robotDrive));
}

View File

@@ -58,7 +58,7 @@ public class RobotContainer {
// Assign default commands
m_drivetrain.setDefaultCommand(
new TankDrive(m_joystick::getLeftY, m_joystick::getRightY, m_drivetrain));
new TankDrive(() -> -m_joystick.getLeftY(), () -> -m_joystick.getRightY(), m_drivetrain));
// Show what command your subsystem is running on the SmartDashboard
SmartDashboard.putData(m_drivetrain);

View File

@@ -61,7 +61,7 @@ public class Robot extends TimedRobot {
/** This function is called periodically during teleoperated mode. */
@Override
public void teleopPeriodic() {
m_robotDrive.arcadeDrive(-m_controller.getLeftY(), m_controller.getRightX());
m_robotDrive.arcadeDrive(-m_controller.getLeftY(), -m_controller.getRightX());
}
/** This function is called once each time the robot enters test mode. */

View File

@@ -50,8 +50,6 @@ public class Robot extends TimedRobot {
@Override
public void teleopPeriodic() {
double turningValue = (kAngleSetpoint - m_gyro.getAngle()) * kP;
// Invert the direction of the turn if we are going backwards
turningValue = Math.copySign(turningValue, m_joystick.getY());
m_myRobot.arcadeDrive(-m_joystick.getY(), turningValue);
m_myRobot.arcadeDrive(-m_joystick.getY(), -turningValue);
}
}

View File

@@ -45,7 +45,7 @@ public class RobotContainer {
new RunCommand(
() ->
m_robotDrive.arcadeDrive(
-m_driverController.getLeftY(), m_driverController.getRightX()),
-m_driverController.getLeftY(), -m_driverController.getRightX()),
m_robotDrive));
}

View File

@@ -51,6 +51,6 @@ public class Robot extends TimedRobot {
@Override
public void teleopPeriodic() {
m_robotDrive.driveCartesian(
-m_joystick.getY(), m_joystick.getX(), m_joystick.getZ(), m_gyro.getRotation2d());
-m_joystick.getY(), -m_joystick.getX(), -m_joystick.getZ(), m_gyro.getRotation2d());
}
}

View File

@@ -54,7 +54,7 @@ public class RobotContainer {
Commands.run(
() ->
m_robotDrive.arcadeDrive(
-m_driverController.getLeftY(), m_driverController.getRightX()),
-m_driverController.getLeftY(), -m_driverController.getRightX()),
m_robotDrive));
// Add commands to the autonomous command chooser

View File

@@ -60,7 +60,9 @@ public class RobotContainer {
// A split-stick arcade command, with forward/backward controlled by the left
// hand, and turning controlled by the right.
new DefaultDrive(
m_robotDrive, m_driverController::getLeftY, m_driverController::getRightX));
m_robotDrive,
() -> -m_driverController.getLeftY(),
() -> -m_driverController.getRightX()));
// Add commands to the autonomous command chooser
m_chooser.setDefaultOption("Simple Auto", m_simpleAuto);

View File

@@ -51,9 +51,9 @@ public class RobotContainer {
new RunCommand(
() ->
m_robotDrive.drive(
m_driverController.getLeftY(),
m_driverController.getRightX(),
m_driverController.getLeftX(),
-m_driverController.getLeftY(),
-m_driverController.getRightX(),
-m_driverController.getLeftX(),
false),
m_robotDrive));
}

View File

@@ -42,6 +42,6 @@ public class Robot extends TimedRobot {
public void teleopPeriodic() {
// Use the joystick X axis for forward movement, Y axis for lateral
// movement, and Z axis for rotation.
m_robotDrive.driveCartesian(-m_stick.getY(), m_stick.getX(), m_stick.getZ());
m_robotDrive.driveCartesian(-m_stick.getY(), -m_stick.getX(), -m_stick.getZ());
}
}

View File

@@ -54,7 +54,7 @@ public class RobotContainer {
new RunCommand(
() ->
m_robotDrive.arcadeDrive(
-m_driverController.getLeftY(), m_driverController.getRightX()),
-m_driverController.getLeftY(), -m_driverController.getRightX()),
m_robotDrive));
}

View File

@@ -52,7 +52,8 @@ public class RapidReactCommandBot {
// Control the drive with split-stick arcade controls
m_drive.setDefaultCommand(
m_drive.arcadeDriveCommand(m_driverController::getLeftY, m_driverController::getRightX));
m_drive.arcadeDriveCommand(
() -> -m_driverController.getLeftY(), () -> -m_driverController.getRightX()));
// Deploy the intake with the X button
m_driverController.x().onTrue(m_intake.intakeCommand());

View File

@@ -92,6 +92,6 @@ public class RobotContainer {
*/
public Command getArcadeDriveCommand() {
return new ArcadeDrive(
m_drivetrain, () -> -m_controller.getRawAxis(1), () -> m_controller.getRawAxis(2));
m_drivetrain, () -> -m_controller.getRawAxis(1), () -> -m_controller.getRawAxis(2));
}
}

View File

@@ -54,7 +54,7 @@ public class RobotContainer {
new RunCommand(
() ->
m_robotDrive.arcadeDrive(
-m_driverController.getLeftY(), m_driverController.getRightX()),
-m_driverController.getLeftY(), -m_driverController.getRightX()),
m_robotDrive));
}

View File

@@ -36,6 +36,6 @@ public class Robot extends TimedRobot {
@Override
public void teleopPeriodic() {
m_myRobot.tankDrive(m_leftStick.getY(), m_rightStick.getY());
m_myRobot.tankDrive(-m_leftStick.getY(), -m_rightStick.getY());
}
}