YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
yarp::dev::ImplementInteractionMode Class Reference

Interface settings the way the robot interacts with the environment: basic interaction types are Stiff and Compliant. More...

#include <yarp/dev/ImplementInteractionMode.h>

+ Inheritance diagram for yarp::dev::ImplementInteractionMode:

Public Member Functions

 ImplementInteractionMode (yarp::dev::IInteractionModeRaw *Class_p)
 Constructor.
 
virtual ~ImplementInteractionMode ()
 Destructor.
 
yarp::dev::ReturnValue getInteractionMode (int axis, yarp::dev::InteractionModeEnum &mode) override
 Get the current interaction mode of the robot, values can be stiff or compliant.
 
yarp::dev::ReturnValue getInteractionModes (const std::vector< int > &joints, std::vector< yarp::dev::InteractionModeEnum > &modes) override
 Get the current interaction mode of the robot for a set of joints, values can be stiff or compliant.
 
yarp::dev::ReturnValue getInteractionModes (std::vector< yarp::dev::InteractionModeEnum > &modes) override
 Get the current interaction mode of the robot for a all the joints, values can be stiff or compliant.
 
yarp::dev::ReturnValue setInteractionMode (int axis, yarp::dev::InteractionModeEnum mode) override
 Set the interaction mode of the robot, values can be stiff or compliant.
 
yarp::dev::ReturnValue setInteractionModes (const std::vector< int > &joints, const std::vector< yarp::dev::InteractionModeEnum > &modes) override
 Set the interaction mode of the robot for a set of joints, values can be stiff or compliant.
 
yarp::dev::ReturnValue setInteractionModes (const std::vector< InteractionModeEnum > &modes) override
 Set the interaction mode of the robot for a all the joints, values can be stiff or compliant.
 
- Public Member Functions inherited from yarp::dev::IInteractionMode
virtual ~IInteractionMode ()
 Destructor.
 

Protected Member Functions

bool initialize (int size, const int *amap)
 Initialize the internal data and alloc memory, smaller version.
 
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

yarp::dev::IInteractionModeRaw * m_iraw =nullptr
 
void * m_helper =nullptr
 
std::mutex m_imp_mutex
 
std::vector< int > m_buffer_ints
 
std::vector< double > m_buffer_doubles
 
std::vector< yarp::dev::InteractionModeEnum > m_buffer_enums
 

Detailed Description

Interface settings the way the robot interacts with the environment: basic interaction types are Stiff and Compliant.

This setting is intended to work in conjunction with other settings like position or velocity control.

Definition at line 32 of file ImplementInteractionMode.h.

Constructor & Destructor Documentation

◆ ImplementInteractionMode()

ImplementInteractionMode::ImplementInteractionMode ( yarp::dev::IInteractionModeRaw *  Class_p)

Constructor.

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

Definition at line 21 of file ImplementInteractionMode.cpp.

◆ ~ImplementInteractionMode()

ImplementInteractionMode::~ImplementInteractionMode ( )
virtual

Destructor.

Perform uninitialize if needed.

Definition at line 27 of file ImplementInteractionMode.cpp.

Member Function Documentation

◆ getInteractionMode()

ReturnValue ImplementInteractionMode::getInteractionMode ( int  axis,
yarp::dev::InteractionModeEnum &  mode 
)
overridevirtual

Get the current interaction mode of the robot, values can be stiff or compliant.

Parameters
axisjoint number
modecontains the requested information about interaction mode of the joint
Returns
true or false on success or failure.

Implements yarp::dev::IInteractionMode.

Definition at line 74 of file ImplementInteractionMode.cpp.

◆ getInteractionModes() [1/2]

ReturnValue ImplementInteractionMode::getInteractionModes ( const std::vector< int > &  joints,
std::vector< yarp::dev::InteractionModeEnum > &  modes 
)
overridevirtual

Get the current interaction mode of the robot for a set of joints, values can be stiff or compliant.

Parameters
n_jointshow many joints this command is referring to
jointslist of joints controlled. The size of this array is n_joints
modesarray containing the requested information about interaction mode, one value for each joint, the size is n_joints. for example: n_joint 3 joints 0 2 4 refs VOCAB_IM_STIFF VOCAB_IM_STIFF VOCAB_IM_COMPLIANT
Returns
true or false on success or failure.

Implements yarp::dev::IInteractionMode.

