YARP
Yet Another Robot Platform
yarp::dev::ImplementPositionControl Class Reference

Default implementation of the IPositionControl interface. More...

#include <yarp/dev/ImplementPositionControl.h>

+ Inheritance diagram for yarp::dev::ImplementPositionControl:

Public Member Functions

 ImplementPositionControl (yarp::dev::IPositionControlRaw *y)
 Constructor. More...
 
virtual ~ImplementPositionControl ()
 Destructor. More...
 
bool getAxes (int *axis) override
 Get the number of controlled axes. More...
 
bool positionMove (int j, double ref) override
 Set new reference point for a single axis. More...
 
bool positionMove (const int n_joint, const int *joints, const double *refs) override
 Set new reference point for a subset of joints. More...
 
bool positionMove (const double *refs) override
 Set new reference point for all axes. More...
 
bool relativeMove (int j, double delta) override
 Set relative position. More...
 
bool relativeMove (const int n_joint, const int *joints, const double *deltas) override
 Set relative position for a subset of joints. More...
 
bool relativeMove (const double *deltas) override
 Set relative position, all joints. More...
 
bool checkMotionDone (bool *flag) override
 Check if the current trajectory is terminated. More...
 
bool checkMotionDone (const int n_joint, const int *joints, bool *flags) override
 Check if the current trajectory is terminated. More...
 
bool checkMotionDone (int j, bool *flag) override
 Check if the current trajectory is terminated. More...
 
bool setRefSpeed (int j, double sp) override
 Set reference speed for a joint, this is the speed used during the interpolation of the trajectory. More...
 
bool setRefSpeeds (const int n_joint, const int *joints, const double *spds) override
 Set reference speed on all joints. More...
 
bool setRefSpeeds (const double *spds) override
 Set reference speed on all joints. More...
 
bool setRefAcceleration (int j, double acc) override
 Set reference acceleration for a joint. More...
 
bool setRefAccelerations (const int n_joint, const int *joints, const double *accs) override
 Set reference acceleration on all joints. More...
 
bool setRefAccelerations (const double *accs) override
 Set reference acceleration on all joints. More...
 
bool getRefSpeed (int j, double *ref) override
 Get reference speed for a joint. More...
 
bool getRefSpeeds (const int n_joint, const int *joints, double *spds) override
 Get reference speed of all joints. More...
 
bool getRefSpeeds (double *spds) override
 Get reference speed of all joints. More...
 
bool getRefAcceleration (int j, double *acc) override
 Get reference acceleration for a joint. More...
 
bool getRefAccelerations (const int n_joint, const int *joints, double *accs) override
 Get reference acceleration for a joint. More...
 
bool getRefAccelerations (double *accs) override
 Get reference acceleration of all joints. More...
 
bool stop (int j) override
 Stop motion, single joint. More...
 
bool stop (const int n_joint, const int *joints) override
 Stop motion for subset of joints. More...
 
bool stop () override
 Stop motion, multiple joints. More...
 
bool getTargetPosition (const int joint, double *ref) override
 Get the last position reference for the specified axis. More...
 
bool getTargetPositions (double *refs) override
 Get the last position reference for all axes. More...
 
bool getTargetPositions (const int n_joint, const int *joints, double *refs) override
 Get the last position reference for the specified group of axes. More...
 
- Public Member Functions inherited from yarp::dev::IPositionControl
virtual ~IPositionControl ()
 Destructor. More...
 
virtual bool getAxes (int *ax)=0
 Get the number of controlled axes. More...
 
virtual bool positionMove (int j, double ref)=0
 Set new reference point for a single axis. More...
 
virtual bool positionMove (const double *refs)=0
 Set new reference point for all axes. More...
 
virtual bool relativeMove (int j, double delta)=0
 Set relative position. More...
 
virtual bool relativeMove (const double *deltas)=0
 Set relative position, all joints. More...
 
virtual bool checkMotionDone (int j, bool *flag)=0
 Check if the current trajectory is terminated. More...
 
virtual bool checkMotionDone (bool *flag)=0
 Check if the current trajectory is terminated. More...
 
virtual bool setRefSpeed (int j, double sp)=0
 Set reference speed for a joint, this is the speed used during the interpolation of the trajectory. More...
 
virtual bool setRefSpeeds (const double *spds)=0
 Set reference speed on all joints. More...
 
