[wpilib] Rename OnboardIMU constants to all caps

This commit is contained in:
Peter Johnson
2026-03-17 16:45:25 -07:00
parent e73e2e99f7
commit 3776f8a1ef
41 changed files with 72 additions and 72 deletions

View File

@@ -37,7 +37,7 @@ class Drivetrain:
self.leftEncoder = wpilib.Encoder(0, 1)
self.rightEncoder = wpilib.Encoder(2, 3)
self.imu = wpilib.OnboardIMU(wpilib.OnboardIMU.MountOrientation.kFlat)
self.imu = wpilib.OnboardIMU(wpilib.OnboardIMU.MountOrientation.FLAT)
self.leftPIDController = wpimath.PIDController(1.0, 0.0, 0.0)
self.rightPIDController = wpimath.PIDController(1.0, 0.0, 0.0)

View File

@@ -33,7 +33,7 @@ class Drivetrain:
self.leftEncoder = wpilib.Encoder(0, 1)
self.rightEncoder = wpilib.Encoder(2, 3)
self.imu = wpilib.OnboardIMU(wpilib.OnboardIMU.MountOrientation.kFlat)
self.imu = wpilib.OnboardIMU(wpilib.OnboardIMU.MountOrientation.FLAT)
self.leftPIDController = wpimath.PIDController(1, 0, 0)
self.rightPIDController = wpimath.PIDController(1, 0, 0)

View File

@@ -20,7 +20,7 @@ class MyRobot(wpilib.TimedRobot):
kLeftMotorPort = 0
kRightMotorPort = 1
kIMUMountOrientation = wpilib.OnboardIMU.MountOrientation.kFlat
kIMUMountOrientation = wpilib.OnboardIMU.MountOrientation.FLAT
kJoystickPort = 0
def __init__(self) -> None:

View File

@@ -12,8 +12,8 @@ import wpimath
class Drivetrain:
"""Represents a mecanum drive style drivetrain."""
kMaxVelocity = 3.0 # 3 meters per second
kMaxAngularVelocity = math.pi # 1/2 rotation per second
MAX_VELOCITY = 3.0 # 3 meters per second
MAX_ANGULAR_VELOCITY = math.pi # 1/2 rotation per second
def __init__(self) -> None:
self.frontLeftMotor = wpilib.PWMSparkMax(1)
@@ -36,7 +36,7 @@ class Drivetrain:
self.backLeftPIDController = wpimath.PIDController(1, 0, 0)
self.backRightPIDController = wpimath.PIDController(1, 0, 0)
self.imu = wpilib.OnboardIMU(wpilib.OnboardIMU.MountOrientation.kFlat)
self.imu = wpilib.OnboardIMU(wpilib.OnboardIMU.MountOrientation.FLAT)
self.kinematics = wpimath.MecanumDriveKinematics(
self.frontLeftLocation,
@@ -121,7 +121,7 @@ class Drivetrain:
self.setVelocities(
self.kinematics.toWheelVelocities(
chassisVelocities.discretize(periodSeconds)
).desaturate(self.kMaxVelocity)
).desaturate(self.MAX_VELOCITY)
)
def updateOdometry(self) -> None:

View File

@@ -35,7 +35,7 @@ class MyRobot(wpilib.TimedRobot):
# negative values when we push forward.
xVelocity = (
-self.xvelocityLimiter.calculate(self.controller.getLeftY())
* Drivetrain.kMaxVelocity
* Drivetrain.MAX_VELOCITY
)
# Get the y velocity or sideways/strafe velocity. We are inverting this because
@@ -43,7 +43,7 @@ class MyRobot(wpilib.TimedRobot):
# return positive values when you pull to the right by default.
yVelocity = (
-self.yvelocityLimiter.calculate(self.controller.getLeftX())
* Drivetrain.kMaxVelocity
* Drivetrain.MAX_VELOCITY
)
# Get the rate of angular rotation. We are inverting this because we want a
@@ -52,7 +52,7 @@ class MyRobot(wpilib.TimedRobot):
# the right by default.
rot = (
-self.rotLimiter.calculate(self.controller.getRightX())
* Drivetrain.kMaxAngularVelocity
* Drivetrain.MAX_ANGULAR_VELOCITY
)
self.mecanum.drive(xVelocity, yVelocity, rot, fieldRelative, self.getPeriod())

