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

#include <yarp/dev/ImplementMotorEncoders.h>

+ Inheritance diagram for yarp::dev::ImplementMotorEncoders:

Public Member Functions

 ImplementMotorEncoders (yarp::dev::IMotorEncodersRaw *y)
 
virtual ~ImplementMotorEncoders ()
 
yarp::dev::ReturnValue getNumberOfMotorEncoders (int *num) override
 Get the number of available motor encoders.
 
yarp::dev::ReturnValue resetMotorEncoder (int m) override
 Reset motor encoder, single motor.
 
yarp::dev::ReturnValue resetMotorEncoders () override
 Reset motor encoders.
 
yarp::dev::ReturnValue setMotorEncoder (int m, const double val) override
 Set the value of the motor encoder for a given motor.
 
yarp::dev::ReturnValue setMotorEncoders (const double *vals) override
 Set the value of all motor encoders.
 
yarp::dev::ReturnValue setMotorEncoderCountsPerRevolution (int m, const double cpr) override
 Sets number of counts per revolution for motor encoder m.
 
yarp::dev::ReturnValue getMotorEncoderCountsPerRevolution (int m, double *cpr) override
 Gets number of counts per revolution for motor encoder m.
 
yarp::dev::ReturnValue getMotorEncoder (int m, double *v) override
 Read the value of a motor encoder.
 
yarp::dev::ReturnValue getMotorEncodersTimed (double *encs, double *time) override
 Read the instantaneous position of all motor encoders.
 
yarp::dev::ReturnValue getMotorEncoderTimed (int m, double *v, double *t) override
 Read the instantaneous position of a motor encoder.
 
yarp::dev::ReturnValue getMotorEncoders (double *encs) override
 Read the position of all motor encoders.
 
yarp::dev::ReturnValue getMotorEncoderSpeed (int m, double *spds) override
 Read the instantaneous speed of a motor encoder.
 
yarp::dev::ReturnValue getMotorEncoderSpeeds (double *spds) override
 Read the instantaneous speed of all motor encoders.
 
yarp::dev::ReturnValue getMotorEncoderAcceleration (int m, double *spds) override
 Read the instantaneous acceleration of a motor encoder.
 
yarp::dev::ReturnValue getMotorEncoderAccelerations (double *accs) override
 Read the instantaneous acceleration of all motor encoders.
 
- Public Member Functions inherited from yarp::dev::IMotorEncoders
virtual ~IMotorEncoders ()
 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

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

Detailed Description

Definition at line 22 of file ImplementMotorEncoders.h.

Constructor & Destructor Documentation

◆ ImplementMotorEncoders()

ImplementMotorEncoders::ImplementMotorEncoders ( yarp::dev::IMotorEncodersRaw *  y)

Definition at line 21 of file ImplementMotorEncoders.cpp.

◆ ~ImplementMotorEncoders()

ImplementMotorEncoders::~ImplementMotorEncoders ( )
virtual

Definition at line 26 of file ImplementMotorEncoders.cpp.

Member Function Documentation

◆ getMotorEncoder()

ReturnValue ImplementMotorEncoders::getMotorEncoder ( int  m,
double *  v 
)
overridevirtual

Read the value of a motor encoder.

Parameters
mmotor encoder number
vpointer to storage for the return value
Returns
true/false

Implements yarp::dev::IMotorEncoders.

Definition at line 139 of file ImplementMotorEncoders.cpp.

◆ getMotorEncoderAcceleration()

ReturnValue ImplementMotorEncoders::getMotorEncoderAcceleration ( int  m,
double *  acc 
)
overridevirtual

Read the instantaneous acceleration of a motor encoder.

Parameters
mmotor number
accpointer to the array that will contain the output
Returns
true if successful, false otherwise.

Implements yarp::dev::IMotorEncoders.

Definition at line 199 of file ImplementMotorEncoders.cpp.

◆ getMotorEncoderAccelerations()

ReturnValue ImplementMotorEncoders::getMotorEncoderAccelerations ( double *  accs)
overridevirtual

Read the instantaneous acceleration of all motor encoders.

Parameters
accspointer to the array that will contain the output
Returns
true if successful, false otherwise.

Implements yarp::dev::IMotorEncoders.

Definition at line 218 of file ImplementMotorEncoders.cpp.

◆ getMotorEncoderCountsPerRevolution()

ReturnValue ImplementMotorEncoders::getMotorEncoderCountsPerRevolution ( int  m,
double *  cpr 
)
overridevirtual

Gets number of counts per revolution for motor encoder m.

Parameters
mmotor number
cprvals pointer to the new value
Returns
true/false

Implements yarp::dev::IMotorEncoders.

Definition at line 101 of file ImplementMotorEncoders.cpp.

◆ getMotorEncoders()

ReturnValue ImplementMotorEncoders::getMotorEncoders ( double *  encs)
overridevirtual

Read the position of all motor encoders.

Parameters
encspointer to the array that will contain the output
Returns
true/false

Implements yarp::dev::IMotorEncoders.

Definition at line 158 of file ImplementMotorEncoders.cpp.

◆ getMotorEncoderSpeed()

ReturnValue ImplementMotorEncoders::getMotorEncoderSpeed ( int  m,
double *  sp 
)
overridevirtual