virtual bool setRefAcceleration (int j, double acc)=0
 Set reference acceleration for a joint. More...
 
virtual bool setRefAccelerations (const double *accs)=0
 Set reference acceleration on all joints. More...
 
virtual bool getRefSpeed (int j, double *ref)=0
 Get reference speed for a joint. More...
 
virtual bool getRefSpeeds (double *spds)=0
 Get reference speed of all joints. More...
 
virtual bool getRefAcceleration (int j, double *acc)=0
 Get reference acceleration for a joint. More...
 
virtual bool getRefAccelerations (double *accs)=0
 Get reference acceleration of all joints. More...
 
virtual bool stop (int j)=0
 Stop motion, single joint. More...
 
virtual bool stop ()=0
 Stop motion, multiple joints. More...
 
virtual bool positionMove (const int n_joint, const int *joints, const double *refs)=0
 Set new reference point for a subset of joints. More...
 
virtual bool relativeMove (const int n_joint, const int *joints, const double *deltas)=0
 Set relative position for a subset of joints. More...
 
virtual bool checkMotionDone (const int n_joint, const int *joints, bool *flag)=0
 Check if the current trajectory is terminated. More...
 
virtual bool setRefSpeeds (const int n_joint, const int *joints, const double *spds)=0
 Set reference speed on all joints. More...
 
virtual bool setRefAccelerations (const int n_joint, const int *joints, const double *accs)=0
 Set reference acceleration on all joints. More...
 
virtual bool getRefSpeeds (const int n_joint, const int *joints, double *spds)=0
 Get reference speed of all joints. More...
 
virtual bool getRefAccelerations (const int n_joint, const int *joints, double *accs)=0
 Get reference acceleration for a joint. More...
 
virtual bool stop (const int n_joint, const int *joints)=0
 Stop motion for subset of joints. More...
 
virtual bool getTargetPosition (const int joint, double *ref)
 Get the last position reference for the specified axis. More...
 
virtual bool getTargetPositions (double *refs)
 Get the last position reference for all axes. More...
 
virtual bool getTargetPositions (const int n_joint, const int *joints, double *refs)
 Get the last position reference for the specified group of axes. More...
 

Protected Member Functions

bool initialize (int size, const int *amap, const double *enc, const double *zos)
 Initialize the internal data and alloc memory. More...
 
bool uninitialize ()
 Clean up internal data and memory. More...
 

Protected Attributes

IPositionControlRawiPosition
 
void * helper
 
yarp::dev::impl::FixedSizeBuffersManager< int > * intBuffManager
 
yarp::dev::impl::FixedSizeBuffersManager< double > * doubleBuffManager
 
yarp::dev::impl::FixedSizeBuffersManager< bool > * boolBuffManager
 

Detailed Description

Default implementation of the IPositionControl interface.

This class can be used to easily provide an implementation of IPositionControl.

Definition at line 29 of file ImplementPositionControl.h.

Constructor & Destructor Documentation

◆ ImplementPositionControl()

ImplementPositionControl::ImplementPositionControl ( yarp::dev::IPositionControlRaw y)

Constructor.

Parameters
yis the pointer to the class instance inheriting from this implementation.

Definition at line 17 of file ImplementPositionControl.cpp.

◆ ~ImplementPositionControl()

ImplementPositionControl::~ImplementPositionControl ( )
virtual

Destructor.

Perform uninitialize if needed.

Definition at line 26 of file ImplementPositionControl.cpp.

Member Function Documentation

◆ checkMotionDone() [1/3]

bool ImplementPositionControl::checkMotionDone ( bool *  flag)
overridevirtual

Check if the current trajectory is terminated.

Non blocking.

Parameters
flagis a pointer to return value ("and" of all joints)
Returns
true/false on network communication (value you actually want is stored in *flag)

Implements yarp::dev::IPositionControl.

Definition at line 194 of file ImplementPositionControl.cpp.

◆ checkMotionDone() [2/3]

bool ImplementPositionControl::checkMotionDone ( const int  n_joint,
const int *  joints,
bool *  flag 
)
overridevirtual

Check if the current trajectory is terminated.

Non blocking.

Parameters
jointspointer to the array of joint numbers
flagpointer to return value (logical "and" of all set of joints)
Returns
true/false if network communication went well.

Implements yarp::dev::IPositionControl.

Definition at line 178 of file ImplementPositionControl.cpp.

◆ checkMotionDone() [3/3]

