12 #include <llvm/raw_ostream.h> 13 #include <support/deprecated.h> 15 #include "ErrorBase.h" 16 #include "MotorSafety.h" 17 #include "MotorSafetyHelper.h" 45 RobotDrive(
int leftMotorChannel,
int rightMotorChannel);
46 RobotDrive(
int frontLeftMotorChannel,
int rearLeftMotorChannel,
47 int frontRightMotorChannel,
int rearRightMotorChannel);
50 RobotDrive(std::shared_ptr<SpeedController> leftMotor,
51 std::shared_ptr<SpeedController> rightMotor);
56 RobotDrive(std::shared_ptr<SpeedController> frontLeftMotor,
57 std::shared_ptr<SpeedController> rearLeftMotor,
58 std::shared_ptr<SpeedController> frontRightMotor,
59 std::shared_ptr<SpeedController> rearRightMotor);
60 virtual ~RobotDrive() =
default;
62 RobotDrive(
const RobotDrive&) =
delete;
63 RobotDrive& operator=(
const RobotDrive&) =
delete;
65 void Drive(
double outputMagnitude,
double curve);
67 bool squaredInputs =
true);
69 bool squaredInputs =
true);
71 int rightAxis,
bool squaredInputs =
true);
73 int rightAxis,
bool squaredInputs =
true);
74 void TankDrive(
double leftValue,
double rightValue,
75 bool squaredInputs =
true);
76 void ArcadeDrive(
GenericHID* stick,
bool squaredInputs =
true);
77 void ArcadeDrive(
GenericHID& stick,
bool squaredInputs =
true);
78 void ArcadeDrive(
GenericHID* moveStick,
int moveChannel,
80 bool squaredInputs =
true);
81 void ArcadeDrive(
GenericHID& moveStick,
int moveChannel,
83 bool squaredInputs =
true);
84 void ArcadeDrive(
double moveValue,
double rotateValue,
85 bool squaredInputs =
true);
86 void MecanumDrive_Cartesian(
double x,
double y,
double rotation,
87 double gyroAngle = 0.0);
88 void MecanumDrive_Polar(
double magnitude,
double direction,
double rotation);
89 void HolonomicDrive(
double magnitude,
double direction,
double rotation);
90 virtual void SetLeftRightMotorOutputs(
double leftOutput,
double rightOutput);
91 void SetInvertedMotor(MotorType motor,
bool isInverted);
92 void SetSensitivity(
double sensitivity);
93 void SetMaxOutput(
double maxOutput);
95 void SetExpiration(
double timeout)
override;
96 double GetExpiration()
const override;
97 bool IsAlive()
const override;
98 void StopMotor()
override;
99 bool IsSafetyEnabled()
const override;
100 void SetSafetyEnabled(
bool enabled)
override;
104 void InitRobotDrive();
105 double Limit(
double number);
106 void Normalize(
double* wheelSpeeds);
107 void RotateVector(
double& x,
double& y,
double angle);
109 static const int kMaxNumberOfMotors = 4;
110 double m_sensitivity = 0.5;
111 double m_maxOutput = 1.0;
112 std::shared_ptr<SpeedController> m_frontLeftMotor;
113 std::shared_ptr<SpeedController> m_frontRightMotor;
114 std::shared_ptr<SpeedController> m_rearLeftMotor;
115 std::shared_ptr<SpeedController> m_rearRightMotor;
116 std::unique_ptr<MotorSafetyHelper> m_safetyHelper;
121 if (m_frontLeftMotor) motors++;
122 if (m_frontRightMotor) motors++;
123 if (m_rearLeftMotor) motors++;
124 if (m_rearRightMotor) motors++;
Interface for speed controlling devices.
Definition: SpeedController.h:17
A class for driving differential drive/skid-steer drive platforms such as the Kit of Parts drive base...
Definition: DifferentialDrive.h:77
A class for driving Mecanum drive platforms.
Definition: MecanumDrive.h:40
Definition: MotorSafety.h:16
Base class for most objects.
Definition: ErrorBase.h:74
GenericHID Interface.
Definition: GenericHID.h:21
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:33