iCub-main
|
The EsdMessageSniffer device driver. More...
#include <EsdMessageSniffer.h>
Public Member Functions | |
EsdMessageSniffer () | |
Constructor. More... | |
virtual | ~EsdMessageSniffer () |
Destructor. More... | |
virtual bool | open (EsdMessageSnifferParameters ¶ms) |
Open the device driver. More... | |
virtual bool | open (yarp::os::Searchable &config) |
Open the device driver and start communication with the hardware. More... | |
virtual bool | close (void) |
Close the device driver. More... | |
virtual bool | getAxes (int *axis) |
Get the number of controlled axes. More... | |
virtual bool | resetEncoderRaw (int j) |
virtual bool | resetEncodersRaw () |
virtual bool | setEncoderRaw (int j, double val) |
virtual bool | setEncodersRaw (const double *vals) |
virtual bool | getEncoderSpeedRaw (int j, double *sp) |
virtual bool | getEncoderSpeedsRaw (double *spds) |
virtual bool | getEncoderAccelerationRaw (int j, double *spds) |
virtual bool | getEncoderAccelerationsRaw (double *accs) |
virtual bool | getEncoderRaw (int j, double *v) |
Read the value of an encoder. More... | |
virtual bool | getEncodersRaw (double *encs) |
Read the position of all axes. More... | |
virtual bool | getErrorRaw (int j, double *err) |
Get the current error for a joint. More... | |
virtual bool | getErrorsRaw (double *errs) |
Get the error of all joints. More... | |
virtual bool | getOutputRaw (int j, double *out) |
Get the output of the controller (e.g. More... | |
virtual bool | getOutputsRaw (double *outs) |
Get the output of the controllers (e.g. More... | |
virtual bool | setPidRaw (int j, const Pid &pid) |
virtual bool | setPidsRaw (const Pid *pids) |
virtual bool | setReferenceRaw (int j, double ref) |
virtual bool | setReferencesRaw (const double *refs) |
virtual bool | setErrorLimitRaw (int j, double limit) |
virtual bool | setErrorLimitsRaw (const double *limits) |
virtual bool | getPidRaw (int j, Pid *pid) |
virtual bool | getPidsRaw (Pid *pids) |
virtual bool | getReferenceRaw (int j, double *ref) |
virtual bool | getReferencesRaw (double *refs) |
virtual bool | getErrorLimitRaw (int j, double *limit) |
virtual bool | getErrorLimitsRaw (double *limits) |
virtual bool | resetPidRaw (int j) |
virtual bool | disablePidRaw (int j) |
virtual bool | enablePidRaw (int j) |
virtual bool | setOffsetRaw (int j, double v) |
virtual bool | getCurrentsRaw (double *vals) |
Read the electric current going to all motors. More... | |
virtual bool | getCurrentRaw (int j, double *val) |
Read the electric current going to a given motor. More... | |
virtual bool | getAmpStatusRaw (int *st) |
virtual bool | enableAmpRaw (int j) |
virtual bool | disableAmpRaw (int j) |
virtual bool | setMaxCurrentRaw (int j, double v) |
Protected Types | |
enum | { MAX_SHORT = 32767 , MIN_SHORT = -32768 , MAX_INT = 0x7fffffff , MIN_INT = 0x80000000 } |
enum | { ESD_CAN_SKIP_ADDR = 0x80 } |
Protected Member Functions | |
bool | NOT_YET_IMPLEMENTED (const char *txt) |
bool | setBCastMessages (int i, int value) |
sets the broadcast policy for a given board (don't need to be called twice). More... | |
bool | getBCastPositions (double *p) |
bool | getBCastPosition (int i, double *value) |
reads an array of double from the broadcast message position buffer. More... | |
bool | getBCastPIDOutput (int i, double *value) |
bool | getBCastPIDOutputs (double *p) |
bool | getBCastCurrent (int i, double *value) |
bool | getBCastCurrents (double *p) |
bool | getBCastFaults (int *p) |
bool | getBCastPositionError (int i, double *value) |
bool | getBCastPositionErrors (double *cmd) |
bool | setDebugPrintFunction (void *cmd) |
bool | ENABLED (int axis) |
helper function to check whether the enabled flag is on or off. More... | |
virtual void | run (void) |
bool | _writeWord16 (int msg, int axis, short s) |
helper functions More... | |
bool | _writeWord16Ex (int msg, int axis, short s1, short s2) |
two shorts in a single Can message (both must belong to the same control card). More... | |
bool | _readWord16 (int msg, int axis, short &value) |
bool | _readWord16Array (int msg, double *out) |
reads an array. More... | |
bool | _readDWord (int msg, int axis, int &value) |
sends a message and gets a dword back. More... | |
bool | _readDWordArray (int msg, double *out) |
reads an array of double words. More... | |
bool | _writeDWord (int msg, int axis, int value) |
write a DWord More... | |
bool | _writeNone (int msg, int axis) |
helper functions. More... | |
short | S_16 (double x) const |
int | S_32 (double x) const |
Protected Attributes | |
void * | system_resources |
std::mutex | _mutex |
std::mutex | mtx_done |
std::condition_variable | cv_done |
bool | _writerequested |
bool | _noreply |
int(* | _p )(const char *fmt,...) |
pointer to the function printing the device debug information. More... | |
The EsdMessageSniffer device driver.
Poll the CAN bus for incoming broadcast messages and make them available through appropriate interfaces.
Definition at line 77 of file EsdMessageSniffer.h.
|
protected |
Enumerator | |
---|---|
MAX_SHORT | |
MIN_SHORT | |
MAX_INT | |
MIN_INT |
Definition at line 278 of file EsdMessageSniffer.h.
|
protected |
Enumerator | |
---|---|
ESD_CAN_SKIP_ADDR |
Definition at line 279 of file EsdMessageSniffer.h.
EsdMessageSniffer::EsdMessageSniffer | ( | void | ) |
Constructor.
Definition at line 411 of file EsdMessageSniffer.cpp.
|
virtual |
Destructor.
Definition at line 421 of file EsdMessageSniffer.cpp.
|
protected |
sends a message and gets a dword back.
Definition at line 1160 of file EsdMessageSniffer.cpp.
|
protected |
reads an array of double words.
Definition at line 1195 of file EsdMessageSniffer.cpp.
|
protected |
reads back position info.
Definition at line 973 of file EsdMessageSniffer.cpp.
|
protected |
reads an array.
Definition at line 1009 of file EsdMessageSniffer.cpp.
|
protected |
|
protected |
helper functions.
sends a message without parameters
syncing.
Definition at line 946 of file EsdMessageSniffer.cpp.
|
protected |
helper functions
to send a Word16.
prepare Can message.
syncing.
hopefully ok...
Definition at line 1064 of file EsdMessageSniffer.cpp.
|
protected |
two shorts in a single Can message (both must belong to the same control card).
prepare Can message.
axis is even.
syncing.
hopefully ok...
Definition at line 1124 of file EsdMessageSniffer.cpp.
|
virtual |
Close the device driver.
Definition at line 508 of file EsdMessageSniffer.cpp.
|
inlinevirtual |
Definition at line 226 of file EsdMessageSniffer.h.
|
inlinevirtual |
Definition at line 198 of file EsdMessageSniffer.h.
|
inlinevirtual |
Definition at line 225 of file EsdMessageSniffer.h.
|
inlineprotected |
helper function to check whether the enabled flag is on or off.
control card commands.
axis | is the axis to check for. |
Definition at line 805 of file EsdMessageSniffer.cpp.
|
inlinevirtual |
Definition at line 199 of file EsdMessageSniffer.h.
|
inlinevirtual |
Definition at line 223 of file EsdMessageSniffer.h.
|
virtual |
Get the number of controlled axes.
This command asks the number of controlled axes for the current physical interface.
axis | pointer to storage, return value |
Definition at line 812 of file EsdMessageSniffer.cpp.
|
protected |
Definition at line 878 of file EsdMessageSniffer.cpp.
|
protected |
Definition at line 888 of file EsdMessageSniffer.cpp.
|
protected |
Definition at line 901 of file EsdMessageSniffer.cpp.
|
protected |
Definition at line 856 of file EsdMessageSniffer.cpp.
|
protected |
Definition at line 866 of file EsdMessageSniffer.cpp.
|
protected |
reads an array of double from the broadcast message position buffer.
LATER: add a check of timing/error message.
Definition at line 834 of file EsdMessageSniffer.cpp.
|
protected |
Definition at line 914 of file EsdMessageSniffer.cpp.
|
protected |
Definition at line 925 of file EsdMessageSniffer.cpp.
|
protected |
Definition at line 844 of file EsdMessageSniffer.cpp.
|
inlinevirtual |
Read the electric current going to a given motor.
j | motor number |
val | pointer to storage for the output value |
Definition at line 215 of file EsdMessageSniffer.h.
|
inlinevirtual |
Read the electric current going to all motors.
vals | pointer to storage for the output values |
Definition at line 207 of file EsdMessageSniffer.h.
|
inlinevirtual |
Definition at line 143 of file EsdMessageSniffer.h.
|
inlinevirtual |
Definition at line 144 of file EsdMessageSniffer.h.
|
inlinevirtual |
Read the value of an encoder.
j | encoder number |
v | pointer to storage for the return value |
Definition at line 152 of file EsdMessageSniffer.h.
|
inlinevirtual |
Definition at line 141 of file EsdMessageSniffer.h.
|
inlinevirtual |
Definition at line 142 of file EsdMessageSniffer.h.
|
inlinevirtual |
Read the position of all axes.
encs | pointer to the array that will contain the output |
Definition at line 159 of file EsdMessageSniffer.h.
|
inlinevirtual |
Definition at line 195 of file EsdMessageSniffer.h.
|
inlinevirtual |
Definition at line 196 of file EsdMessageSniffer.h.
|
inlinevirtual |
Get the current error for a joint.
j | joint number |
err | pointer to the storage for the return value |
Definition at line 166 of file EsdMessageSniffer.h.
|
inlinevirtual |
Get the error of all joints.
errs | pointer to the vector that will store the errors |
Definition at line 171 of file EsdMessageSniffer.h.
|
inlinevirtual |
Get the output of the controller (e.g.
pwm value)
j | joint number |
out | pointer to storage for return value |
Definition at line 178 of file EsdMessageSniffer.h.
|
inlinevirtual |
Get the output of the controllers (e.g.
pwm value)
outs | pinter to the vector that will store the output values |
Definition at line 183 of file EsdMessageSniffer.h.
|
inlinevirtual |
Definition at line 191 of file EsdMessageSniffer.h.
|
inlinevirtual |
Definition at line 192 of file EsdMessageSniffer.h.
|
inlinevirtual |
Definition at line 193 of file EsdMessageSniffer.h.
|
inlinevirtual |
Definition at line 194 of file EsdMessageSniffer.h.
|
inlineprotected |
Definition at line 92 of file EsdMessageSniffer.h.
|
virtual |
Open the device driver.
params | is the parameter structure which is expected to be of type EsdMessageSnifferParameters. |
Definition at line 478 of file EsdMessageSniffer.cpp.
|
virtual |
Open the device driver and start communication with the hardware.
config | is a Searchable object containing the list of parameters. |
Definition at line 428 of file EsdMessageSniffer.cpp.
|
inlinevirtual |
Definition at line 137 of file EsdMessageSniffer.h.
|
inlinevirtual |
Definition at line 138 of file EsdMessageSniffer.h.
|
inlinevirtual |
Definition at line 197 of file EsdMessageSniffer.h.
|
protectedvirtual |
init part.
ok, init completed.
this requires a reply.
class 0 msg.
legitimate message directed here, checks whether replies to any message.
the pending msg doesn't require a reply.
timeout
complains.
tell the caller it can continue.
any write?
wait.
Definition at line 522 of file EsdMessageSniffer.cpp.
|
inlineprotected |
Definition at line 281 of file EsdMessageSniffer.h.
|
inlineprotected |
Definition at line 292 of file EsdMessageSniffer.h.
|
protected |
sets the broadcast policy for a given board (don't need to be called twice).
the parameter is a 32-bit integer: bit X = 1 -> message X = active e.g. 0x02 activates the broadcast of position information 0x04 activates the broadcast of velocity ...
Definition at line 824 of file EsdMessageSniffer.cpp.
|
protected |
Definition at line 792 of file EsdMessageSniffer.cpp.
|
inlinevirtual |
Definition at line 139 of file EsdMessageSniffer.h.
|
inlinevirtual |
Definition at line 140 of file EsdMessageSniffer.h.
|
inlinevirtual |
Definition at line 189 of file EsdMessageSniffer.h.
|
inlinevirtual |
Definition at line 190 of file EsdMessageSniffer.h.
|
inlinevirtual |
Definition at line 227 of file EsdMessageSniffer.h.
|
inlinevirtual |
Definition at line 200 of file EsdMessageSniffer.h.
|
inlinevirtual |
Definition at line 185 of file EsdMessageSniffer.h.
|
inlinevirtual |
Definition at line 186 of file EsdMessageSniffer.h.
|
inlinevirtual |
Definition at line 187 of file EsdMessageSniffer.h.
|
inlinevirtual |
Definition at line 188 of file EsdMessageSniffer.h.
|
protected |
Definition at line 246 of file EsdMessageSniffer.h.
|
protected |
Definition at line 251 of file EsdMessageSniffer.h.
|
protected |
pointer to the function printing the device debug information.
Definition at line 264 of file EsdMessageSniffer.h.
|
protected |
Definition at line 250 of file EsdMessageSniffer.h.
|
protected |
Definition at line 248 of file EsdMessageSniffer.h.
|
protected |
Definition at line 247 of file EsdMessageSniffer.h.
|
protected |
Definition at line 245 of file EsdMessageSniffer.h.