bool ImplementPositionControl::checkMotionDone ( int  j,
bool *  flag 
)
overridevirtual

Check if the current trajectory is terminated.

Non blocking.

Parameters
jis the axis number
flagis a pointer to return value
Returns
true/false on network communication (value you actually want is stored in *flag)

Implements yarp::dev::IPositionControl.

Definition at line 170 of file ImplementPositionControl.cpp.

◆ getAxes()

bool ImplementPositionControl::getAxes ( int *  axis)
overridevirtual

Get the number of controlled axes.

This command asks the number of controlled axes for the current physical interface.

Returns
the number of controlled axes.

Implements yarp::dev::IPositionControl.

Reimplemented in FakeMotionControl.

Definition at line 393 of file ImplementPositionControl.cpp.

◆ getRefAcceleration()

bool ImplementPositionControl::getRefAcceleration ( int  j,
double *  acc 
)
overridevirtual

Get reference acceleration for a joint.

Returns the acceleration used to generate the trajectory profile.

Parameters
jjoint number
accpointer to storage for the return value
Returns
true/false on success/failure

Implements yarp::dev::IPositionControl.

Definition at line 353 of file ImplementPositionControl.cpp.

◆ getRefAccelerations() [1/2]

bool ImplementPositionControl::getRefAccelerations ( const int  n_joint,
const int *  joints,
double *  accs 
)
overridevirtual

Get reference acceleration for a joint.

Returns the acceleration used to generate the trajectory profile.

Parameters
jointspointer to the array of joint numbers
accspointer to the array that will store the acceleration values
Returns
true/false on success/failure

Implements yarp::dev::IPositionControl.

Definition at line 329 of file ImplementPositionControl.cpp.

◆ getRefAccelerations() [2/2]

bool ImplementPositionControl::getRefAccelerations ( double *  accs)
overridevirtual

Get reference acceleration of all joints.

These are the values used during the interpolation of the trajectory.

Parameters
accspointer to the array that will store the acceleration values.
Returns
true/false on success or failure

Implements yarp::dev::IPositionControl.

Definition at line 320 of file ImplementPositionControl.cpp.

◆ getRefSpeed()

bool ImplementPositionControl::getRefSpeed ( int  j,
double *  ref 
)
overridevirtual

Get reference speed for a joint.

Returns the speed used to generate the trajectory profile.

Parameters
jjoint number
refpointer to storage for the return value
Returns
true/false on success or failure

Implements yarp::dev::IPositionControl.

Definition at line 273 of file ImplementPositionControl.cpp.

◆ getRefSpeeds() [1/2]

bool ImplementPositionControl::getRefSpeeds ( const int  n_joint,
const int *  joints,
double *  spds 
)
overridevirtual

Get reference speed of all joints.

These are the values used during the interpolation of the trajectory.

Parameters
jointspointer to the array of joint numbers
spdspointer to the array that will store the speed values.
Returns
true/false upon success/failure

Implements yarp::dev::IPositionControl.

Definition at line 287 of file ImplementPositionControl.cpp.

◆ getRefSpeeds() [2/2]

bool ImplementPositionControl::getRefSpeeds ( double *  spds)
overridevirtual

Get reference speed of all joints.

These are the values used during the interpolation of the trajectory.

Parameters
spdspointer to the array that will store the speed values.

Implements yarp::dev::IPositionControl.

Definition at line 311 of file ImplementPositionControl.cpp.

◆ getTargetPosition()

bool ImplementPositionControl::getTargetPosition ( const int  joint,
double *  ref 
)
overridevirtual

Get the last position reference for the specified axis.

This is the dual of PositionMove and shall return only values sent using IPositionControl interface. If other interfaces like IPositionDirect are implemented by the device, this call must ignore their values, i.e. this call must never return a reference sent using IPositionDirect::SetPosition

Parameters
reflast reference sent using PositionMove functions
Returns
true/false on success/failure

Reimplemented from yarp::dev::IPositionControl.

Definition at line 401 of file ImplementPositionControl.cpp.

◆ getTargetPositions() [1/2]

bool ImplementPositionControl::getTargetPositions ( const int  n_joint,
const int *  joints,
double *  refs 
)
overridevirtual

Get the last position reference for the specified group of axes.

This is the dual of PositionMove and shall return only values sent using IPositionControl interface. If other interfaces like IPositionDirect are implemented by the device, this call must ignore their values, i.e. this call must never return a reference sent using IPositionDirect::SetPosition

