fakeMotionControlMicro
: This device implements a minimal subset of mandatory interfaces to run with controlBoard_nws_yarp.
More...
#include <fake/fakeMotionControlMicro/FakeMotionControlMicro.h>
Public Member Functions | |
FakeMotionControlMicro () | |
~FakeMotionControlMicro () | |
bool | open (yarp::os::Searchable &par) override |
Open the DeviceDriver. | |
bool | close () override |
Close the DeviceDriver. | |
bool | fromConfig (yarp::os::Searchable &config) |
virtual bool | initialised () |
bool | alloc (int njoints) |
Allocated buffers. | |
void | resizeBuffers () |
Resize previously allocated buffers. | |
bool | threadInit () override |
Initialization method. | |
void | threadRelease () override |
Release method. | |
bool | getLastJointFaultRaw (int j, int &fault, std::string &message) override |
bool | getNumberOfMotorEncodersRaw (int *num) override |
Get the number of available motor encoders. | |
bool | resetMotorEncoderRaw (int j) override |
Reset motor encoder, single motor. | |
bool | resetMotorEncodersRaw () override |
Reset motor encoders. | |
bool | setMotorEncoderRaw (int j, double val) override |
Set the value of the motor encoder for a given motor. | |
bool | setMotorEncodersRaw (const double *vals) override |
Set the value of all motor encoders. | |
bool | getMotorEncoderRaw (int j, double *v) override |
Read the value of a motor encoder. | |
bool | getMotorEncodersRaw (double *encs) override |
Read the position of all motor encoders. | |
bool | getMotorEncoderSpeedRaw (int j, double *sp) override |
Read the istantaneous speed of a motor encoder. | |
bool | getMotorEncoderSpeedsRaw (double *spds) override |
Read the instantaneous speed of all motor encoders. | |
bool | getMotorEncoderAccelerationRaw (int j, double *spds) override |
Read the instantaneous acceleration of a motor encoder. | |
bool | getMotorEncoderAccelerationsRaw (double *accs) override |
Read the instantaneous acceleration of all motor encoders. | |
bool | getMotorEncodersTimedRaw (double *encs, double *stamps) override |
Read the instantaneous position of all motor encoders. | |
bool | getMotorEncoderTimedRaw (int m, double *encs, double *stamp) override |
Read the instantaneous position of a motor encoder. | |
bool | getMotorEncoderCountsPerRevolutionRaw (int m, double *v) override |
Gets number of counts per revolution for motor encoder m. | |
bool | setMotorEncoderCountsPerRevolutionRaw (int m, const double cpr) override |
Sets number of counts per revolution for motor encoder m. | |
bool | getAxes (int *ax) override |
Get the number of controlled axes. | |
bool | resetEncoderRaw (int j) override |
Reset encoder, single joint. | |
bool | resetEncodersRaw () override |
Reset encoders. | |
bool | setEncoderRaw (int j, double val) override |
Set the value of the encoder for a given joint. | |
bool | setEncodersRaw (const double *vals) override |
Set the value of all encoders. | |
bool | getEncoderRaw (int j, double *v) override |
Read the value of an encoder. | |
bool | getEncodersRaw (double *encs) override |
Read the position of all axes. | |
bool | getEncoderSpeedRaw (int j, double *sp) override |
Read the instantaneous speed of an axis. | |
bool | getEncoderSpeedsRaw (double *spds) override |
Read the instantaneous acceleration of an axis. | |
bool | getEncoderAccelerationRaw (int j, double *spds) override |
Read the instantaneous acceleration of an axis. | |
bool | getEncoderAccelerationsRaw (double *accs) override |
Read the instantaneous acceleration of all axes. | |
bool | getEncodersTimedRaw (double *encs, double *stamps) override |
Read the instantaneous acceleration of all axes. | |
bool | getEncoderTimedRaw (int j, double *encs, double *stamp) override |
Read the instantaneous acceleration of all axes. | |
bool | getAxisNameRaw (int axis, std::string &name) override |
bool | getJointTypeRaw (int axis, yarp::dev::JointTypeEnum &type) override |
void | run () override |
Loop function. | |
![]() | |
PeriodicThread (double period, ShouldUseSystemClock useSystemClock=ShouldUseSystemClock::No, PeriodicThreadClock clockAccuracy=PeriodicThreadClock::Relative) | |
Constructor. | |
PeriodicThread (double period, PeriodicThreadClock clockAccuracy) | |
Constructor. | |
virtual | ~PeriodicThread () |
bool | start () |
Call this to start the thread. | |
void | step () |
Call this to "step" the thread rather than starting it. | |
void | stop () |
Call this to stop the thread, this call blocks until the thread is terminated (and releaseThread() called). | |
void | askToStop () |
Stop the thread. | |
bool | isRunning () const |
Returns true when the thread is started, false otherwise. | |
bool | isSuspended () const |
Returns true when the thread is suspended, false otherwise. | |
bool | setPeriod (double period) |
Set the (new) period of the thread. | |
double | getPeriod () const |
Return the current period of the thread. | |
void | suspend () |
Suspend the thread, the thread keeps running by doLoop is never executed. | |
void | resume () |
Resume the thread if previously suspended. | |
void | resetStat () |
Reset thread statistics. | |
double | getEstimatedPeriod () const |
Return estimated period since last reset. | |
void | getEstimatedPeriod (double &av, double &std) const |
Return estimated period since last reset. | |
unsigned int | getIterations () const |
Return the number of iterations performed since last reset. | |
double | getEstimatedUsed () const |
Return the estimated duration of the run() function since last reset. | |
void | getEstimatedUsed (double &av, double &std) const |
Return estimated duration of the run() function since last reset. | |
int | setPriority (int priority, int policy=-1) |
Set the priority and scheduling policy of the thread, if the OS supports that. | |
int | getPriority () const |
Query the current priority of the thread, if the OS supports that. | |
int | getPolicy () const |
Query the current scheduling policy of the thread, if the OS supports that. | |
![]() | |
DeviceDriver () | |
DeviceDriver (const DeviceDriver &other)=delete | |
DeviceDriver (DeviceDriver &&other) noexcept=delete | |
DeviceDriver & | operator= (const DeviceDriver &other)=delete |
DeviceDriver & | operator= (DeviceDriver &&other) noexcept=delete |
virtual | ~DeviceDriver () |
virtual std::string | id () const |
Return the id assigned to the PolyDriver. | |
virtual void | setId (const std::string &id) |
Set the id for this device. | |
template<class T > | |
bool | view (T *&x) |
Get an interface to the device driver. | |
virtual DeviceDriver * | getImplementation () |
Some drivers are bureaucrats, pointing at others. | |
![]() | |
virtual | ~IEncodersTimedRaw () |
Destructor. | |
![]() | |
virtual | ~IEncodersRaw () |
Destructor. | |
![]() | |
virtual | ~IMotorEncodersRaw () |
Destructor. | |
![]() | |
virtual | ~IAxisInfoRaw () |
Destructor. | |
![]() | |
virtual | ~IJointFaultRaw () |
![]() | |
ImplementJointFault (yarp::dev::IJointFaultRaw *y) | |
virtual | ~ImplementJointFault () |
Destructor. | |
bool | getLastJointFault (int j, int &fault, std::string &message) override |
![]() | |
virtual | ~IJointFault () |
![]() | |
ImplementAxisInfo (yarp::dev::IAxisInfoRaw *y) | |
virtual | ~ImplementAxisInfo () |
bool | getAxes (int *ax) override |
Get the number of controlled axes. | |
bool | getAxisName (int axis, std::string &name) override |
bool | getJointType (int axis, yarp::dev::JointTypeEnum &type) override |
![]() | |
virtual | ~IAxisInfo () |
Destructor. | |
![]() | |
ImplementEncodersTimed (yarp::dev::IEncodersTimedRaw *y) | |
virtual | ~ImplementEncodersTimed () |
bool | getAxes (int *ax) override |
Get the number of controlled axes. | |
bool | resetEncoder (int j) override |
Reset encoder, single joint. | |
bool | resetEncoders () override |
Reset encoders. | |
bool | setEncoder (int j, double val) override |
Set the value of the encoder for a given joint. | |
bool | setEncoders (const double *vals) override |
Set the value of all encoders. | |
bool | getEncoder (int j, double *v) override |
Read the value of an encoder. | |
bool | getEncodersTimed (double *encs, double *time) override |
Read the instantaneous acceleration of all axes. | |
bool | getEncoderTimed (int j, double *v, double *t) override |
Read the instantaneous acceleration of all axes. | |
bool | getEncoders (double *encs) override |
Read the position of all axes. | |
bool | getEncoderSpeed (int j, double *spds) override |
Read the istantaneous speed of an axis. | |
bool | getEncoderSpeeds (double *spds) override |
Read the instantaneous speed of all axes. | |
bool | getEncoderAcceleration (int j, double *spds) override |
Read the instantaneous acceleration of an axis. | |
bool | getEncoderAccelerations (double *accs) override |
Read the instantaneous acceleration of all axes. | |
![]() | |
virtual | ~IEncodersTimed () |
Destructor. | |
![]() | |
virtual | ~IEncoders () |
Destructor. | |
![]() | |
ImplementMotorEncoders (yarp::dev::IMotorEncodersRaw *y) | |
virtual | ~ImplementMotorEncoders () |
bool | getNumberOfMotorEncoders (int *num) override |
Get the number of available motor encoders. | |
bool | resetMotorEncoder (int m) override |
Reset motor encoder, single motor. | |
bool | resetMotorEncoders () override |
Reset motor encoders. | |
bool | setMotorEncoder (int m, const double val) override |
Set the value of the motor encoder for a given motor. | |
bool | setMotorEncoders (const double *vals) override |
Set the value of all motor encoders. | |
bool | setMotorEncoderCountsPerRevolution (int m, const double cpr) override |
Sets number of counts per revolution for motor encoder m. | |
bool | getMotorEncoderCountsPerRevolution (int m, double *cpr) override |
Gets number of counts per revolution for motor encoder m. | |
bool | getMotorEncoder (int m, double *v) override |
Read the value of a motor encoder. | |
bool | getMotorEncodersTimed (double *encs, double *time) override |
Read the instantaneous position of all motor encoders. | |
bool | getMotorEncoderTimed (int m, double *v, double *t) override |
Read the instantaneous position of a motor encoder. | |
bool | getMotorEncoders (double *encs) override |
Read the position of all motor encoders. | |
bool | getMotorEncoderSpeed (int m, double *spds) override |
Read the istantaneous speed of a motor encoder. | |
bool | getMotorEncoderSpeeds (double *spds) override |
Read the instantaneous speed of all motor encoders. | |
bool | getMotorEncoderAcceleration (int m, double *spds) override |
Read the instantaneous acceleration of a motor encoder. | |
bool | getMotorEncoderAccelerations (double *accs) override |
Read the instantaneous acceleration of all motor encoders. | |
![]() | |
virtual | ~IMotorEncoders () |
Destructor. | |
![]() | |
FakeMotionControlMicro_ParamsParser () | |
~FakeMotionControlMicro_ParamsParser () override=default | |
bool | parseParams (const yarp::os::Searchable &config) override |
Parse the DeviceDriver parameters. | |
std::string | getDeviceClassName () const override |
Get the name of the DeviceDriver class. | |
std::string | getDeviceName () const override |
Get the name of the device (i.e. | |
std::string | getDocumentationOfDeviceParams () const override |
Get the documentation of the DeviceDriver's parameters. | |
std::vector< std::string > | getListOfParams () const override |
Return a list of all params used by the device. | |
![]() | |
virtual | ~IDeviceDriverParams () |
Additional Inherited Members | |
![]() | |
const std::string | m_device_classname = {"FakeMotionControlMicro"} |
const std::string | m_device_name = {"fakeMotionControlMicro"} |
bool | m_parser_is_strict = false |
const parser_version_type | m_parser_version = {} |
const std::string | m_GENERAL_Joints_defaultValue = {"1"} |
const std::string | m_GENERAL_AxisMap_defaultValue = {""} |
const std::string | m_GENERAL_AxisName_defaultValue = {""} |
const std::string | m_GENERAL_AxisType_defaultValue = {""} |
const std::string | m_GENERAL_Encoder_defaultValue = {""} |
int | m_GENERAL_Joints = {1} |
std::vector< int > | m_GENERAL_AxisMap = {} |
std::vector< std::string > | m_GENERAL_AxisName = {} |
std::vector< std::string > | m_GENERAL_AxisType = {} |
std::vector< int > | m_GENERAL_Encoder = {} |
![]() | |
virtual void | beforeStart () |
Called just before a new thread starts. | |
virtual void | afterStart (bool success) |
Called just after a new thread starts (or fails to start), this is executed by the same thread that calls start(). | |
![]() | |
bool | initialize (int size, const int *amap) |
Initialize the internal data and alloc memory. | |
bool | uninitialize () |
Clean up internal data and memory. | |
![]() | |
bool | initialize (int size, const int *amap) |
Initialize the internal data and alloc memory. | |
bool | uninitialize () |
Clean up internal data and memory. | |
![]() | |
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. | |
![]() | |
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. | |
![]() | |
yarp::dev::IJointFaultRaw * | raw |
void * | helper |
![]() | |
IAxisInfoRaw * | iinfo |
void * | helper |
double * | temp1 |
double * | temp2 |
![]() | |
IEncodersTimedRaw * | iEncoders |
void * | helper |
yarp::dev::impl::FixedSizeBuffersManager< double > * | buffManager |
![]() | |
IMotorEncodersRaw * | iMotorEncoders |
void * | helper |
yarp::dev::impl::FixedSizeBuffersManager< double > * | buffManager |
fakeMotionControlMicro
: This device implements a minimal subset of mandatory interfaces to run with controlBoard_nws_yarp.
It is thus a smaller, limited version than fakeMotionControl.
Parameters required by this device are shown in class: FakeMotionControlMicro_ParamsParser
Definition at line 30 of file FakeMotionControlMicro.h.
FakeMotionControlMicro::FakeMotionControlMicro | ( | ) |
Definition at line 145 of file FakeMotionControlMicro.cpp.
FakeMotionControlMicro::~FakeMotionControlMicro | ( | ) |
Definition at line 169 of file FakeMotionControlMicro.cpp.
Allocated buffers.
Definition at line 112 of file FakeMotionControlMicro.cpp.
|
overridevirtual |
Close the DeviceDriver.
Reimplemented from yarp::dev::DeviceDriver.
Definition at line 330 of file FakeMotionControlMicro.cpp.
bool FakeMotionControlMicro::fromConfig | ( | yarp::os::Searchable & | config | ) |
Definition at line 247 of file FakeMotionControlMicro.cpp.
Get the number of controlled axes.
This command asks the number of controlled axes for the current physical interface.
Implements yarp::dev::IEncodersRaw.
Definition at line 602 of file FakeMotionControlMicro.cpp.
Implements yarp::dev::IAxisInfoRaw.
Definition at line 566 of file FakeMotionControlMicro.cpp.
Read the instantaneous acceleration of an axis.
j | axis number |
spds | pointer to the array that will contain the output |
Implements yarp::dev::IEncodersRaw.
Definition at line 414 of file FakeMotionControlMicro.cpp.
Read the instantaneous acceleration of all axes.
accs | pointer to the array that will contain the output |
Implements yarp::dev::IEncodersRaw.
Definition at line 422 of file FakeMotionControlMicro.cpp.
Read the value of an encoder.
j | encoder number |
v | pointer to storage for the return value |
Implements yarp::dev::IEncodersRaw.
Definition at line 374 of file FakeMotionControlMicro.cpp.
Read the instantaneous speed of an axis.
j | axis number |
sp | pointer to storage for the output |
Implements yarp::dev::IEncodersRaw.
Definition at line 397 of file FakeMotionControlMicro.cpp.
Read the instantaneous acceleration of an axis.
spds | pointer to storage for the output values |
Implements yarp::dev::IEncodersRaw.
Definition at line 404 of file FakeMotionControlMicro.cpp.
Read the position of all axes.
encs | pointer to the array that will contain the output |
Implements yarp::dev::IEncodersRaw.
Definition at line 385 of file FakeMotionControlMicro.cpp.
Read the instantaneous acceleration of all axes.
encs | pointer to the array that will contain the output |
stamps | pointer to the array that will contain individual timestamps |
Implements yarp::dev::IEncodersTimedRaw.
Definition at line 434 of file FakeMotionControlMicro.cpp.
|
overridevirtual |
Read the instantaneous acceleration of all axes.
j | axis index |
encs | encoder value |
stamp | corresponding timestamp |
Implements yarp::dev::IEncodersTimedRaw.
Definition at line 445 of file FakeMotionControlMicro.cpp.
|
overridevirtual |
Reimplemented from yarp::dev::IAxisInfoRaw.
Definition at line 580 of file FakeMotionControlMicro.cpp.
|
overridevirtual |
Implements yarp::dev::IJointFaultRaw.
Definition at line 593 of file FakeMotionControlMicro.cpp.
|
overridevirtual |
Read the instantaneous acceleration of a motor encoder.
m | motor number |
acc | pointer to the array that will contain the output |
Implements yarp::dev::IMotorEncodersRaw.
Definition at line 526 of file FakeMotionControlMicro.cpp.
Read the instantaneous acceleration of all motor encoders.
accs | pointer to the array that will contain the output |
Implements yarp::dev::IMotorEncodersRaw.
Definition at line 532 of file FakeMotionControlMicro.cpp.
|
overridevirtual |
Gets number of counts per revolution for motor encoder m.
m | motor number |
cpr | vals pointer to the new value |
Implements yarp::dev::IMotorEncodersRaw.
Definition at line 478 of file FakeMotionControlMicro.cpp.
Read the value of a motor encoder.
m | motor encoder number |
v | pointer to storage for the return value |
Implements yarp::dev::IMotorEncodersRaw.
Definition at line 493 of file FakeMotionControlMicro.cpp.
Read the istantaneous speed of a motor encoder.
m | motor number |
sp | pointer to storage for the output |
Implements yarp::dev::IMotorEncodersRaw.
Definition at line 510 of file FakeMotionControlMicro.cpp.
Read the instantaneous speed of all motor encoders.
spds | pointer to storage for the output values |
Implements yarp::dev::IMotorEncodersRaw.
Definition at line 516 of file FakeMotionControlMicro.cpp.
Read the position of all motor encoders.
encs | pointer to the array that will contain the output |
Implements yarp::dev::IMotorEncodersRaw.
Definition at line 499 of file FakeMotionControlMicro.cpp.
|
overridevirtual |
Read the instantaneous position of all motor encoders.
encs | pointer to the array that will contain the output |
time | pointer to the array that will contain individual timestamps |
Implements yarp::dev::IMotorEncodersRaw.
Definition at line 542 of file FakeMotionControlMicro.cpp.
|
overridevirtual |
Read the instantaneous position of a motor encoder.
m | motor index |
encs | encoder value (pointer to) |
time | corresponding timestamp (pointer to) |
Implements yarp::dev::IMotorEncodersRaw.
Definition at line 554 of file FakeMotionControlMicro.cpp.
Get the number of available motor encoders.
m | pointer to a value representing the number of available motor encoders. |
Implements yarp::dev::IMotorEncodersRaw.
Definition at line 457 of file FakeMotionControlMicro.cpp.
|
virtual |
Definition at line 175 of file FakeMotionControlMicro.cpp.
|
overridevirtual |
Open the DeviceDriver.
config | is a list of parameters for the device. Which parameters are effective for your device can vary. See device invocation examples. If there is no example for your device, you can run the "yarpdev" program with the verbose flag set to probe what parameters the device is checking. If that fails too, you'll need to read the source code (please nag one of the yarp developers to add documentation for your device). |
Reimplemented from yarp::dev::DeviceDriver.
Definition at line 195 of file FakeMotionControlMicro.cpp.
Reset encoder, single joint.
Set the encoder value to zero
j | encoder number |
Implements yarp::dev::IEncodersRaw.
Definition at line 364 of file FakeMotionControlMicro.cpp.
|
overridevirtual |
Reset encoders.
Set the encoders value to zero
Implements yarp::dev::IEncodersRaw.
Definition at line 369 of file FakeMotionControlMicro.cpp.
Reset motor encoder, single motor.
Set the encoder value to zero.
m | motor number |
Implements yarp::dev::IMotorEncodersRaw.
Definition at line 483 of file FakeMotionControlMicro.cpp.
|
overridevirtual |
Reset motor encoders.
Set the motor encoders value to zero.
Implements yarp::dev::IMotorEncodersRaw.
Definition at line 488 of file FakeMotionControlMicro.cpp.
void FakeMotionControlMicro::resizeBuffers | ( | ) |
Resize previously allocated buffers.
Definition at line 93 of file FakeMotionControlMicro.cpp.
|
overridevirtual |
Loop function.
This is the thread itself. The thread calls the run() function every <period> ms. At the end of each run, the thread will sleep the amounth of time required, taking into account the time spent inside the loop function. Example: requested period is 10ms, the run() function take 3ms to be executed, the thread will sleep for 7ms.
Note: after each run is completed, the thread will call a yield() in order to facilitate other threads to run.
Implements yarp::os::PeriodicThread.
Definition at line 34 of file FakeMotionControlMicro.cpp.
Set the value of the encoder for a given joint.
j | encoder number |
val | new value |
Implements yarp::dev::IEncodersRaw.
Definition at line 354 of file FakeMotionControlMicro.cpp.
Set the value of all encoders.
vals | pointer to the new values |
Implements yarp::dev::IEncodersRaw.
Definition at line 359 of file FakeMotionControlMicro.cpp.
|
overridevirtual |
Sets number of counts per revolution for motor encoder m.
m | motor number |
cpr | new value |
Implements yarp::dev::IMotorEncodersRaw.
Definition at line 473 of file FakeMotionControlMicro.cpp.
Set the value of the motor encoder for a given motor.
m | motor number |
val | new value |
Implements yarp::dev::IMotorEncodersRaw.
Definition at line 463 of file FakeMotionControlMicro.cpp.
Set the value of all motor encoders.
vals | pointer to the new values |
Implements yarp::dev::IMotorEncodersRaw.
Definition at line 468 of file FakeMotionControlMicro.cpp.
|
overridevirtual |
Initialization method.
The thread executes this function when it starts and before "run". This is a good place to perform initialization tasks that need to be done by the thread itself (device drivers initialization, memory allocation etc). If the function returns false the thread quits and never calls "run". The return value of threadInit() is notified to the class and passed as a parameter to afterStart(). Note that afterStart() is called by the same thread that is executing the "start" method.
Reimplemented from yarp::os::PeriodicThread.
Definition at line 180 of file FakeMotionControlMicro.cpp.
|
overridevirtual |
Release method.
The thread executes this function once when it exits, after the last "run". This is a good place to release resources that were initialized in threadInit() (release memory, and device driver resources).
Reimplemented from yarp::os::PeriodicThread.
Definition at line 191 of file FakeMotionControlMicro.cpp.