mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-03 03:01:44 +00:00
[examples] Correct Mecanum example axes (#3955)
This commit is contained in:
@@ -10,8 +10,8 @@
|
||||
|
||||
/**
|
||||
* This is a sample program that uses mecanum drive with a gyro sensor to
|
||||
* maintain rotation vectorsin relation to the starting orientation of the robot
|
||||
* (field-oriented controls).
|
||||
* maintain rotation vectors in relation to the starting orientation of the
|
||||
* robot (field-oriented controls).
|
||||
*/
|
||||
class Robot : public frc::TimedRobot {
|
||||
public:
|
||||
@@ -28,7 +28,7 @@ class Robot : public frc::TimedRobot {
|
||||
* Mecanum drive is used with the gyro angle as an input.
|
||||
*/
|
||||
void TeleopPeriodic() override {
|
||||
m_robotDrive.DriveCartesian(m_joystick.GetX(), m_joystick.GetY(),
|
||||
m_robotDrive.DriveCartesian(-m_joystick.GetY(), m_joystick.GetX(),
|
||||
m_joystick.GetZ(), m_gyro.GetAngle());
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,8 @@ class Robot : public frc::TimedRobot {
|
||||
/* Use the joystick X axis for lateral movement, Y axis for forward
|
||||
* movement, and Z axis for rotation.
|
||||
*/
|
||||
m_robotDrive.DriveCartesian(m_stick.GetX(), m_stick.GetY(), m_stick.GetZ());
|
||||
m_robotDrive.DriveCartesian(-m_stick.GetY(), m_stick.GetX(),
|
||||
m_stick.GetZ());
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -11,8 +11,8 @@ import edu.wpi.first.wpilibj.drive.MecanumDrive;
|
||||
import edu.wpi.first.wpilibj.motorcontrol.PWMSparkMax;
|
||||
|
||||
/**
|
||||
* This is a sample program that uses mecanum drive with a gyro sensor to maintain rotation
|
||||
* vectorsin relation to the starting orientation of the robot (field-oriented controls).
|
||||
* This is a sample program that uses mecanum drive with a gyro sensor to maintain rotation vectors
|
||||
* in relation to the starting orientation of the robot (field-oriented controls).
|
||||
*/
|
||||
public class Robot extends TimedRobot {
|
||||
// gyro calibration constant, may need to be adjusted;
|
||||
@@ -51,6 +51,6 @@ public class Robot extends TimedRobot {
|
||||
@Override
|
||||
public void teleopPeriodic() {
|
||||
m_robotDrive.driveCartesian(
|
||||
m_joystick.getX(), m_joystick.getY(), m_joystick.getZ(), m_gyro.getAngle());
|
||||
-m_joystick.getY(), m_joystick.getX(), m_joystick.getZ(), m_gyro.getAngle());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,6 @@ public class Robot extends TimedRobot {
|
||||
public void teleopPeriodic() {
|
||||
// Use the joystick X axis for lateral movement, Y axis for forward
|
||||
// movement, and Z axis for rotation.
|
||||
m_robotDrive.driveCartesian(m_stick.getX(), m_stick.getY(), m_stick.getZ(), 0.0);
|
||||
m_robotDrive.driveCartesian(-m_stick.getY(), m_stick.getX(), m_stick.getZ(), 0.0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user