trikRuntime
trikControl::ServoMotor Class Reference

TRIK servomotor. More...

#include <servoMotor.h>

Inheritance diagram for trikControl::ServoMotor:
Collaboration diagram for trikControl::ServoMotor:

Public Slots

int power () const override
 
int frequency () const
 Returns currently set frequency of PWM signal supplied to the motor. More...
 
int duty () const
 Returns currently set duty of PWM signal supplied to the motor. More...
 
void powerOff () override
 
void setPower (int power, bool constrain=true) override
 For angular servos sets current motor angle to specified value. More...
 
void brake (int=0) override
 
void setPeriod (int uSec=20000) override
 
- 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

 ServoMotor (const QString &port, const trikKernel::Configurer &configurer, const trikHal::HardwareAbstractionInterface &hardwareAbstraction)
 Constructor. More...
 
 ~ServoMotor () 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 servomotor.

Constructor & Destructor Documentation

ServoMotor::ServoMotor ( const QString &  port,
const trikKernel::Configurer configurer,
const trikHal::HardwareAbstractionInterface hardwareAbstraction 
)

Constructor.

Parameters
port- port on which this motor is configured.
configurer- configurer object containing preparsed XML files with motor parameters.
ServoMotor::~ServoMotor ( )
override

Member Function Documentation

void trikControl::ServoMotor::brake ( int  = 0)
inlineoverrideslot

Makes no sense, neither for angular servo nor for rotational

int ServoMotor::duty ( ) const
slot

Returns currently set duty of PWM signal supplied to the motor.

int ServoMotor::frequency ( ) const
slot

Returns currently set frequency of PWM signal supplied to the motor.

int ServoMotor::maxControl ( ) const
overridevirtual

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

Implements trikControl::MotorInterface.

int ServoMotor::minControl ( ) const
overridevirtual

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

Implements trikControl::MotorInterface.

int ServoMotor::power ( ) const
overrideslot
void ServoMotor::powerOff ( )
overrideslot
void ServoMotor::setPeriod ( int  uSec = 20000)
overrideslot
void ServoMotor::setPower ( int  power,
bool  constrain = true 
)
overrideslot

For angular servos sets current motor angle to specified value.

For continious rotation servos sets power of a motor.

Parameters
power- for angular servos — servo shaft angle, allowed values are from -90 to 90, for continious rotation servos — power, allowed values are from -100 to 100.
constrain- if true, power will be constrained in an interval [-100, 100], if false, "power" value will be sent to a motor unaltered.
ServoMotor::Status ServoMotor::status ( ) const
overridevirtual

Returns current status of the device.

Implements trikControl::DeviceInterface.


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