mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-28 02:11:43 +00:00
[wpilib] Rename MotorType constants to all caps
This commit is contained in:
@@ -113,19 +113,21 @@ MecanumDrive::WheelVelocities MecanumDrive::DriveCartesianIK(
|
||||
.RotateBy(-gyroAngle);
|
||||
|
||||
double wheelVelocities[4];
|
||||
wheelVelocities[kFrontLeft] =
|
||||
wheelVelocities[static_cast<int>(MotorType::FRONT_LEFT)] =
|
||||
input.X().value() + input.Y().value() + zRotation;
|
||||
wheelVelocities[kFrontRight] =
|
||||
wheelVelocities[static_cast<int>(MotorType::FRONT_RIGHT)] =
|
||||
input.X().value() - input.Y().value() - zRotation;
|
||||
wheelVelocities[kRearLeft] =
|
||||
wheelVelocities[static_cast<int>(MotorType::REAR_LEFT)] =
|
||||
input.X().value() - input.Y().value() + zRotation;
|
||||
wheelVelocities[kRearRight] =
|
||||
wheelVelocities[static_cast<int>(MotorType::REAR_RIGHT)] =
|
||||
input.X().value() + input.Y().value() - zRotation;
|
||||
|
||||
Desaturate(wheelVelocities);
|
||||
|
||||
return {wheelVelocities[kFrontLeft], wheelVelocities[kFrontRight],
|
||||
wheelVelocities[kRearLeft], wheelVelocities[kRearRight]};
|
||||
return {wheelVelocities[static_cast<int>(MotorType::FRONT_LEFT)],
|
||||
wheelVelocities[static_cast<int>(MotorType::FRONT_RIGHT)],
|
||||
wheelVelocities[static_cast<int>(MotorType::REAR_LEFT)],
|
||||
wheelVelocities[static_cast<int>(MotorType::REAR_RIGHT)]};
|
||||
}
|
||||
|
||||
std::string MecanumDrive::GetDescription() const {
|
||||
|
||||
@@ -22,21 +22,21 @@ class RobotDriveBase : public MotorSafety {
|
||||
/**
|
||||
* The location of a motor on the robot for the purpose of driving.
|
||||
*/
|
||||
enum MotorType {
|
||||
enum class MotorType {
|
||||
/// Front-left motor.
|
||||
kFrontLeft = 0,
|
||||
FRONT_LEFT = 0,
|
||||
/// Front-right motor.
|
||||
kFrontRight = 1,
|
||||
FRONT_RIGHT = 1,
|
||||
/// Rear-left motor.
|
||||
kRearLeft = 2,
|
||||
REAR_LEFT = 2,
|
||||
/// Rear-right motor.
|
||||
kRearRight = 3,
|
||||
REAR_RIGHT = 3,
|
||||
/// Left motor.
|
||||
kLeft = 0,
|
||||
LEFT = 0,
|
||||
/// Right motor.
|
||||
kRight = 1,
|
||||
RIGHT = 1,
|
||||
/// Back motor.
|
||||
kBack = 2
|
||||
BACK = 2
|
||||
};
|
||||
|
||||
RobotDriveBase();
|
||||
|
||||
Reference in New Issue
Block a user