14#ifndef __YARPEsdMessageSnifferh__
15#define __YARPEsdMessageSnifferh__
18#include <condition_variable>
20#include <yarp/dev/DeviceDriver.h>
21#include <yarp/dev/ControlBoardInterfaces.h>
22#include <yarp/dev/ControlBoardInterfacesImpl.h>
23#include <yarp/os/Thread.h>
27 class EsdMessageSniffer;
28 struct EsdMessageSnifferParameters;
63 int (*
_p) (
const char *fmt, ...);
80 public IPidControlRaw,
81 public IAmplifierControlRaw,
83 public ImplementPidControl<EsdMessageSniffer, IPidControl>,
84 public ImplementAmplifierControl<EsdMessageSniffer, IAmplifierControl>,
85 public ImplementEncoders<EsdMessageSniffer, IEncoders>
93 fprintf(stderr,
"%s not yet implemented for EsdMotionControl\n", txt);
121 virtual bool open(yarp::os::Searchable& config);
127 virtual bool close(
void);
135 virtual bool getAxes(
int *axis);
259 inline bool ENABLED (
int axis);
264 int (*
_p) (
const char *fmt, ...);
266 virtual void run(
void);
271 bool _readWord16 (
int msg,
int axis,
short& value);
273 bool _readDWord (
int msg,
int axis,
int& value);
289 return short(
x + .5);
The EsdMessageSniffer device driver.
virtual bool setEncodersRaw(const double *vals)
virtual bool close(void)
Close the device driver.
short S_16(double x) const
virtual bool setErrorLimitsRaw(const double *limits)
virtual bool getAmpStatusRaw(int *st)
bool getBCastPositionErrors(double *cmd)
virtual bool getEncoderSpeedRaw(int j, double *sp)
virtual bool getEncodersRaw(double *encs)
Read the position of all axes.
bool getBCastPositions(double *p)
bool setDebugPrintFunction(void *cmd)
int(* _p)(const char *fmt,...)
pointer to the function printing the device debug information.
virtual bool resetEncoderRaw(int j)
virtual bool enableAmpRaw(int j)
virtual bool setEncoderRaw(int j, double val)
virtual bool enablePidRaw(int j)
virtual bool disableAmpRaw(int j)
virtual bool setOffsetRaw(int j, double v)
virtual bool resetEncodersRaw()
bool _readWord16(int msg, int axis, short &value)
virtual bool open(EsdMessageSnifferParameters ¶ms)
Open the device driver.
virtual bool getEncoderSpeedsRaw(double *spds)
EsdMessageSniffer()
Constructor.
virtual bool setReferencesRaw(const double *refs)
std::condition_variable cv_done
bool getBCastCurrents(double *p)
virtual ~EsdMessageSniffer()
Destructor.
virtual bool setReferenceRaw(int j, double ref)
virtual bool setPidsRaw(const Pid *pids)
bool _readWord16Array(int msg, double *out)
reads an array.
virtual bool disablePidRaw(int j)
virtual bool getCurrentRaw(int j, double *val)
Read the electric current going to a given motor.
virtual bool getOutputsRaw(double *outs)
Get the output of the controllers (e.g.
virtual bool setErrorLimitRaw(int j, double limit)
virtual bool getCurrentsRaw(double *vals)
Read the electric current going to all motors.
bool _writeDWord(int msg, int axis, int value)
write a DWord
virtual bool getEncoderRaw(int j, double *v)
Read the value of an encoder.
virtual bool setPidRaw(int j, const Pid &pid)
bool getBCastFaults(int *p)
virtual bool getReferencesRaw(double *refs)
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).
virtual bool getAxes(int *axis)
Get the number of controlled axes.
virtual bool getPidRaw(int j, Pid *pid)
virtual bool setMaxCurrentRaw(int j, double v)
virtual bool getErrorLimitsRaw(double *limits)
virtual bool getPidsRaw(Pid *pids)
bool getBCastPIDOutput(int i, double *value)
virtual bool getEncoderAccelerationsRaw(double *accs)
bool getBCastCurrent(int i, double *value)
bool _readDWordArray(int msg, double *out)
reads an array of double words.
virtual bool resetPidRaw(int j)
virtual bool getEncoderAccelerationRaw(int j, double *spds)
bool getBCastPosition(int i, double *value)
reads an array of double from the broadcast message position buffer.
virtual bool getOutputRaw(int j, double *out)
Get the output of the controller (e.g.
virtual bool getErrorsRaw(double *errs)
Get the error of all joints.
bool _writeNone(int msg, int axis)
helper functions.
bool NOT_YET_IMPLEMENTED(const char *txt)
bool ENABLED(int axis)
helper function to check whether the enabled flag is on or off.
virtual bool getReferenceRaw(int j, double *ref)
virtual bool getErrorRaw(int j, double *err)
Get the current error for a joint.
virtual bool getErrorLimitRaw(int j, double *limit)
bool getBCastPIDOutputs(double *p)
bool _writeWord16(int msg, int axis, short s)
helper functions
bool _readDWord(int msg, int axis, int &value)
sends a message and gets a dword back.
bool setBCastMessages(int i, int value)
sets the broadcast policy for a given board (don't need to be called twice).
bool getBCastPositionError(int i, double *value)
Copyright (C) 2008 RobotCub Consortium.
A container class to pass parameters to the open() method of the device driver.
int _njoints
network number
unsigned char _my_address
number of joints (cards * 2)
int _timeout
thread polling interval [ms]
int(* _p)(const char *fmt,...)
number of cycles before timing out
int _polling_interval
my address
~EsdMessageSnifferParameters()
Destructor.
unsigned char * _destinations
printf-like function for spying messages
int * _axisMap
destination addresses
double * _zeros
angle to encoder conversion factors
double * _angleToEncoder
axis remapping lookup-table