A fake motor control board for testing. More...
#include <fakeMotor/FakeMotor.h>
A fake motor control board for testing.
Implements the IPositionControl, IEncoders and IVelocityControl interfaces.
Definition at line 32 of file FakeMotor.h.
Public Member Functions | |
FakeMotor ()=default | |
FakeMotor (const FakeMotor &)=delete | |
FakeMotor (FakeMotor &&)=delete | |
FakeMotor & | operator= (const FakeMotor &)=delete |
FakeMotor & | operator= (FakeMotor &&)=delete |
~FakeMotor () override=default | |
bool | getAxes (int *ax) override |
Get the number of controlled axes. More... | |
bool | open (yarp::os::Searchable &config) override |
Open the DeviceDriver. More... | |
bool | positionMove (int j, double ref) override |
Set new reference point for a single axis. More... | |
bool | positionMove (const double *refs) override |
Set new reference point for all axes. More... | |
bool | relativeMove (int j, double delta) override |
Set relative position. More... | |
bool | relativeMove (const double *deltas) override |
Set relative position, all joints. More... | |
bool | checkMotionDone (int j, bool *flag) override |
Check if the current trajectory is terminated. More... | |
bool | checkMotionDone (bool *flag) override |
Check if the current trajectory is terminated. More... | |
bool | setRefSpeed (int j, double sp) override |
Set reference speed for a joint, this is the speed used during the interpolation of the trajectory. More... | |
bool | setRefSpeeds (const double *spds) override |
Set reference speed on all joints. More... | |
bool | setRefAcceleration (int j, double acc) override |
Set reference acceleration for a joint. More... | |
bool | setRefAccelerations (const double *accs) override |
Set reference acceleration on all joints. More... | |
bool | getRefSpeed (int j, double *ref) override |
Get reference speed for a joint. More... | |
bool | getRefSpeeds (double *spds) override |
Get reference speed of all joints. More... | |
bool | getRefAcceleration (int j, double *acc) override |
Get reference acceleration for a joint. More... | |
bool | getRefAccelerations (double *accs) override |
Get reference acceleration of all joints. More... | |
bool | stop (int j) override |
Stop motion, single joint. More... | |
bool | stop () override |
Stop motion, multiple joints. More... | |
bool | positionMove (const int n_joint, const int *joints, const double *refs) override |
Set new reference point for a subset of joints. More... | |
bool | relativeMove (const int n_joint, const int *joints, const double *deltas) override |
Set relative position for a subset of joints. More... | |
bool | checkMotionDone (const int n_joint, const int *joints, bool *flags) override |
Check if the current trajectory is terminated. More... | |
bool | setRefSpeeds (const int n_joint, const int *joints, const double *spds) override |
Set reference speed on all joints. More... | |
bool | setRefAccelerations (const int n_joint, const int *joints, const double *accs) override |
Set reference acceleration on all joints. More... | |
bool | getRefSpeeds (const int n_joint, const int *joints, double *spds) override |
Get reference speed of all joints. More... | |
bool | getRefAccelerations (const int n_joint, const int *joints, double *accs) override |
Get reference acceleration for a joint. More... | |
bool | stop (const int n_joint, const int *joints) override |
Stop motion for subset of joints. More... | |
bool | getTargetPosition (const int joint, double *ref) override |
Get the last position reference for the specified axis. More... | |
bool | getTargetPositions (double *refs) override |
Get the last position reference for all axes. More... | |
bool | getTargetPositions (const int n_joint, const int *joints, double *refs) override |
Get the last position reference for the specified group of axes. More... | |
bool | velocityMove (const int n_joint, const int *joints, const double *spds) override |
Start motion at a given speed for a subset of joints. More... | |
bool | close () override |
Close the DeviceDriver. More... | |
bool | resetEncoder (int j) override |
Reset encoder, single joint. More... | |
bool | resetEncoders () override |
Reset encoders. More... | |
bool | setEncoder (int j, double val) override |
Set the value of the encoder for a given joint. More... | |
bool | setEncoders (const double *vals) override |
Set the value of all encoders. More... | |
bool | getEncoder (int j, double *v) override |
Read the value of an encoder. More... | |
bool | getEncoders (double *encs) override |
Read the position of all axes. More... | |
bool | getEncoderTimed (int j, double *encs, double *time) override |
Read the instantaneous acceleration of all axes. More... | |
bool | getEncodersTimed (double *encs, double *time) override |
Read the instantaneous acceleration of all axes. More... | |
bool | getEncoderSpeed (int j, double *sp) override |
Read the istantaneous speed of an axis. More... | |
bool | getEncoderSpeeds (double *spds) override |
Read the instantaneous speed of all axes. More... | |
bool | getEncoderAcceleration (int j, double *spds) override |
Read the instantaneous acceleration of an axis. More... | |
bool | getEncoderAccelerations (double *accs) override |
Read the instantaneous acceleration of all axes. More... | |
bool | velocityMove (int j, double sp) override |
Start motion at a given speed, single joint. More... | |
bool | velocityMove (const double *sp) override |
Start motion at a given speed, multiple joints. More... | |
Public Member Functions inherited from yarp::dev::DeviceDriver | |
~DeviceDriver () override=default | |
Destructor. More... | |
template<class T > | |
bool | view (T *&x) |
Get an interface to the device driver. More... | |
virtual DeviceDriver * | getImplementation () |
Some drivers are bureaucrats, pointing at others. More... | |
Public Member Functions inherited from yarp::os::IConfig | |
virtual | ~IConfig () |
Destructor. More... | |
virtual bool | configure (Searchable &config) |
Change online parameters. More... | |
Public Member Functions inherited from yarp::dev::IPositionControl | |
virtual | ~IPositionControl () |
Destructor. More... | |
Public Member Functions inherited from yarp::dev::IEncodersTimed | |
virtual | ~IEncodersTimed () |
Destructor. More... | |
Public Member Functions inherited from yarp::dev::IEncoders | |
virtual | ~IEncoders () |
Destructor. More... | |
Public Member Functions inherited from yarp::dev::IVelocityControl | |
virtual | ~IVelocityControl () |
Destructor. More... | |
virtual bool | getRefVelocity (const int joint, double *vel) |
Get the last reference speed set by velocityMove for single joint. More... | |
virtual bool | getRefVelocities (double *vels) |
Get the last reference speed set by velocityMove for all joints. More... | |
virtual bool | getRefVelocities (const int n_joint, const int *joints, double *vels) |
Get the last reference speed set by velocityMove for a group of joints. More... | |
|
default |
|
delete |
|
delete |
|
overridedefault |
|
inlineoverridevirtual |
Check if the current trajectory is terminated.
Non blocking.
flag | is a pointer to return value ("and" of all joints) |
Implements yarp::dev::IPositionControl.
Definition at line 131 of file FakeMotor.h.
|
inlineoverridevirtual |
Check if the current trajectory is terminated.
Non blocking.
joints | pointer to the array of joint numbers |
flag | pointer to return value (logical "and" of all set of joints) |
Implements yarp::dev::IPositionControl.
Definition at line 230 of file FakeMotor.h.
|
inlineoverridevirtual |
Check if the current trajectory is terminated.
Non blocking.
j | is the axis number |
flag | is a pointer to return value |
Implements yarp::dev::IPositionControl.
Definition at line 124 of file FakeMotor.h.
|
inlineoverridevirtual |
Close the DeviceDriver.
Reimplemented from yarp::dev::DeviceDriver.
Definition at line 280 of file FakeMotor.h.
|
inlineoverridevirtual |
Get the number of controlled axes.
This command asks the number of controlled axes for the current physical interface.
ax | pointer to storage |
Implements yarp::dev::IPositionControl.
Definition at line 58 of file FakeMotor.h.
|
inlineoverridevirtual |
Read the value of an encoder.
j | encoder number |
v | pointer to storage for the return value |
Implements yarp::dev::IEncoders.
Definition at line 320 of file FakeMotor.h.
|
inlineoverridevirtual |
Read the instantaneous acceleration of an axis.
j | axis number |
spds | pointer to the array that will contain the output |
Implements yarp::dev::IEncoders.
Definition at line 371 of file FakeMotor.h.
|
inlineoverridevirtual |
Read the instantaneous acceleration of all axes.
accs | pointer to the array that will contain the output |
Implements yarp::dev::IEncoders.
Definition at line 379 of file FakeMotor.h.
|
inlineoverridevirtual |
Read the position of all axes.
encs | pointer to the array that will contain the output |
Implements yarp::dev::IEncoders.
Definition at line 329 of file FakeMotor.h.
|
inlineoverridevirtual |
Read the istantaneous speed of an axis.
j | axis number |
sp | pointer to storage for the output |
Implements yarp::dev::IEncoders.
Definition at line 355 of file FakeMotor.h.
|
inlineoverridevirtual |
Read the instantaneous speed of all axes.
spds | pointer to storage for the output values |
Implements yarp::dev::IEncoders.
Definition at line 363 of file FakeMotor.h.
|
inlineoverridevirtual |
Read the instantaneous acceleration of all axes.
encs | pointer to the array that will contain the output |
time | pointer to the array that will contain individual timestamps |
Implements yarp::dev::IEncodersTimed.
Definition at line 346 of file FakeMotor.h.
|
inlineoverridevirtual |
Read the instantaneous acceleration of all axes.
j | axis index |
encs | encoder value (pointer to) |
time | corresponding timestamp (pointer to) |
Implements yarp::dev::IEncodersTimed.
Definition at line 339 of file FakeMotor.h.
|
inlineoverridevirtual |
Get reference acceleration for a joint.
Returns the acceleration used to generate the trajectory profile.
j | joint number |
acc | pointer to storage for the return value |
Implements yarp::dev::IPositionControl.
Definition at line 191 of file FakeMotor.h.
|
inlineoverridevirtual |
Get reference acceleration for a joint.
Returns the acceleration used to generate the trajectory profile.
joints | pointer to the array of joint numbers |
accs | pointer to the array that will store the acceleration values |
Implements yarp::dev::IPositionControl.
Definition at line 250 of file FakeMotor.h.
|
inlineoverridevirtual |
Get reference acceleration of all joints.
These are the values used during the interpolation of the trajectory.
accs | pointer to the array that will store the acceleration values. |
Implements yarp::dev::IPositionControl.
Definition at line 200 of file FakeMotor.h.
|
inlineoverridevirtual |
Get reference speed for a joint.
Returns the speed used to generate the trajectory profile.
j | joint number |
ref | pointer to storage for the return value |
Implements yarp::dev::IPositionControl.
Definition at line 173 of file FakeMotor.h.
|
inlineoverridevirtual |
Get reference speed of all joints.
These are the values used during the interpolation of the trajectory.
joints | pointer to the array of joint numbers |
spds | pointer to the array that will store the speed values. |
Implements yarp::dev::IPositionControl.
Definition at line 245 of file FakeMotor.h.
|
inlineoverridevirtual |
Get reference speed of all joints.
These are the values used during the interpolation of the trajectory.
spds | pointer to the array that will store the speed values. |
Implements yarp::dev::IPositionControl.
Definition at line 182 of file FakeMotor.h.
|
inlineoverridevirtual |
Get the last position reference for the specified axis.
This is the dual of PositionMove and shall return only values sent using IPositionControl interface. If other interfaces like IPositionDirect are implemented by the device, this call must ignore their values, i.e. this call must never return a reference sent using IPositionDirect::SetPosition
ref | last reference sent using PositionMove functions |
Reimplemented from yarp::dev::IPositionControl.
Definition at line 260 of file FakeMotor.h.
|
inlineoverridevirtual |
Get the last position reference for the specified group of axes.
This is the dual of PositionMove and shall return only values sent using IPositionControl interface. If other interfaces like IPositionDirect are implemented by the device, this call must ignore their values, i.e. this call must never return a reference sent using IPositionDirect::SetPosition
ref | last reference sent using PositionMove functions |
Reimplemented from yarp::dev::IPositionControl.
Definition at line 270 of file FakeMotor.h.
|
inlineoverridevirtual |
Get the last position reference for all axes.
This is the dual of PositionMove and shall return only values sent using IPositionControl interface. If other interfaces like IPositionDirect are implemented by the device, this call must ignore their values, i.e. this call must never return a reference sent using IPositionDirect::SetPosition
ref | last reference sent using PositionMove functions |
Reimplemented from yarp::dev::IPositionControl.
Definition at line 265 of file FakeMotor.h.
|
inlineoverridevirtual |
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.
Reimplemented in TestMotor.
Definition at line 65 of file FakeMotor.h.
|
inlineoverridevirtual |
Set new reference point for all axes.
refs | array, new reference points. |
Implements yarp::dev::IPositionControl.
Definition at line 94 of file FakeMotor.h.
|
inlineoverridevirtual |
Set new reference point for a subset of joints.
joints | pointer to the array of joint numbers |
refs | pointer to the array specifying the new reference points |
Implements yarp::dev::IPositionControl.
Definition at line 220 of file FakeMotor.h.
|
inlineoverridevirtual |
Set new reference point for a single axis.
j | joint number |
ref | specifies the new ref point |
Implements yarp::dev::IPositionControl.
Definition at line 84 of file FakeMotor.h.
|
inlineoverridevirtual |
Set relative position, all joints.
deltas | pointer to the relative commands |
Implements yarp::dev::IPositionControl.
Definition at line 114 of file FakeMotor.h.
|
inlineoverridevirtual |
Set relative position for a subset of joints.
joints | pointer to the array of joint numbers |
deltas | pointer to the array of relative commands |
Implements yarp::dev::IPositionControl.
Definition at line 225 of file FakeMotor.h.
|
inlineoverridevirtual |
Set relative position.
The command is relative to the current position of the axis.
j | joint axis number |
delta | relative command |
Implements yarp::dev::IPositionControl.
Definition at line 104 of file FakeMotor.h.
|
inlineoverridevirtual |
Reset encoder, single joint.
Set the encoder value to zero
j | encoder number |
Implements yarp::dev::IEncoders.
Definition at line 285 of file FakeMotor.h.
|
inlineoverridevirtual |
Reset encoders.
Set the encoders value to zero
Implements yarp::dev::IEncoders.
Definition at line 293 of file FakeMotor.h.
|
inlineoverridevirtual |
Set the value of the encoder for a given joint.
j | encoder number |
val | new value |
Implements yarp::dev::IEncoders.
Definition at line 302 of file FakeMotor.h.
|
inlineoverridevirtual |
Set the value of all encoders.
vals | pointer to the new values |
Implements yarp::dev::IEncoders.
Definition at line 311 of file FakeMotor.h.
|
inlineoverridevirtual |
Set reference acceleration for a joint.
This value is used during the trajectory generation.
j | joint number |
acc | acceleration value |
Implements yarp::dev::IPositionControl.
Definition at line 155 of file FakeMotor.h.
|
inlineoverridevirtual |
Set reference acceleration on all joints.
This is the valure that is used during the generation of the trajectory.
accs | pointer to the array of acceleration values |
Implements yarp::dev::IPositionControl.
Definition at line 164 of file FakeMotor.h.
|
inlineoverridevirtual |
Set reference acceleration on all joints.
This is the valure that is used during the generation of the trajectory.
joints | pointer to the array of joint numbers |
accs | pointer to the array with acceleration values |
Implements yarp::dev::IPositionControl.
Definition at line 240 of file FakeMotor.h.
|
inlineoverridevirtual |
Set reference speed for a joint, this is the speed used during the interpolation of the trajectory.
j | joint number |
sp | speed value |
Implements yarp::dev::IPositionControl.
Definition at line 137 of file FakeMotor.h.
|
inlineoverridevirtual |
Set reference speed on all joints.
These values are used during the interpolation of the trajectory.
spds | pointer to the array of speed values. |
Implements yarp::dev::IPositionControl.
Definition at line 146 of file FakeMotor.h.
|
inlineoverridevirtual |
Set reference speed on all joints.
These values are used during the interpolation of the trajectory.
joints | pointer to the array of joint numbers |
spds | pointer to the array with speed values. |
Implements yarp::dev::IPositionControl.
Definition at line 235 of file FakeMotor.h.
|
inlineoverridevirtual |
Stop motion, multiple joints.
Implements yarp::dev::IPositionControl.
Definition at line 215 of file FakeMotor.h.
|
inlineoverridevirtual |
Stop motion for subset of joints.
joints | pointer to the array of joint numbers |
Implements yarp::dev::IPositionControl.
Definition at line 255 of file FakeMotor.h.
|
inlineoverridevirtual |
Stop motion, single joint.
j | joint number |
Implements yarp::dev::IPositionControl.
Definition at line 209 of file FakeMotor.h.
|
inlineoverridevirtual |
Start motion at a given speed, multiple joints.
sp | pointer to the array containing the new speed values |
Implements yarp::dev::IVelocityControl.
Definition at line 396 of file FakeMotor.h.
|
inlineoverridevirtual |
Start motion at a given speed for a subset of joints.
n_joint | how many joints this command is referring to |
joints | of joints controlled. The size of this array is n_joints |
spds | pointer to the array containing the new speed values, one value for each joint, the size of the array 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 spds 10 30 40 |
Implements yarp::dev::IVelocityControl.
Definition at line 275 of file FakeMotor.h.
|
inlineoverridevirtual |
Start motion at a given speed, single joint.
j | joint number |
sp | speed value |
Implements yarp::dev::IVelocityControl.
Definition at line 387 of file FakeMotor.h.