Definition at line 82 of file ImplementInteractionMode.cpp.

◆ getInteractionModes() [2/2]

ReturnValue ImplementInteractionMode::getInteractionModes ( std::vector< yarp::dev::InteractionModeEnum > &  modes)
overridevirtual

Get the current interaction mode of the robot for a all the joints, values can be stiff or compliant.

Parameters
modearray containing the requested information about interaction mode, one value for each joint.
Returns
true or false on success or failure.

Implements yarp::dev::IInteractionMode.

Definition at line 97 of file ImplementInteractionMode.cpp.

◆ initialize() [1/2]

bool ImplementInteractionMode::initialize ( int  size,
const int *  amap 
)
protected

Initialize the internal data and alloc memory, smaller version.

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.
Returns
true if initialized succeeded, false if it wasn't executed, or assert.
Parameters
sizethe number of joints
amapaxis map for this device wrapper
Returns
true if uninitialization is executed, false otherwise.

Definition at line 38 of file ImplementInteractionMode.cpp.

◆ initialize() [2/2]

bool ImplementInteractionMode::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 43 of file ImplementInteractionMode.cpp.

◆ setInteractionMode()

ReturnValue ImplementInteractionMode::setInteractionMode ( int  axis,
yarp::dev::InteractionModeEnum  mode 
)
overridevirtual

Set the interaction mode of the robot, values can be stiff or compliant.

Please note that some robot may not implement certain types of interaction, so always check the return value.

Parameters
axisjoint number
modethe desired interaction mode
Returns
true or false on success or failure.

Implements yarp::dev::IInteractionMode.

Definition at line 116 of file ImplementInteractionMode.cpp.

◆ setInteractionModes() [1/2]

ReturnValue ImplementInteractionMode::setInteractionModes ( const std::vector< int > &  joints,
const std::vector< yarp::dev::InteractionModeEnum > &  modes 
)
overridevirtual

Set the interaction mode of the robot for a set of joints, values can be stiff or compliant.

Please note that some robot may not implement certain types of interaction, so always check the return value.

Parameters
n_jointshow many joints this command is referring to
jointslist of joints controlled. The size of this array is n_joints
modesarray containing the desired interaction mode, one value for each joint, the size is n_joints. for example: n_joint 3 joints 0 2 4 refs VOCAB_IM_STIFF VOCAB_IM_STIFF VOCAB_IM_COMPLIANT
Returns
true or false on success or failure. If one or more joint fails, the return value will be false.

Implements yarp::dev::IInteractionMode.

Definition at line 124 of file ImplementInteractionMode.cpp.

◆ setInteractionModes() [2/2]

ReturnValue ImplementInteractionMode::setInteractionModes ( const std::vector< InteractionModeEnum > &  modes)
overridevirtual

Set the interaction mode of the robot for a all the joints, values can be stiff or compliant.

Some robot may not implement some types of interaction, so always check the return value

Parameters
modearray with the desired interaction mode for all joints, length is the total number of joints for the part
Returns
true or false on success or failure. If one or more joint fails, the return value will be false.

Implements yarp::dev::IInteractionMode.

Definition at line 139 of file ImplementInteractionMode.cpp.

◆ uninitialize()

bool ImplementInteractionMode::uninitialize ( )
protected

Clean up internal data and memory.

Returns
true if uninitialization is executed, false otherwise.

Definition at line 63 of file ImplementInteractionMode.cpp.

Member Data Documentation

◆ m_buffer_doubles

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

Definition at line 39 of file ImplementInteractionMode.h.

◆ m_buffer_enums

std::vector< yarp::dev::InteractionModeEnum> yarp::dev::ImplementInteractionMode::m_buffer_enums
protected

Definition at line 40 of file ImplementInteractionMode.h.

◆ m_buffer_ints

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

Definition at line 38 of file ImplementInteractionMode.h.

◆ m_helper

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

Definition at line 36 of file ImplementInteractionMode.h.

◆ m_imp_mutex

std::mutex yarp::dev::ImplementInteractionMode::m_imp_mutex
protected

Definition at line 37 of file ImplementInteractionMode.h.

◆ m_iraw

yarp::dev::IInteractionModeRaw* yarp::dev::ImplementInteractionMode::m_iraw =nullptr
protected

Definition at line 35 of file ImplementInteractionMode.h.


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