View File

@@ -19,7 +19,7 @@ class MyRobot(wpilib.TimedRobot):
kRearLeftChannel = 1
kFrontRightChannel = 2
kRearRightChannel = 3
kIMUMountOrientation = wpilib.OnboardIMU.MountOrientation.kFlat
kIMUMountOrientation = wpilib.OnboardIMU.MountOrientation.FLAT
kJoystickPort = 0
def __init__(self) -> None:

View File

@@ -16,8 +16,8 @@ from exampleglobalmeasurementsensor import ExampleGlobalMeasurementSensor
class Drivetrain:
"""Represents a mecanum drive style drivetrain."""
kMaxVelocity = 3.0 # 3 meters per second
kMaxAngularVelocity = math.pi # 1/2 rotation per second
MAX_VELOCITY = 3.0 # 3 meters per second
MAX_ANGULAR_VELOCITY = math.pi # 1/2 rotation per second
def __init__(self) -> None:
self.frontLeftMotor = wpilib.PWMSparkMax(1)
@@ -40,7 +40,7 @@ class Drivetrain:
self.backLeftPIDController = wpimath.PIDController(1, 0, 0)
self.backRightPIDController = wpimath.PIDController(1, 0, 0)
self.imu = wpilib.OnboardIMU(wpilib.OnboardIMU.MountOrientation.kFlat)
self.imu = wpilib.OnboardIMU(wpilib.OnboardIMU.MountOrientation.FLAT)
self.kinematics = wpimath.MecanumDriveKinematics(
self.frontLeftLocation,
@@ -146,7 +146,7 @@ class Drivetrain:
self.setVelocities(
self.kinematics.toWheelVelocities(
chassisVelocities.discretize(period)
).desaturate(self.kMaxVelocity)
).desaturate(self.MAX_VELOCITY)
)
def updateOdometry(self) -> None:

View File

@@ -34,19 +34,19 @@ class MyRobot(wpilib.TimedRobot):
# Get the x velocity. We are inverting this because Xbox controllers return
# negative values when we push forward.
xVelocity = -self.xvelocityLimiter.calculate(self.controller.getLeftY())
xVelocity *= Drivetrain.kMaxVelocity
xVelocity *= Drivetrain.MAX_VELOCITY
# Get the y velocity or sideways/strafe velocity. We are inverting this because
# we want a positive value when we pull to the left. Xbox controllers
# return positive values when you pull to the right by default.
yVelocity = -self.yvelocityLimiter.calculate(self.controller.getLeftX())
yVelocity *= Drivetrain.kMaxVelocity
yVelocity *= Drivetrain.MAX_VELOCITY
# Get the rate of angular rotation. We are inverting this because we want a
# positive value when we pull to the left (remember, CCW is positive in
# mathematics). Xbox controllers return positive values when you pull to
# the right by default.
rot = -self.rotLimiter.calculate(self.controller.getRightX())
rot *= Drivetrain.kMaxAngularVelocity
rot *= Drivetrain.MAX_ANGULAR_VELOCITY
self.mecanum.drive(xVelocity, yVelocity, rot, fieldRelative, self.getPeriod())

View File

