A motor object that is associated with a physical motor port. More...
#include <motors.hpp>
Public Member Functions | |
Motor (const port_t &port) throw () | |
void | clearPositionCounter () |
void | moveAtVelocity (const short &velocity) |
void | moveToPosition (const short &speed, const int &goalPos) |
void | moveRelativePosition (const short &speed, const int &deltaPos) |
void | setPidGains (const short &p, const short &i, const short &d, const short &pd, const short &id, const short &dd) |
void | pidGains (short &p, short &i, short &d, short &pd, short &id, short &dd) const |
void | freeze () |
bool | isMotorDone () const |
void | blockMotorDone () const |
void | forward () |
void | backward () |
void | motor (int percent) |
void | off () |
const port_t & | port () const |
A motor object that is associated with a physical motor port.
Allows both PWM and PID control of a motor.
Motor::Motor | ( | const port_t & | port | ) | |
throw | ( | ||||
) |
Creates a new motor object associated with a given physical port.
port | the port this motor will communicate with. |
void Motor::backward | ( | ) |
void Motor::blockMotorDone | ( | ) | const |
Waits until the motor has reached its target position.
void Motor::clearPositionCounter | ( | ) |
void Motor::forward | ( | ) |
void Motor::freeze | ( | ) |
bool Motor::isMotorDone | ( | ) | const |
void Motor::motor | ( | int | percent | ) |
Move the motor at a given percentage of power using PWM control.
percent | The speed to move the motor at, in percentage. Should be between -100% and 100% |
void Motor::moveAtVelocity | ( | const short & | velocity | ) |
void Motor::moveRelativePosition | ( | const short & | speed, |
const int & | deltaPos | ||
) |
void Motor::moveToPosition | ( | const short & | speed, |
const int & | goalPos | ||
) |
void Motor::off | ( | ) |
Turns the motor off.
void Motor::pidGains | ( | short & | p, |
short & | i, | ||
short & | d, | ||
short & | pd, | ||
short & | id, | ||
short & | dd | ||
) | const |
const port_t& Motor::port | ( | ) | const |
The pyhsical port this motor is associated with.
void Motor::setPidGains | ( | const short & | p, |
const short & | i, | ||
const short & | d, | ||
const short & | pd, | ||
const short & | id, | ||
const short & | dd | ||
) |