12 #include <wpi/deprecated.h>
13 #include <wpi/raw_ostream.h>
15 #include "frc/ErrorBase.h"
16 #include "frc/MotorSafety.h"
20 class SpeedController;
55 WPI_DEPRECATED(
"Use DifferentialDrive or MecanumDrive classes instead.")
56 RobotDrive(
int leftMotorChannel,
int rightMotorChannel);
74 WPI_DEPRECATED(
"Use DifferentialDrive or MecanumDrive classes instead.")
75 RobotDrive(
int frontLeftMotorChannel,
int rearLeftMotorChannel,
76 int frontRightMotorChannel,
int rearRightMotorChannel);
90 WPI_DEPRECATED(
"Use DifferentialDrive or MecanumDrive classes instead.")
93 WPI_DEPRECATED(
"Use DifferentialDrive or MecanumDrive classes instead.")
96 WPI_DEPRECATED(
"Use DifferentialDrive or MecanumDrive classes instead.")
97 RobotDrive(std::shared_ptr<SpeedController> leftMotor,
98 std::shared_ptr<SpeedController> rightMotor);
115 WPI_DEPRECATED(
"Use DifferentialDrive or MecanumDrive classes instead.")
119 WPI_DEPRECATED(
"Use DifferentialDrive or MecanumDrive classes instead.")
123 WPI_DEPRECATED(
"Use DifferentialDrive or MecanumDrive classes instead.")
124 RobotDrive(std::shared_ptr<SpeedController> frontLeftMotor,
125 std::shared_ptr<SpeedController> rearLeftMotor,
126 std::shared_ptr<SpeedController> frontRightMotor,
127 std::shared_ptr<SpeedController> rearRightMotor);
157 void Drive(
double outputMagnitude,
double curve);
171 bool squaredInputs =
true);
185 bool squaredInputs =
true);
203 int rightAxis,
bool squaredInputs =
true);
206 int rightAxis,
bool squaredInputs =
true);
218 void TankDrive(
double leftValue,
double rightValue,
219 bool squaredInputs =
true);
269 bool squaredInputs =
true);
289 bool squaredInputs =
true);
300 void ArcadeDrive(
double moveValue,
double rotateValue,
301 bool squaredInputs =
true);
325 double gyroAngle = 0.0);
358 void HolonomicDrive(
double magnitude,
double direction,
double rotation);
382 void SetInvertedMotor(MotorType motor,
bool isInverted);
403 void StopMotor()
override;
419 double Limit(
double number);
432 static constexpr
int kMaxNumberOfMotors = 4;
434 double m_sensitivity = 0.5;
435 double m_maxOutput = 1.0;
437 std::shared_ptr<SpeedController> m_frontLeftMotor;
438 std::shared_ptr<SpeedController> m_frontRightMotor;
439 std::shared_ptr<SpeedController> m_rearLeftMotor;
440 std::shared_ptr<SpeedController> m_rearRightMotor;
445 if (m_frontLeftMotor) motors++;
446 if (m_frontRightMotor) motors++;
447 if (m_rearLeftMotor) motors++;
448 if (m_rearRightMotor) motors++;
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:45
Interface for speed controlling devices.
Definition: SpeedController.h:17
WPILib FRC namespace.
Definition: SPIAccelerometerSim.h:18
Utility class for handling Robot drive based on a definition of the motor configuration.
Definition: RobotDrive.h:34
double Limit(double number)
Limit motor values to the -1.0 to +1.0 range.
void ArcadeDrive(GenericHID *stick, bool squaredInputs=true)
Arcade drive implements single stick driving.
void InitRobotDrive()
Common function to initialize all the robot drive constructors.
void RotateVector(double &x, double &y, double angle)
Rotate a vector in Cartesian space.
void MecanumDrive_Polar(double magnitude, double direction, double rotation)
Drive method for Mecanum wheeled robots.
This base class runs a watchdog timer and calls the subclass's StopMotor() function if the timeout ex...
Definition: MotorSafety.h:26
void SetSensitivity(double sensitivity)
Set the turning sensitivity.
virtual void SetLeftRightMotorOutputs(double leftOutput, double rightOutput)
Set the speed of the right and left motors.
void HolonomicDrive(double magnitude, double direction, double rotation)
Holonomic Drive method for Mecanum wheeled robots.
void TankDrive(GenericHID *leftStick, GenericHID *rightStick, bool squaredInputs=true)
Provide tank steering using the stored robot configuration.
void Drive(double outputMagnitude, double curve)
Drive the motors at "outputMagnitude" and "curve".
GenericHID Interface.
Definition: GenericHID.h:23
void SetMaxOutput(double maxOutput)
Configure the scaling factor for using RobotDrive with motor controllers in a mode other than Percent...
RobotDrive(int leftMotorChannel, int rightMotorChannel)
Constructor for RobotDrive with 2 motors specified with channel numbers.
void Normalize(double *wheelSpeeds)
Normalize all wheel speeds if the magnitude of any wheel is greater than 1.0.
void MecanumDrive_Cartesian(double x, double y, double rotation, double gyroAngle=0.0)
Drive method for Mecanum wheeled robots.