@@ -43,7 +43,7 @@ class Drive(Subsystem):
DriveConstants.kRightEncoderReversed,
)
self.imu = wpilib.OnboardIMU(wpilib.OnboardIMU.MountOrientation.kFlat)
self.imu = wpilib.OnboardIMU(wpilib.OnboardIMU.MountOrientation.FLAT)
self.controller = wpimath.ProfiledPIDController(
DriveConstants.kTurnP,
DriveConstants.kTurnI,

View File

@@ -35,7 +35,7 @@ class Drivetrain:
self.leftPIDController = wpimath.PIDController(8.5, 0, 0)
self.rightPIDController = wpimath.PIDController(8.5, 0, 0)
self.imu = wpilib.OnboardIMU(wpilib.OnboardIMU.MountOrientation.kFlat)
self.imu = wpilib.OnboardIMU(wpilib.OnboardIMU.MountOrientation.FLAT)
self.kinematics = wpimath.DifferentialDriveKinematics(self.kTrackwidth)
self.odometry = wpimath.DifferentialDriveOdometry(

View File

@@ -29,7 +29,7 @@ class Drivetrain:
self.backLeft = swervemodule.SwerveModule(5, 6, 8, 9, 10, 11)
self.backRight = swervemodule.SwerveModule(7, 8, 12, 13, 14, 15)
self.imu = wpilib.OnboardIMU(wpilib.OnboardIMU.MountOrientation.kFlat)
self.imu = wpilib.OnboardIMU(wpilib.OnboardIMU.MountOrientation.FLAT)
self.kinematics = wpimath.SwerveDrive4Kinematics(
self.frontLeftLocation,

View File

@@ -31,7 +31,7 @@ class Drivetrain:
self.backLeft = swervemodule.SwerveModule(5, 6, 8, 9, 10, 11)
self.backRight = swervemodule.SwerveModule(7, 8, 12, 13, 14, 15)
self.imu = wpilib.OnboardIMU(wpilib.OnboardIMU.MountOrientation.kFlat)
self.imu = wpilib.OnboardIMU(wpilib.OnboardIMU.MountOrientation.FLAT)
self.kinematics = wpimath.SwerveDrive4Kinematics(
self.frontLeftLocation,

View File

@@ -18,13 +18,13 @@ wpi::units::radian_t OnboardIMU::GetYawNoOffset() {
int64_t timestamp;
double val;
switch (m_mountOrientation) {
case kFlat:
case FLAT:
val = HAL_GetIMUYawFlat(&timestamp);
break;
case kLandscape:
case LANDSCAPE:
val = HAL_GetIMUYawLandscape(&timestamp);
break;
case kPortrait:
case PORTRAIT:
val = HAL_GetIMUYawPortrait(&timestamp);
break;
default:
@@ -61,13 +61,13 @@ wpi::units::radian_t OnboardIMU::GetAngleX() {
HAL_EulerAngles3d val;
int32_t status = 0;
switch (m_mountOrientation) {
case kFlat:
case FLAT:
HAL_GetIMUEulerAnglesFlat(&val, &status);
break;
case kLandscape:
case LANDSCAPE:
HAL_GetIMUEulerAnglesLandscape(&val, &status);
break;
case kPortrait:
case PORTRAIT:
HAL_GetIMUEulerAnglesPortrait(&val, &status);
break;
}
@@ -79,13 +79,13 @@ wpi::units::radian_t OnboardIMU::GetAngleY() {
HAL_EulerAngles3d val;
int32_t status = 0;
switch (m_mountOrientation) {
case kFlat:
case FLAT:
HAL_GetIMUEulerAnglesFlat(&val, &status);
break;
case kLandscape:
case LANDSCAPE:
HAL_GetIMUEulerAnglesLandscape(&val, &status);
break;
case kPortrait:
case PORTRAIT:
HAL_GetIMUEulerAnglesPortrait(&val, &status);
break;
}
@@ -97,13 +97,13 @@ wpi::units::radian_t OnboardIMU::GetAngleZ() {
HAL_EulerAngles3d val;
int32_t status = 0;
switch (m_mountOrientation) {
case kFlat:
case FLAT:
HAL_GetIMUEulerAnglesFlat(&val, &status);
break;
case kLandscape:
case LANDSCAPE:
HAL_GetIMUEulerAnglesLandscape(&val, &status);
break;
case kPortrait:
case PORTRAIT:
HAL_GetIMUEulerAnglesPortrait(&val, &status);
break;
}

View File

@@ -22,13 +22,13 @@ class OnboardIMU {
*/
enum MountOrientation {
/** Flat (mounted parallel to the ground). */
kFlat,
FLAT,
/** Landscape (vertically mounted with long edge of Systemcore parallel to
the ground). */
kLandscape,
LANDSCAPE,
/** Portrait (vertically mounted with the short edge of Systemcore parallel
to the ground). */
kPortrait
PORTRAIT
};
/**

View File

@@ -72,7 +72,7 @@ class Drivetrain {
wpi::math::PIDController m_leftPIDController{1.0, 0.0, 0.0};
wpi::math::PIDController m_rightPIDController{1.0, 0.0, 0.0};
wpi::OnboardIMU m_imu{wpi::OnboardIMU::kFlat};
wpi::OnboardIMU m_imu{wpi::OnboardIMU::FLAT};
wpi::math::DifferentialDriveKinematics m_kinematics{kTrackwidth};
wpi::math::DifferentialDriveOdometry m_odometry{

View File

@@ -144,7 +144,7 @@ class Drivetrain {
wpi::math::PIDController m_leftPIDController{1.0, 0.0, 0.0};
wpi::math::PIDController m_rightPIDController{1.0, 0.0, 0.0};
wpi::OnboardIMU m_imu{wpi::OnboardIMU::kFlat};
wpi::OnboardIMU m_imu{wpi::OnboardIMU::FLAT};
wpi::math::DifferentialDriveKinematics m_kinematics{kTrackwidth};

View File

@@ -45,7 +45,7 @@ class Robot : public wpi::TimedRobot {
static constexpr int kLeftMotorPort = 0;
static constexpr int kRightMotorPort = 1;
static constexpr wpi::OnboardIMU::MountOrientation kIMUMountOrientation =
wpi::OnboardIMU::kFlat;
wpi::OnboardIMU::FLAT;
static constexpr int kJoystickPort = 0;
wpi::PWMSparkMax m_left{kLeftMotorPort};

View File

@@ -66,7 +66,7 @@ class Drivetrain {
wpi::math::PIDController m_backLeftPIDController{1.0, 0.0, 0.0};
wpi::math::PIDController m_backRightPIDController{1.0, 0.0, 0.0};
wpi::OnboardIMU m_imu{wpi::OnboardIMU::kFlat};
wpi::OnboardIMU m_imu{wpi::OnboardIMU::FLAT};
wpi::math::MecanumDriveKinematics m_kinematics{
m_frontLeftLocation, m_frontRightLocation, m_backLeftLocation,

View File

@@ -44,7 +44,7 @@ class Robot : public wpi::TimedRobot {
static constexpr int kFrontRightMotorPort = 2;
static constexpr int kRearRightMotorPort = 3;
static constexpr wpi::OnboardIMU::MountOrientation kIMUMountOrientation =
wpi::OnboardIMU::kFlat;
wpi::OnboardIMU::FLAT;
static constexpr int kJoystickPort = 0;
wpi::PWMSparkMax m_frontLeft{kFrontLeftMotorPort};

View File

@@ -65,7 +65,7 @@ class Drivetrain {
wpi::math::PIDController m_backLeftPIDController{1.0, 0.0, 0.0};
wpi::math::PIDController m_backRightPIDController{1.0, 0.0, 0.0};
wpi::OnboardIMU m_imu{wpi::OnboardIMU::kFlat};
wpi::OnboardIMU m_imu{wpi::OnboardIMU::FLAT};
wpi::math::MecanumDriveKinematics m_kinematics{
m_frontLeftLocation, m_frontRightLocation, m_backLeftLocation,

View File

@@ -65,7 +65,7 @@ class Drive : public wpi::cmd::SubsystemBase {
DriveConstants::kRightEncoderPorts[1],
DriveConstants::kRightEncoderReversed};
wpi::OnboardIMU m_imu{wpi::OnboardIMU::kFlat};
wpi::OnboardIMU m_imu{wpi::OnboardIMU::FLAT};
wpi::math::ProfiledPIDController<wpi::units::radians> m_controller{
DriveConstants::kTurnP,

View File

@@ -87,7 +87,7 @@ class Drivetrain {
wpi::math::PIDController m_leftPIDController{8.5, 0.0, 0.0};
wpi::math::PIDController m_rightPIDController{8.5, 0.0, 0.0};
wpi::OnboardIMU m_imu{wpi::OnboardIMU::kFlat};
wpi::OnboardIMU m_imu{wpi::OnboardIMU::FLAT};
wpi::math::DifferentialDriveKinematics m_kinematics{kTrackwidth};
wpi::math::DifferentialDriveOdometry m_odometry{

View File

@@ -41,7 +41,7 @@ class Drivetrain {
SwerveModule m_backLeft{5, 6, 8, 9, 10, 11};
SwerveModule m_backRight{7, 8, 12, 13, 14, 15};
wpi::OnboardIMU m_imu{wpi::OnboardIMU::kFlat};
wpi::OnboardIMU m_imu{wpi::OnboardIMU::FLAT};
wpi::math::SwerveDriveKinematics<4> m_kinematics{
m_frontLeftLocation, m_frontRightLocation, m_backLeftLocation,

View File

@@ -40,7 +40,7 @@ class Drivetrain {
SwerveModule m_backLeft{5, 6, 8, 9, 10, 11};
SwerveModule m_backRight{7, 8, 12, 13, 14, 15};
wpi::OnboardIMU m_imu{wpi::OnboardIMU::kFlat};
wpi::OnboardIMU m_imu{wpi::OnboardIMU::FLAT};
wpi::math::SwerveDriveKinematics<4> m_kinematics{
m_frontLeftLocation, m_frontRightLocation, m_backLeftLocation,

View File

@@ -30,7 +30,7 @@ class Robot : public wpi::TimedRobot {
private:
wpi::units::meters_per_second_squared_t m_prevXAccel = 0.0_mps_sq;
wpi::units::meters_per_second_squared_t m_prevYAccel = 0.0_mps_sq;
wpi::OnboardIMU m_accelerometer{wpi::OnboardIMU::MountOrientation::kFlat};
wpi::OnboardIMU m_accelerometer{wpi::OnboardIMU::MountOrientation::FLAT};
};
#ifndef RUNNING_WPILIB_TESTS

View File

@@ -27,7 +27,7 @@ class Robot : public wpi::TimedRobot {
}
private:
wpi::OnboardIMU m_accelerometer{wpi::OnboardIMU::MountOrientation::kFlat};
wpi::OnboardIMU m_accelerometer{wpi::OnboardIMU::MountOrientation::FLAT};
wpi::math::LinearFilter<wpi::units::meters_per_second_squared_t>
m_xAccelFilter = wpi::math::LinearFilter<
wpi::units::meters_per_second_squared_t>::MovingAverage(10);

View File

@@ -35,7 +35,7 @@ class Robot : public wpi::TimedRobot {
private:
// Creates an object for the Systemcore IMU
wpi::OnboardIMU m_IMU{wpi::OnboardIMU::MountOrientation::kFlat};
wpi::OnboardIMU m_IMU{wpi::OnboardIMU::MountOrientation::FLAT};
};
#ifndef RUNNING_WPILIB_TESTS

View File

@@ -14,11 +14,11 @@ public class OnboardIMU {
/** A mount orientation of Systemcore. */
public enum MountOrientation {
/** Flat (mounted parallel to the ground). */
kFlat,
FLAT,
/** Landscape (vertically mounted with long edge of Systemcore parallel to the ground). */
kLandscape,
LANDSCAPE,
/** Portrait (vertically mounted with the short edge of Systemcore parallel to the ground). */
kPortrait
PORTRAIT
}
/**
@@ -160,9 +160,9 @@ public class OnboardIMU {
private double[] getRawEulerAngles() {
double[] anglesRaw = new double[3];
switch (m_mountOrientation) {
case kFlat -> IMUJNI.getIMUEulerAnglesFlat(anglesRaw);
case kLandscape -> IMUJNI.getIMUEulerAnglesLandscape(anglesRaw);
case kPortrait -> IMUJNI.getIMUEulerAnglesPortrait(anglesRaw);
case FLAT -> IMUJNI.getIMUEulerAnglesFlat(anglesRaw);
case LANDSCAPE -> IMUJNI.getIMUEulerAnglesLandscape(anglesRaw);
case PORTRAIT -> IMUJNI.getIMUEulerAnglesPortrait(anglesRaw);
default -> {
// NOP
}
@@ -184,9 +184,9 @@ public class OnboardIMU {
private double getYawNoOffset() {
return switch (m_mountOrientation) {
case kFlat -> IMUJNI.getIMUYawFlat();
case kLandscape -> IMUJNI.getIMUYawLandscape();
case kPortrait -> IMUJNI.getIMUYawPortrait();
case FLAT -> IMUJNI.getIMUYawFlat();
case LANDSCAPE -> IMUJNI.getIMUYawLandscape();
case PORTRAIT -> IMUJNI.getIMUYawPortrait();
default -> 0;
};
}

View File

@@ -31,7 +31,7 @@ public class Drivetrain {
private final Encoder m_leftEncoder = new Encoder(0, 1);
private final Encoder m_rightEncoder = new Encoder(2, 3);
private final OnboardIMU m_imu = new OnboardIMU(OnboardIMU.MountOrientation.kFlat);
private final OnboardIMU m_imu = new OnboardIMU(OnboardIMU.MountOrientation.FLAT);
private final PIDController m_leftPIDController = new PIDController(1, 0, 0);
private final PIDController m_rightPIDController = new PIDController(1, 0, 0);

View File

@@ -54,7 +54,7 @@ public class Drivetrain {
private final Encoder m_leftEncoder = new Encoder(0, 1);
private final Encoder m_rightEncoder = new Encoder(2, 3);
private final OnboardIMU m_imu = new OnboardIMU(OnboardIMU.MountOrientation.kFlat);
private final OnboardIMU m_imu = new OnboardIMU(OnboardIMU.MountOrientation.FLAT);
private final PIDController m_leftPIDController = new PIDController(1, 0, 0);
private final PIDController m_rightPIDController = new PIDController(1, 0, 0);

View File

@@ -23,7 +23,7 @@ public class Robot extends TimedRobot {
private static final int kLeftMotorPort = 0;
private static final int kRightMotorPort = 1;
private static final OnboardIMU.MountOrientation kIMUMountOrientation =
OnboardIMU.MountOrientation.kFlat;
OnboardIMU.MountOrientation.FLAT;
private static final int kJoystickPort = 0;
private final PWMSparkMax m_leftDrive = new PWMSparkMax(kLeftMotorPort);

View File

@@ -41,7 +41,7 @@ public class Drivetrain {
private final PIDController m_backLeftPIDController = new PIDController(1, 0, 0);
private final PIDController m_backRightPIDController = new PIDController(1, 0, 0);
private final OnboardIMU m_imu = new OnboardIMU(OnboardIMU.MountOrientation.kFlat);
private final OnboardIMU m_imu = new OnboardIMU(OnboardIMU.MountOrientation.FLAT);
private final MecanumDriveKinematics m_kinematics =
new MecanumDriveKinematics(

View File

@@ -21,7 +21,7 @@ public class Robot extends TimedRobot {
private static final int kFrontRightChannel = 2;
private static final int kRearRightChannel = 3;
private static final OnboardIMU.MountOrientation kIMUMountOrientation =
OnboardIMU.MountOrientation.kFlat;
OnboardIMU.MountOrientation.FLAT;
private static final int kJoystickPort = 0;
private final MecanumDrive m_robotDrive;

View File

@@ -45,7 +45,7 @@ public class Drivetrain {
private final PIDController m_backLeftPIDController = new PIDController(1, 0, 0);
private final PIDController m_backRightPIDController = new PIDController(1, 0, 0);
private final OnboardIMU m_imu = new OnboardIMU(OnboardIMU.MountOrientation.kFlat);
private final OnboardIMU m_imu = new OnboardIMU(OnboardIMU.MountOrientation.FLAT);
private final MecanumDriveKinematics m_kinematics =
new MecanumDriveKinematics(

View File

@@ -49,7 +49,7 @@ public class Drive extends SubsystemBase {
DriveConstants.kRightEncoderPorts[1],
DriveConstants.kRightEncoderReversed);
private final OnboardIMU m_imu = new OnboardIMU(OnboardIMU.MountOrientation.kFlat);
private final OnboardIMU m_imu = new OnboardIMU(OnboardIMU.MountOrientation.FLAT);
private final ProfiledPIDController m_controller =
new ProfiledPIDController(
DriveConstants.kTurnP,

View File

@@ -45,7 +45,7 @@ public class Drivetrain {
private final PIDController m_leftPIDController = new PIDController(8.5, 0, 0);
private final PIDController m_rightPIDController = new PIDController(8.5, 0, 0);
private final OnboardIMU m_imu = new OnboardIMU(OnboardIMU.MountOrientation.kFlat);
private final OnboardIMU m_imu = new OnboardIMU(OnboardIMU.MountOrientation.FLAT);
private final DifferentialDriveKinematics m_kinematics =
new DifferentialDriveKinematics(kTrackwidth);

View File

@@ -26,7 +26,7 @@ public class Drivetrain {
private final SwerveModule m_backLeft = new SwerveModule(5, 6, 8, 9, 10, 11);
private final SwerveModule m_backRight = new SwerveModule(7, 8, 12, 13, 14, 15);
private final OnboardIMU m_imu = new OnboardIMU(OnboardIMU.MountOrientation.kFlat);
private final OnboardIMU m_imu = new OnboardIMU(OnboardIMU.MountOrientation.FLAT);
private final SwerveDriveKinematics m_kinematics =
new SwerveDriveKinematics(

View File

@@ -30,7 +30,7 @@ public class Drivetrain {
private final SwerveModule m_backLeft = new SwerveModule(5, 6, 8, 9, 10, 11);
private final SwerveModule m_backRight = new SwerveModule(7, 8, 12, 13, 14, 15);
private final OnboardIMU m_imu = new OnboardIMU(OnboardIMU.MountOrientation.kFlat);
private final OnboardIMU m_imu = new OnboardIMU(OnboardIMU.MountOrientation.FLAT);
private final SwerveDriveKinematics m_kinematics =
new SwerveDriveKinematics(

View File

@@ -17,7 +17,7 @@ import org.wpilib.smartdashboard.SmartDashboard;
public class Robot extends TimedRobot {
double m_prevXAccel;
double m_prevYAccel;
OnboardIMU m_accelerometer = new OnboardIMU(MountOrientation.kFlat);
OnboardIMU m_accelerometer = new OnboardIMU(MountOrientation.FLAT);
@Override
public void robotPeriodic() {

View File

@@ -15,7 +15,7 @@ import org.wpilib.smartdashboard.SmartDashboard;
* https://docs.wpilib.org/en/stable/docs/software/hardware-apis/sensors/accelerometers-software.html
*/
public class Robot extends TimedRobot {
OnboardIMU m_accelerometer = new OnboardIMU(MountOrientation.kFlat);
OnboardIMU m_accelerometer = new OnboardIMU(MountOrientation.FLAT);
// Create a LinearFilter that will calculate a moving average of the measured X acceleration over
// the past 10 iterations of the main loop
LinearFilter m_xAccelFilter = LinearFilter.movingAverage(10);

View File

@@ -14,7 +14,7 @@ import org.wpilib.hardware.imu.OnboardIMU.MountOrientation;
*/
public class Robot extends TimedRobot {
// Creates an object for the on board IMU
OnboardIMU m_iMU = new OnboardIMU(MountOrientation.kFlat);
OnboardIMU m_iMU = new OnboardIMU(MountOrientation.FLAT);
/** Called once at the beginning of the robot program. */
public Robot() {}