Parameters
reflast reference sent using PositionMove functions
Returns
true/false on success/failure

Reimplemented from yarp::dev::IPositionControl.

Definition at line 425 of file ImplementPositionControl.cpp.

◆ getTargetPositions() [2/2]

bool ImplementPositionControl::getTargetPositions ( double *  refs)
overridevirtual

Get the last position reference for all axes.

This is the dual of PositionMove and shall return only values sent using IPositionControl interface. If other interfaces like IPositionDirect are implemented by the device, this call must ignore their values, i.e. this call must never return a reference sent using IPositionDirect::SetPosition

Parameters
reflast reference sent using PositionMove functions
Returns
true/false on success/failure

Reimplemented from yarp::dev::IPositionControl.

Definition at line 416 of file ImplementPositionControl.cpp.

◆ initialize()

bool ImplementPositionControl::initialize ( int  size,
const int *  amap,
const double *  enc,
const double *  zos 
)
protected

Initialize the internal data and alloc memory.

Allocate memory for internal data.

Parameters
sizeis the number of controlled axes the driver deals with.
amapis a lookup table mapping axes onto physical drivers.
encis an array containing the encoder to angles conversion factors.
zosis an array containing the zeros of the encoders. respect to the control/output values of the driver.
Returns
true if initialized succeeded, false if it wasn't executed, or assert.
Parameters
sizethe number of joints
amapaxis map for this device wrapper
encencoder conversion factor, from high level to hardware
zosoffset for setting the zero point. Units are relative to high level user interface (degrees)
Returns
true if uninitialization is executed, false otherwise.

Definition at line 39 of file ImplementPositionControl.cpp.

◆ positionMove() [1/3]

bool ImplementPositionControl::positionMove ( const double *  refs)
overridevirtual

Set new reference point for all axes.

Parameters
refsarray, new reference points.
Returns
true/false on success/failure

Implements yarp::dev::IPositionControl.

Definition at line 122 of file ImplementPositionControl.cpp.

◆ positionMove() [2/3]

bool ImplementPositionControl::positionMove ( const int  n_joint,
const int *  joints,
const double *  refs 
)
overridevirtual

Set new reference point for a subset of joints.

Parameters
jointspointer to the array of joint numbers
refspointer to the array specifying the new reference points
Returns
true/false on success/failure

Implements yarp::dev::IPositionControl.

Definition at line 101 of file ImplementPositionControl.cpp.

◆ positionMove() [3/3]

bool ImplementPositionControl::positionMove ( int  j,
double  ref 
)
overridevirtual

Set new reference point for a single axis.

Parameters
jjoint number
refspecifies the new ref point
Returns
true/false on success/failure

Implements yarp::dev::IPositionControl.

Definition at line 92 of file ImplementPositionControl.cpp.

◆ relativeMove() [1/3]

bool ImplementPositionControl::relativeMove ( const double *  deltas)
overridevirtual

Set relative position, all joints.

Parameters
deltaspointer to the relative commands
Returns
true/false on success/failure

Implements yarp::dev::IPositionControl.

Definition at line 161 of file ImplementPositionControl.cpp.

◆ relativeMove() [2/3]

bool ImplementPositionControl::relativeMove ( const int  n_joint,
const int *  joints,
const double *  deltas 
)
overridevirtual

Set relative position for a subset of joints.

Parameters
jointspointer to the array of joint numbers
deltaspointer to the array of relative commands
Returns
true/false on success/failure

Implements yarp::dev::IPositionControl.

Definition at line 142 of file ImplementPositionControl.cpp.

◆ relativeMove() [3/3]

bool ImplementPositionControl::relativeMove ( int  j,
double  delta 
)
overridevirtual

Set relative position.

The command is relative to the current position of the axis.

Parameters
jjoint axis number
deltarelative command
Returns
true/false on success/failure

Implements yarp::dev::IPositionControl.

Definition at line 132 of file ImplementPositionControl.cpp.

◆ setRefAcceleration()

bool ImplementPositionControl::setRefAcceleration ( int  j,
double  acc 
)
overridevirtual

Set reference acceleration for a joint.

This value is used during the trajectory generation.

Parameters
jjoint number
accacceleration value
Returns
true/false upon success/failure

Implements yarp::dev::IPositionControl.

Definition at line 234 of file ImplementPositionControl.cpp.

