Wyatt
1.0.1
|
#include <DriveMotorRPM.h>
Public Member Functions | |
DriveMotorRPM (Communicator *comm, Hardware motorHardware, EncoderSensor *encoder, int desiredRPM, int direction) | |
~DriveMotorRPM () | |
bool | execute () override |
bool | cleanup (bool canceled) override |
Public Member Functions inherited from Command | |
Command () | |
virtual | ~Command () |
void | init () |
void | cancel () |
void | stop () |
bool | isRunning () |
bool | isInitialized () |
void | setIsRunning (bool value) |
bool | isFinished () |
Additional Inherited Members | |
Protected Attributes inherited from Command | |
std::mutex | m_lock |
Lock for managing access to member variables in a thread-safe manner. | |
Command object used to drive a motor at a specified RPM. Uses a PD controller to maintain speed.
Definition at line 17 of file DriveMotorRPM.h.
DriveMotorRPM::DriveMotorRPM | ( | Communicator * | comm, |
Hardware | motorHardware, | ||
EncoderSensor * | encoder, | ||
int | desiredRPM, | ||
int | direction | ||
) |
Constructor.
comm | A communicator object to dispatch motor messages to |
motorHardware | The hardware object associated with the motor. |
encoder | The encoder sensor maintaining the most recent encoder readings |
desiredRPM | The desired RPM |
direction | The direction to drive the motor. Specified in DriveConstants. FORWARD=1, BACKWARD=-1 |
Definition at line 9 of file DriveMotorRPM.cpp.
DriveMotorRPM::~DriveMotorRPM | ( | ) |
Destructor
Definition at line 18 of file DriveMotorRPM.cpp.
|
overridevirtual |
Cleanup. Currently does nothing.
canceled |
Implements Command.
Definition at line 51 of file DriveMotorRPM.cpp.
|
overridevirtual |
This function gets periodically run by the CommandManger. PD control is executed. Always returns true, ensure that control is always executing.
Implements Command.
Definition at line 22 of file DriveMotorRPM.cpp.