trikRuntime
|
Abstract motor. It is differently implemented by different motor types (like servo and power motors). More...
#include <motorInterface.h>
Public Types | |
enum | Type { Type::powerMotor, Type::servoMotor } |
Public Types inherited from trikControl::DeviceInterface | |
enum | Status { Status::permanentFailure, Status::temporaryFailure, Status::off, Status::starting, Status::ready, Status::stopping } |
Device status. More... | |
Public Slots | |
virtual void | setPower (int power, bool constrain=true)=0 |
Sets current motor power to specified value, 0 to stop motor. More... | |
virtual int | power () const =0 |
Returns currently set power of a motor. More... | |
virtual void | powerOff ()=0 |
Turns off motor. More... | |
virtual void | brake (int durationMs=500)=0 |
Force brake state for durationMs and then powerOff() More... | |
virtual void | setPeriod (int uSec=20000)=0 |
Set period for PWM generator. More... | |
Public Member Functions | |
virtual int | minControl () const =0 |
Returns minimal value of control accepted by a motor (-90..90, 0..100, for example). More... | |
virtual int | maxControl () const =0 |
Returns maximal value of control accepted by a motor (-90..90, 0..100, for example). More... | |
Public Member Functions inherited from trikControl::DeviceInterface | |
DeviceInterface ()=default | |
virtual | ~DeviceInterface ()=default |
virtual Status | status () const =0 |
Returns current status of the device. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from trikControl::DeviceInterface | |
static Status | combine (const DeviceInterface &underlying, const DeviceInterface::Status &dependent) |
Helper method to return status of a device relying on other device to work. More... | |
Abstract motor. It is differently implemented by different motor types (like servo and power motors).
|
strong |
|
pure virtualslot |
Force brake state for durationMs and then powerOff()
|
pure virtual |
Returns maximal value of control accepted by a motor (-90..90, 0..100, for example).
Implemented in trikControl::ServoMotor, and trikControl::PowerMotor.
|
pure virtual |
Returns minimal value of control accepted by a motor (-90..90, 0..100, for example).
Implemented in trikControl::ServoMotor, and trikControl::PowerMotor.
|
pure virtualslot |
Returns currently set power of a motor.
|
pure virtualslot |
Turns off motor.
This is not the same as setPower(0), because setPower can leave motor on in a break mode, and this method will turn motor off.
|
pure virtualslot |
Set period for PWM generator.
uSec | - microseconds |
|
pure virtualslot |
Sets current motor power to specified value, 0 to stop motor.
power | - power of a motor, from -100 (full reverse) to 100 (full forward), 0 — break. |
constrain | - if true, power will be constrained in an interval [-100, 100], if false, "power" value will be sent to a motor unaltered. |