YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
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.
 
virtual ~ImplementPositionDirect ()
 Destructor.
 
yarp::dev::ReturnValue getAxes (size_t &axes) override
 Get the number of controlled axes.
 
yarp::dev::ReturnValue setPosition (int j, double ref) override
 Set new position for a single axis.
 
yarp::dev::ReturnValue setPositions (const int n_joint, const int *joints, const double *refs) override
 Set new reference point for all axes.
 
yarp::dev::ReturnValue setPositions (const double *refs) override
 Set new position for a set of axis.
 
yarp::dev::ReturnValue getRefPosition (const int joint, double *ref) override
 Get the last position reference for the specified axis.
 
yarp::dev::ReturnValue getRefPositions (double *refs) override
 Get the last position reference for all axes.
 
yarp::dev::ReturnValue getRefPositions (const int n_joint, const int *joints, double *refs) override
 Get the last position reference for the specified group of axes.
 
- Public Member Functions inherited from yarp::dev::IPositionDirect
virtual ~IPositionDirect ()
 Destructor.
 

Protected Member Functions

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

Protected Attributes

IPositionDirectRaw * m_iraw =nullptr
 
void * m_helper =nullptr
 
std::vector< int > m_buffer_ints
 
std::vector< double > m_buffer_doubles
 
std::mutex m_imp_mutex
 

Detailed Description

Default implementation of the IPositionDirect interface.

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

Definition at line 29 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 27 of file ImplementPositionDirect.cpp.

Member Function Documentation

◆ getAxes()

ReturnValue ImplementPositionDirect::getAxes ( size_t &  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.

Definition at line 58 of file ImplementPositionDirect.cpp.

◆ getRefPosition()

ReturnValue 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

Implements yarp::dev::IPositionDirect.

Definition at line 106 of file ImplementPositionDirect.cpp.

◆ getRefPositions() [1/2]

ReturnValue 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

Implements yarp::dev::IPositionDirect.

Definition at line 122 of file ImplementPositionDirect.cpp.

◆ getRefPositions() [2/2]

ReturnValue 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

Implements yarp::dev::IPositionDirect.

Definition at line 144 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 32 of file ImplementPositionDirect.cpp.

◆ setPosition()

ReturnValue 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 66 of file ImplementPositionDirect.cpp.

◆ setPositions() [1/2]

ReturnValue 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 95 of file ImplementPositionDirect.cpp.

◆ setPositions() [2/2]

ReturnValue 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 77 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 47 of file ImplementPositionDirect.cpp.

Member Data Documentation

◆ m_buffer_doubles

std::vector<double> yarp::dev::ImplementPositionDirect::m_buffer_doubles
protected

Definition at line 35 of file ImplementPositionDirect.h.

◆ m_buffer_ints

std::vector<int> yarp::dev::ImplementPositionDirect::m_buffer_ints
protected

Definition at line 34 of file ImplementPositionDirect.h.

◆ m_helper

void* yarp::dev::ImplementPositionDirect::m_helper =nullptr
protected

Definition at line 33 of file ImplementPositionDirect.h.

◆ m_imp_mutex

std::mutex yarp::dev::ImplementPositionDirect::m_imp_mutex
protected

Definition at line 36 of file ImplementPositionDirect.h.

◆ m_iraw

IPositionDirectRaw* yarp::dev::ImplementPositionDirect::m_iraw =nullptr
protected

Definition at line 32 of file ImplementPositionDirect.h.


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