trikRuntime
trikControl::PowerMotor Class Reference

TRIK power motor. More...

#include <powerMotor.h>

Inheritance diagram for trikControl::PowerMotor:
Collaboration diagram for trikControl::PowerMotor:

Public Slots

void setPower (int power, bool constrain=true) override
 
int power () const override
 
void powerOff () override
 
int period () const
 Returns currently set period of a motor. More...
 
void setPeriod (int period) override
 Sets current motor period. More...
 
void brake (int durationMs=500) override
 Force brake for a short period of time followed by power off. More...
 
- Public Slots inherited from trikControl::MotorInterface
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

 PowerMotor (const QString &port, const trikKernel::Configurer &configurer, MspCommunicatorInterface &communicator)
 Constructor. More...
 
 ~PowerMotor () override
 
Status status () const override
 Returns current status of the device. More...
 
int minControl () const override
 Returns minimal value of control accepted by a motor (-90..90, 0..100, for example). More...
 
int maxControl () const override
 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
 

Additional Inherited Members

- Public Types inherited from trikControl::MotorInterface
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...
 
- 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...
 

Detailed Description

TRIK power motor.

Constructor & Destructor Documentation

PowerMotor::PowerMotor ( const QString &  port,
const trikKernel::Configurer configurer,
MspCommunicatorInterface communicator 
)

Constructor.

Parameters
port- port on which this motor is configured.
configurer- configurer object containing preparsed XML files with motor parameters.
communicator- I2C communicator to use to query sensor.
PowerMotor::~PowerMotor ( )
override

Member Function Documentation

void PowerMotor::brake ( int  durationMs = 500)
overrideslot

Force brake for a short period of time followed by power off.

int PowerMotor::maxControl ( ) const
overridevirtual

Returns maximal value of control accepted by a motor (-90..90, 0..100, for example).

Implements trikControl::MotorInterface.

int PowerMotor::minControl ( ) const
overridevirtual

Returns minimal value of control accepted by a motor (-90..90, 0..100, for example).

Implements trikControl::MotorInterface.

int PowerMotor::period ( ) const
slot

Returns currently set period of a motor.

int PowerMotor::power ( ) const
overrideslot
void PowerMotor::powerOff ( )
overrideslot
void PowerMotor::setPeriod ( int  period)
overrideslot

Sets current motor period.

Period of pulses is a time interval between two characteristic points of two adjacent pulses.

void PowerMotor::setPower ( int  power,
bool  constrain = true 
)
overrideslot
PowerMotor::Status PowerMotor::status ( ) const
overridevirtual

Returns current status of the device.

Implements trikControl::DeviceInterface.


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