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

Default implementation of the IPositionDirect interface. More...

#include <yarp/dev/ImplementPositionDirect.h>

+ Inheritance diagram for yarp::dev::ImplementPositionDirect:

Public Member Functions

 ImplementPositionDirect (yarp::dev::IPositionDirectRaw *y)
 Constructor. More...
 
virtual ~ImplementPositionDirect ()
 Destructor. More...
 
bool getAxes (int *axes) override
 Get the number of controlled axes. More...
 
bool setPosition (int j, double ref) override
 Set new position for a single axis. More...
 
bool setPositions (const int n_joint, const int *joints, const double *refs) override
 Set new reference point for all axes. More...
 
bool setPositions (const double *refs) override
 Set new position for a set of axis. More...
 
bool getRefPosition (const int joint, double *ref) override
 Get the last position reference for the specified axis. More...
 
bool getRefPositions (double *refs) override
 Get the last position reference for all axes. More...
 
bool getRefPositions (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::IPositionDirect
virtual ~IPositionDirect ()
 Destructor. 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

IPositionDirectRawiPDirect
 
void * helper
 
yarp::dev::impl::FixedSizeBuffersManager< int > * intBuffManager
 
yarp::dev::impl::FixedSizeBuffersManager< double > * doubleBuffManager
 

Detailed Description

Default implementation of the IPositionDirect interface.

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

Definition at line 38 of file ImplementPositionDirect.h.

Constructor & Destructor Documentation

◆ ImplementPositionDirect()

ImplementPositionDirect::ImplementPositionDirect ( yarp::dev::IPositionDirectRaw y)

Constructor.

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

Definition at line 21 of file ImplementPositionDirect.cpp.

◆ ~ImplementPositionDirect()

ImplementPositionDirect::~ImplementPositionDirect ( )
virtual

Destructor.

Perform uninitialize if needed.

Definition at line 29 of file ImplementPositionDirect.cpp.

Member Function Documentation

◆ getAxes()

bool ImplementPositionDirect::getAxes ( int *  ax)
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::IPositionDirect.

Reimplemented in FakeMotionControl.

Definition at line 74 of file ImplementPositionDirect.cpp.

◆ getRefPosition()

bool ImplementPositionDirect::getRefPosition ( const int  joint,
double *  ref 
)
overridevirtual

Get the last position reference for the specified axis.

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

Parameters
reflast reference sent using setPosition(s) functions
Returns
true/false on success/failure

Reimplemented from yarp::dev::IPositionDirect.

Definition at line 123 of file ImplementPositionDirect.cpp.

◆ getRefPositions() [1/2]

bool ImplementPositionDirect::getRefPositions ( 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 setPositionsRaw and shall return only values sent using IPositionDirect interface. If other interfaces like IPositionControl are implemented by the device, this call must ignore their values, i.e. this call must never return a reference sent using IPositionControl::PositionMove.

Parameters
refarray containing last reference sent using setPosition(s) functions
Returns
true/false on success/failure

Reimplemented from yarp::dev::IPositionDirect.

Definition at line 136 of file ImplementPositionDirect.cpp.

◆ getRefPositions() [2/2]

bool ImplementPositionDirect::getRefPositions ( double *  refs)
overridevirtual

Get the last position reference for all axes.

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

Parameters
refarray containing last reference sent using setPosition(s) functions
Returns
true/false on success/failure

Reimplemented from yarp::dev::IPositionDirect.

Definition at line 162 of file ImplementPositionDirect.cpp.

◆ initialize()

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

Initialize the internal data and alloc memory.

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.

Definition at line 34 of file ImplementPositionDirect.cpp.

◆ setPosition()

bool ImplementPositionDirect::setPosition ( int  j,
double  ref 
)
overridevirtual

Set new position for a single axis.

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

Implements yarp::dev::IPositionDirect.

Definition at line 80 of file ImplementPositionDirect.cpp.

◆ setPositions() [1/2]

bool ImplementPositionDirect::setPositions ( const double *  refs)
overridevirtual

Set new position for a set of axis.

Parameters
refsspecifies the new reference points
Returns
true/false on success/failure

Implements yarp::dev::IPositionDirect.

Definition at line 114 of file ImplementPositionDirect.cpp.

◆ setPositions() [2/2]

bool ImplementPositionDirect::setPositions ( const int  n_joint,
const int *  joints,
const double *  refs 
)
overridevirtual

Set new reference point for all axes.

Parameters
n_jointhow many joints this command is referring to
jointslist of joints controlled. The size of this array is n_joints
refsarray, new reference points, one value for each joint, the size is n_joints. The first value will be the new reference for the joint joints[0]. for example: n_joint 3 joints 0 2 4 refs 10 30 40
Returns
true/false on success/failure

Implements yarp::dev::IPositionDirect.

Definition at line 89 of file ImplementPositionDirect.cpp.

◆ uninitialize()

bool ImplementPositionDirect::uninitialize ( )
protected

Clean up internal data and memory.

Returns
true if uninitialization is executed, false otherwise.

Definition at line 51 of file ImplementPositionDirect.cpp.

Member Data Documentation

◆ doubleBuffManager

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

Definition at line 44 of file ImplementPositionDirect.h.

◆ helper

void* yarp::dev::ImplementPositionDirect::helper
protected

Definition at line 42 of file ImplementPositionDirect.h.

◆ intBuffManager

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

Definition at line 43 of file ImplementPositionDirect.h.

◆ iPDirect

IPositionDirectRaw* yarp::dev::ImplementPositionDirect::iPDirect
protected

Definition at line 41 of file ImplementPositionDirect.h.


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