Read the instantaneous speed of a motor encoder.

Parameters
mmotor number
sppointer to storage for the output
Returns
true if successful, false otherwise.

Implements yarp::dev::IMotorEncoders.

Definition at line 169 of file ImplementMotorEncoders.cpp.

◆ getMotorEncoderSpeeds()

ReturnValue ImplementMotorEncoders::getMotorEncoderSpeeds ( double *  spds)
overridevirtual

Read the instantaneous speed of all motor encoders.

Parameters
spdspointer to storage for the output values
Returns
true if successful, false otherwise.

Implements yarp::dev::IMotorEncoders.

Definition at line 188 of file ImplementMotorEncoders.cpp.

◆ getMotorEncodersTimed()

ReturnValue ImplementMotorEncoders::getMotorEncodersTimed ( double *  encs,
double *  time 
)
overridevirtual

Read the instantaneous position of all motor encoders.

Parameters
encspointer to the array that will contain the output
timepointer to the array that will contain individual timestamps
Returns
true if successful, false otherwise.

Implements yarp::dev::IMotorEncoders.

Definition at line 250 of file ImplementMotorEncoders.cpp.

◆ getMotorEncoderTimed()

ReturnValue ImplementMotorEncoders::getMotorEncoderTimed ( int  m,
double *  encs,
double *  time 
)
overridevirtual

Read the instantaneous position of a motor encoder.

Parameters
mmotor index
encsencoder value (pointer to)
timecorresponding timestamp (pointer to)
Returns
true if successful, false otherwise.

Implements yarp::dev::IMotorEncoders.

Definition at line 229 of file ImplementMotorEncoders.cpp.

◆ getNumberOfMotorEncoders()

ReturnValue ImplementMotorEncoders::getNumberOfMotorEncoders ( int *  num)
overridevirtual

Get the number of available motor encoders.

Parameters
mpointer to a value representing the number of available motor encoders.
Returns
true/false

Implements yarp::dev::IMotorEncoders.

Definition at line 62 of file ImplementMotorEncoders.cpp.

◆ initialize()

bool ImplementMotorEncoders::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.
Returns
true if initialized succeeded, false if it wasn't executed, or assert.

Definition at line 31 of file ImplementMotorEncoders.cpp.

◆ resetMotorEncoder()

ReturnValue ImplementMotorEncoders::resetMotorEncoder ( int  m)
overridevirtual

Reset motor encoder, single motor.

Set the encoder value to zero.

Parameters
mmotor number
Returns
true/false

Implements yarp::dev::IMotorEncoders.

Definition at line 70 of file ImplementMotorEncoders.cpp.

◆ resetMotorEncoders()

ReturnValue ImplementMotorEncoders::resetMotorEncoders ( )
overridevirtual

Reset motor encoders.

Set the motor encoders value to zero.

Returns
true/false

Implements yarp::dev::IMotorEncoders.

Definition at line 81 of file ImplementMotorEncoders.cpp.

◆ setMotorEncoder()

ReturnValue ImplementMotorEncoders::setMotorEncoder ( int  m,
const double  val 
)
overridevirtual

Set the value of the motor encoder for a given motor.

Parameters
mmotor number
valnew value
Returns
true/false

Implements yarp::dev::IMotorEncoders.

Definition at line 88 of file ImplementMotorEncoders.cpp.

◆ setMotorEncoderCountsPerRevolution()

ReturnValue ImplementMotorEncoders::setMotorEncoderCountsPerRevolution ( int  m,
const double  cpr 
)
overridevirtual

Sets number of counts per revolution for motor encoder m.

Parameters
mmotor number
cprnew value
Returns
true/false

Implements yarp::dev::IMotorEncoders.

Definition at line 115 of file ImplementMotorEncoders.cpp.

◆ setMotorEncoders()

ReturnValue ImplementMotorEncoders::setMotorEncoders ( const double *  vals)
overridevirtual

Set the value of all motor encoders.

Parameters
valspointer to the new values
Returns
true/false

Implements yarp::dev::IMotorEncoders.

Definition at line 127 of file ImplementMotorEncoders.cpp.

◆ uninitialize()

bool ImplementMotorEncoders::uninitialize ( )
protected

Clean up internal data and memory.

Returns
true if uninitialization is executed, false otherwise.

Definition at line 51 of file ImplementMotorEncoders.cpp.

Member Data Documentation

◆ m_buffer_doubles

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

Definition at line 28 of file ImplementMotorEncoders.h.

◆ m_buffer_doubles2

std::vector<double> yarp::dev::ImplementMotorEncoders::m_buffer_doubles2
protected

Definition at line 29 of file ImplementMotorEncoders.h.

◆ m_buffer_ints

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

Definition at line 27 of file ImplementMotorEncoders.h.

◆ m_helper

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

Definition at line 26 of file ImplementMotorEncoders.h.

◆ m_imp_mutex

std::mutex yarp::dev::ImplementMotorEncoders::m_imp_mutex
protected

Definition at line 30 of file ImplementMotorEncoders.h.

◆ m_iraw

IMotorEncodersRaw* yarp::dev::ImplementMotorEncoders::m_iraw =nullptr
protected

Definition at line 25 of file ImplementMotorEncoders.h.


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