40 Vehicle(
const unsigned int numberOfMotors,
const unsigned int* motorPinNumbers =
nullptr,
MotorAlignment* motorAlignments =
nullptr);
65 virtual void TurnOn()
override;
77 virtual void TurnOff()
override;
103 virtual std::string
ToString()
const override;
Abstract base class for every component (sensor, actuator, etc.) the library manages.
Definition: BaseComponent.h:60
A DC motor driven through an H-bridge, with an optional enable pin and a wheel alignment used when st...
Definition: Motor.h:27
A vehicle composed of several Motors, providing drive and steering by coordinating the motors it owns...
Definition: Vehicle.h:15
virtual void ProcessRawValues() override
No-op: a vehicle is an output device with no raw values to process.
Definition: Vehicle.cpp:144
void TurnLeft()
Steers the vehicle left: left-aligned motors reverse and right-aligned motors drive forward.
Definition: Vehicle.cpp:198
Motor * GetMotor(int index) const
Gets the motor at the given index, or nullptr if the index is out of range.
Definition: Vehicle.cpp:264
void TurnOnMotors()
Turns on every motor the vehicle owns.
Definition: Vehicle.cpp:108
void MoveBackward()
Drives every motor backward, enabling them first.
Definition: Vehicle.cpp:178
void MoveForward()
Drives every motor forward, enabling them first.
Definition: Vehicle.cpp:158
virtual void TurnOn() override
Turns the vehicle on by turning on all its motors.
Definition: Vehicle.cpp:78
Vehicle & operator=(const Vehicle &)=delete
void TurnRight()
Steers the vehicle right: left-aligned motors drive forward and right-aligned motors reverse.
Definition: Vehicle.cpp:229
virtual std::string ToString() const override
Serializes every motor's description into one string.
Definition: Vehicle.cpp:288
Vehicle(const Vehicle &)=delete
void TurnOffMotors()
Turns off every motor the vehicle owns.
Definition: Vehicle.cpp:126
virtual void TurnOff() override
Turns the vehicle off by turning off all its motors.
Definition: Vehicle.cpp:93
std::vector< Motor * > myMotors
The motors this vehicle owns and drives.
Definition: Vehicle.h:22
virtual ~Vehicle()
Destroys the vehicle, turning it off and deleting the motors it owns.
Definition: Vehicle.cpp:57
RumPi is the library's top-level facade.
Definition: AlertManager.h:6
MotorAlignment
Helps determine direction to rotate a motor if/when turning a Vehicle.
Definition: Motor.h:13