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

Represents a single MotorArray. More...

#include <MotorArray.h>

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

Public Member Functions

 MotorArray ()
 
virtual ~MotorArray ()
 
void setComId (const ComId &id)
 
void setSpeedSetPoints (const float *speeds, unsigned int size)
 
void actualVelocities (float *readings) const
 
void actualPositions (int *readings) const
 
void motorCurrents (float *readings) const
 
virtual void velocitiesChangedEvent (const float *velocities, unsigned int size)
 
virtual void positionsChangedEvent (const int *positions, unsigned int size)
 
virtual void currentsChangedEvent (const float *currents, unsigned int size)
 
- 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 MotorArrayImpl
 

Additional Inherited Members

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

Detailed Description

Represents a single MotorArray.

Constructor & Destructor Documentation

rec::robotino::api2::MotorArray::MotorArray ( )

Constructs a MotorArray instance.

virtual rec::robotino::api2::MotorArray::~MotorArray ( )
virtual

Destructor

Member Function Documentation

void rec::robotino::api2::MotorArray::actualPositions ( int *  readings) const

Retrieves the actual position of this MotorArray.

Example:

std::vector<float> vec( numMotors() );
actualPositions( &vec[0] );
for( int i=0; i<vec.size(); ++i )
{
std::cout << "actual position[" << i << "]: " << vec[i] << std::endl;
}
Parameters
[out]readingsPass an array of size numMotors() to store actual positions of all motors
Exceptions
RobotinoExceptionif the current communication object is invalid.
Remarks
This function is thread safe
void rec::robotino::api2::MotorArray::actualVelocities ( float *  readings) const

Retrieves the actual velocities of this MotorArray.

Example:

std::vector<float> vec( numMotors() );
actualVelocities( &vec[0] );
for( int i=0; i<vec.size(); ++i )
{
std::cout << "actual velocity[" << i << "]: " << vec[i] << " rpm" << std::endl;
}
Parameters
[out]readingsPass an array of size numMotors() to store velocities of all motors in rpm.
Exceptions
RobotinoExceptionif the current communication object is invalid.
Remarks
This function is thread safe
virtual void rec::robotino::api2::MotorArray::currentsChangedEvent ( const float *  currents,
unsigned int  size 
)
virtual

Called when new currents are available.

Remarks
This function is called from the thread in which Com::processEvents() is called.
See also
Com::processEvents
void rec::robotino::api2::MotorArray::motorCurrents ( float *  readings) const

Retrieves the current of this MotorArray.

Example:

std::vector<float> vec( numMotors() );
motorCurrents( &vec[0] );
for( int i=0; i<vec.size(); ++i )
{
std::cout << "motor current[" << i << "]: " << vec[i] << " A" << std::endl;
}
Parameters
[out]readingsPass an array of size numMotors() to store currents of all motors in A
Exceptions
RobotinoExceptionif the current communication object is invalid.
Remarks
This function is thread safe
static unsigned int rec::robotino::api2::MotorArray::numMotors ( )
static
Returns
Returns the number of drive MotorArrays on Robotino
Exceptions
nothing
Remarks
This function is thread safe
virtual void rec::robotino::api2::MotorArray::positionsChangedEvent ( const int *  positions,
unsigned int  size 
)
virtual

Called when new positions are available.

Remarks
This function is called from the thread in which Com::processEvents() is called.
See also
Com::processEvents
void rec::robotino::api2::MotorArray::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 safe
void rec::robotino::api2::MotorArray::setSpeedSetPoints ( const float *  speeds,
unsigned int  size 
)

Sets the setpoint speed of this MotorArray.

Parameters
speedsArray of set point speed in rpm for all motors.
sizeSize of speeds array.
Exceptions
RobotinoExceptionif the current communication object is invalid.
Remarks
This function is thread safe
virtual void rec::robotino::api2::MotorArray::velocitiesChangedEvent ( const float *  velocities,
unsigned int  size 
)
virtual

Called when new velocities are available.

Remarks
This function is called from the thread in which Com::processEvents() is called.
See also
Com::processEvents

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