Wyatt  1.0.1
Public Member Functions | List of all members
DriveMotorRPM Class Reference

#include <DriveMotorRPM.h>

Inheritance diagram for DriveMotorRPM:
Inheritance graph
[legend]
Collaboration diagram for DriveMotorRPM:
Collaboration graph
[legend]

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.
 

Detailed Description

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.

Constructor & Destructor Documentation

DriveMotorRPM::DriveMotorRPM ( Communicator comm,
Hardware  motorHardware,
EncoderSensor encoder,
int  desiredRPM,
int  direction 
)

Constructor.

Parameters
commA communicator object to dispatch motor messages to
motorHardwareThe hardware object associated with the motor.
encoderThe encoder sensor maintaining the most recent encoder readings
desiredRPMThe desired RPM
directionThe 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.

Member Function Documentation

bool DriveMotorRPM::cleanup ( bool  canceled)
overridevirtual

Cleanup. Currently does nothing.

Parameters
canceled
Returns
True

Implements Command.

Definition at line 51 of file DriveMotorRPM.cpp.

bool DriveMotorRPM::execute ( )
overridevirtual

This function gets periodically run by the CommandManger. PD control is executed. Always returns true, ensure that control is always executing.

Returns
True.

Implements Command.

Definition at line 22 of file DriveMotorRPM.cpp.


The documentation for this class was generated from the following files: