rec::robotino::api2 C++ interface
Public Member Functions | Static Public Member Functions | Friends | List of all members
rec::robotino::api2::Motor Class Reference

Represents a single motor. More...

#include <Motor.h>

Inheritance diagram for rec::robotino::api2::Motor:
rec::robotino::api2::ComObject

Public Member Functions

void setComId (const ComId &id)
 
void setMotorNumber (unsigned int number)
 
void setSpeedSetPoint (float speed)
 
void resetPosition (int position)
 
void setBrake (bool brake)
 
void setPID (float kp, float ki, float kd)
 
float actualVelocity () const
 
int actualPosition () const
 
float motorCurrent () const
 
virtual void motorReadingsChanged (float velocity, int position, float current)
 
- Public Member Functions inherited from rec::robotino::api2::ComObject
 ComObject ()
 
virtual ~ComObject ()
 
ComId comId () const
 

Static Public Member Functions

static unsigned int numMotors ()
 

Friends

class MotorImpl
 

Additional Inherited Members

- Protected Attributes inherited from rec::robotino::api2::ComObject
ComId _comID
 

Detailed Description

Represents a single motor.

Member Function Documentation

int rec::robotino::api2::Motor::actualPosition ( ) const

Retrieves the actual position of this motor.

Returns
actual position
Exceptions
RobotinoExceptionif the current communication object is invalid.
Remarks
This function is thread save
float rec::robotino::api2::Motor::actualVelocity ( ) const

Retrieves the actual speed of this motor.

Returns
Speed in rpm.
Exceptions
RobotinoExceptionif the current communication object is invalid.
Remarks
This function is thread save
float rec::robotino::api2::Motor::motorCurrent ( ) const

Retrieves the current of this motor.

Returns
motor current in A.
Exceptions
RobotinoExceptionif the current communication object is invalid.
Remarks
This function is thread save
virtual void rec::robotino::api2::Motor::motorReadingsChanged ( float  velocity,
int  position,
float  current 
)
virtual

Called when new readings are available.

Remarks
This function is called from the thread in which Com::processEvents() is called.
See also
Com::processEvents
static unsigned int rec::robotino::api2::Motor::numMotors ( )
static
Returns
Returns the number of drive motors on Robotino
Exceptions
nothing
Remarks
This function is thread save
void rec::robotino::api2::Motor::resetPosition ( int  position)

Resets the position of this motor.

Parameters
positionNew position after reset.
Exceptions
RobotinoExceptionif the current communication object is invalid.
Remarks
This function is thread save
void rec::robotino::api2::Motor::setBrake ( bool  brake)

Controls the brakes of this motor.

Parameters
brakeIf set to TRUE, the speed set-point is constantly set to 0. If set to FALSE, the speed set-point can be set by setSpeedSetPoint.
Exceptions
RobotinoExceptionif the current communication object is invalid.
Remarks
This function is thread save
void rec::robotino::api2::Motor::setComId ( const ComId id)

Sets the associated communication object.

Parameters
idThe id of the associated communication object.
Exceptions
RobotinoExceptionif given id is invalid.
Remarks
This function is thread save
void rec::robotino::api2::Motor::setMotorNumber ( unsigned int  number)

Sets the number of this motor.

Parameters
numbernumber of this motor
Exceptions
RobotinoExceptionif the current communication object is invalid.
Remarks
This function is thread save
void rec::robotino::api2::Motor::setPID ( float  kp,
float  ki,
float  kd 
)

Sets the proportional, integral and differential constant of the PID controller. Robotino v2 The range of values is from 0 to 255. These values are scaled by the microcontroller firmware to match with the PID controller implementation. If value is given, the microcontroller firmware uses its build in default value.

Robotino v3 Parameters are floating point values used by the microcontroller directly. If parameter is less than 0 the default parameter is used.

Parameters
kpproportional constant. Typical value for Robotino v2 is 200. Typical value for Robotino v3 is 0.1.
kiintegral constant. Typical value for Robotino v2 is 10. Typical value for Robotino v3 is 0.005.
kddifferential constant. Typical value 0. Not used by Robotino v3.
Exceptions
RobotinoExceptionif the current communication object is invalid.
Remarks
This function is thread save
void rec::robotino::api2::Motor::setSpeedSetPoint ( float  speed)

Sets the setpoint speed of this motor.

Parameters
speedSet point speed in rpm.
Exceptions
RobotinoExceptionif the current communication object is invalid.
Remarks
This function is thread save

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