|
libstp
Robotics library for Botball
|
Interface for motor abstraction. More...
#include <IMotor.hpp>
Public Member Functions | |
| virtual | ~IMotor ()=default |
| virtual void | setSpeed (int percent)=0 |
| Open-loop percent output. | |
| virtual void | setVelocity (int velocity)=0 |
| Set a velocity target in firmware-specific BEMF units. | |
| virtual void | moveToPosition (int velocity, int goalPosition)=0 |
| Move to an absolute position using firmware-side control. | |
| virtual void | moveRelative (int velocity, int deltaPosition)=0 |
| Move by a relative position delta using firmware-side control. | |
| virtual int | getPosition () const =0 |
| virtual int | getBemf () const =0 |
| virtual bool | isDone () const =0 |
| virtual void | brake ()=0 |
| Stop this motor using the implementation's preferred strategy. | |
| virtual void | off ()=0 |
| Disable this motor completely (no power, no brake — free-spinning). | |
| virtual void | resetPositionCounter ()=0 |
| Reset the position counter to zero. | |
| virtual const foundation::MotorCalibration & | getCalibration () const =0 |
| virtual void | setCalibration (const foundation::MotorCalibration &calibration)=0 |
| virtual int | getPort () const =0 |
| virtual bool | isInverted () const =0 |
| virtual void | setFirmwarePidGains (float kp, float ki, float kd) |
| Push per-motor firmware-side velocity PID gains to the driver. | |
| virtual void | getLastFirmwarePidGains (float &kp, float &ki, float &kd) const |
| Read back the gains last passed to setFirmwarePidGains(). | |
Interface for motor abstraction.
This interface allows for mocking motors in unit tests and enables dependency injection in kinematics classes.
Definition at line 16 of file IMotor.hpp.
|
virtualdefault |
|
pure virtual |
Stop this motor using the implementation's preferred strategy.
Implemented in libstp::hal::motor::Motor.
|
nodiscardpure virtual |
Implemented in libstp::hal::motor::Motor.
|
nodiscardpure virtual |
Implemented in libstp::hal::motor::Motor.
|
inlinevirtual |
Read back the gains last passed to setFirmwarePidGains().
Default no-op (returns zeros) so platforms that don't store the gains keep compiling unchanged. Override in concrete platforms (wombat, mock) to expose the cached value — primarily useful in tuner/test code that needs to revert to a previous gain set.
Reimplemented in libstp::hal::motor::Motor.
Definition at line 66 of file IMotor.hpp.
|
nodiscardpure virtual |
Implemented in libstp::hal::motor::Motor.
|
nodiscardpure virtual |
Implemented in libstp::hal::motor::Motor.
|
nodiscardpure virtual |
Implemented in libstp::hal::motor::Motor.
|
nodiscardpure virtual |
Implemented in libstp::hal::motor::Motor.
|
pure virtual |
Move by a relative position delta using firmware-side control.
Implemented in libstp::hal::motor::Motor.
|
pure virtual |
Move to an absolute position using firmware-side control.
Implemented in libstp::hal::motor::Motor.
|
pure virtual |
Disable this motor completely (no power, no brake — free-spinning).
Implemented in libstp::hal::motor::Motor.
|
pure virtual |
Reset the position counter to zero.
Implemented in libstp::hal::motor::Motor.
|
pure virtual |
Implemented in libstp::hal::motor::Motor.
|
inlinevirtual |
Push per-motor firmware-side velocity PID gains to the driver.
Default no-op so platforms that don't expose a per-motor firmware PID channel keep compiling unchanged. The wombat platform forwards to TransportWriter::setMotorPid(); the mock platform stores the gains for test introspection.
Reimplemented in libstp::hal::motor::Motor.
Definition at line 51 of file IMotor.hpp.
|
pure virtual |
Open-loop percent output.
Implemented in libstp::hal::motor::Motor.
|
pure virtual |
Set a velocity target in firmware-specific BEMF units.
Implemented in libstp::hal::motor::Motor.