◆ setRefAccelerations() [1/2]

bool ImplementPositionControl::setRefAccelerations ( const double *  accs)
overridevirtual

Set reference acceleration on all joints.

This is the valure that is used during the generation of the trajectory.

Parameters
accspointer to the array of acceleration values
Returns
true/false upon success/failure

Implements yarp::dev::IPositionControl.

Definition at line 263 of file ImplementPositionControl.cpp.

◆ setRefAccelerations() [2/2]

bool ImplementPositionControl::setRefAccelerations ( const int  n_joint,
const int *  joints,
const double *  accs 
)
overridevirtual

Set reference acceleration on all joints.

This is the valure that is used during the generation of the trajectory.

Parameters
jointspointer to the array of joint numbers
accspointer to the array with acceleration values
Returns
true/false upon success/failure

Implements yarp::dev::IPositionControl.

Definition at line 244 of file ImplementPositionControl.cpp.

◆ setRefSpeed()

bool ImplementPositionControl::setRefSpeed ( int  j,
double  sp 
)
overridevirtual

Set reference speed for a joint, this is the speed used during the interpolation of the trajectory.

Parameters
jjoint number
spspeed value
Returns
true/false upon success/failure

Implements yarp::dev::IPositionControl.

Definition at line 199 of file ImplementPositionControl.cpp.

◆ setRefSpeeds() [1/2]

bool ImplementPositionControl::setRefSpeeds ( const double *  spds)
overridevirtual

Set reference speed on all joints.

These values are used during the interpolation of the trajectory.

Parameters
spdspointer to the array of speed values.
Returns
true/false upon success/failure

Implements yarp::dev::IPositionControl.

Definition at line 225 of file ImplementPositionControl.cpp.

◆ setRefSpeeds() [2/2]

bool ImplementPositionControl::setRefSpeeds ( const int  n_joint,
const int *  joints,
const double *  spds 
)
overridevirtual

Set reference speed on all joints.

These values are used during the interpolation of the trajectory.

Parameters
jointspointer to the array of joint numbers
spdspointer to the array with speed values.
Returns
true/false upon success/failure

Implements yarp::dev::IPositionControl.

Definition at line 208 of file ImplementPositionControl.cpp.

◆ stop() [1/3]

bool ImplementPositionControl::stop ( )
overridevirtual

Stop motion, multiple joints.

Returns
true/false on success/failure

Implements yarp::dev::IPositionControl.

Definition at line 388 of file ImplementPositionControl.cpp.

◆ stop() [2/3]

bool ImplementPositionControl::stop ( const int  n_joint,
const int *  joints 
)
overridevirtual

Stop motion for subset of joints.

Parameters
jointspointer to the array of joint numbers
Returns
true/false on success/failure

Implements yarp::dev::IPositionControl.

Definition at line 375 of file ImplementPositionControl.cpp.

◆ stop() [3/3]

bool ImplementPositionControl::stop ( int  j)
overridevirtual

Stop motion, single joint.

Parameters
jjoint number
Returns
true/false on success/failure

Implements yarp::dev::IPositionControl.

Definition at line 366 of file ImplementPositionControl.cpp.

◆ uninitialize()

bool ImplementPositionControl::uninitialize ( )
protected

Clean up internal data and memory.

Returns
true if uninitialization is executed, false otherwise.

Definition at line 63 of file ImplementPositionControl.cpp.

Member Data Documentation

◆ boolBuffManager

yarp::dev::impl::FixedSizeBuffersManager<bool>* yarp::dev::ImplementPositionControl::boolBuffManager
protected

Definition at line 36 of file ImplementPositionControl.h.

◆ doubleBuffManager

yarp::dev::impl::FixedSizeBuffersManager<double>* yarp::dev::ImplementPositionControl::doubleBuffManager
protected

Definition at line 35 of file ImplementPositionControl.h.

◆ helper

void* yarp::dev::ImplementPositionControl::helper
protected

Definition at line 33 of file ImplementPositionControl.h.

◆ intBuffManager

yarp::dev::impl::FixedSizeBuffersManager<int>* yarp::dev::ImplementPositionControl::intBuffManager
protected

Definition at line 34 of file ImplementPositionControl.h.

◆ iPosition

IPositionControlRaw* yarp::dev::ImplementPositionControl::iPosition
protected

Definition at line 32 of file ImplementPositionControl.h.


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