|
Resurgence (PY2022)
Codebase for the Husky Robotics 2021-2022 rover Resurgence
|
An abstract motor class. More...
#include <base_motor.h>


Public Member Functions | |
| base_motor (robot::types::motorid_t motor, bool hasPosSensor) | |
| Constructor for base motor. | |
| bool | hasPositionSensor () const |
| Returns the status of the motor position sensor. | |
| virtual void | setMotorPower (double power)=0 |
| Set the PWM command of the motor. | |
| virtual void | setMotorPos (int32_t targetPos)=0 |
| Set the target position of the motor. | |
| virtual types::DataPoint< int32_t > | getMotorPos () const =0 |
| Get the last reported position of the specified motor. | |
| virtual void | setMotorVel (int32_t targetVel) |
| Sets the velocity of the motor. | |
| virtual void | setServoPos (uint8_t servo, int32_t position)=0 |
| virtual void | setStepperTurnAngle (uint8_t stepper, int16_t angle)=0 |
| base_motor (const base_motor &)=delete | |
| Delete the copy constructor. | |
| base_motor & | operator= (const base_motor &)=delete |
| Delete the copy operator. | |
Protected Member Functions | |
| void | constructVelController () |
| Constructs a Jacobian Vel Controller. | |
| void | unscheduleVelocityEvent () |
| Unschedules the velocity event if it exists. | |
Protected Attributes | |
| robot::types::motorid_t | motor_id |
| bool | posSensor |
| std::optional< util::PeriodicScheduler< std::chrono::steady_clock >::eventid_t > | velEventID |
| std::optional< JacobianVelController< 1, 1 > > | velController |
Static Protected Attributes | |
| static std::optional< util::PeriodicScheduler< std::chrono::steady_clock > > | pSched |
| static std::mutex | schedulerMutex |
An abstract motor class.
| robot::base_motor::base_motor | ( | robot::types::motorid_t | motor, |
| bool | hasPosSensor ) |
Constructor for base motor.
| motor | The motor id to manipulate. |
| hasPosSensor | Boolean to indicate if the motor has a position sensor. |
|
delete |
Delete the copy constructor.
| base_motor | The motor to copy |
|
pure virtual |
Get the last reported position of the specified motor.
Implemented in robot::can_motor, and robot::sim_motor.
| bool robot::base_motor::hasPositionSensor | ( | ) | const |
Returns the status of the motor position sensor.
|
delete |
Delete the copy operator.
| base_motor | The motor to copy |
|
pure virtual |
Set the target position of the motor.
This will have no effect if the motor does not support PID.
| targetPos | The target position, in millidegrees. Refer to the specific motor for more information. |
Implemented in robot::can_motor, and robot::sim_motor.
|
pure virtual |
Set the PWM command of the motor.
| power | The power command, in the range [-1, 1] |
Implemented in robot::can_motor, and robot::sim_motor.
|
virtual |
Sets the velocity of the motor.
| targetVel | The target velocity, in millidegrees per second. |
Reimplemented in robot::can_motor.