38#ifndef __DEBUGINTERFACES__
39#define __DEBUGINTERFACES__
47#define VOCAB_GENERIC_PARAMETER yarp::os::createVocab32('g','e','n','p')
48#define VOCAB_DEBUG_PARAMETER yarp::os::createVocab32('d','b','g','p')
59#define _YARP_ASSERT_DEBUG(x) { if (!(x)) { printf("memory allocation failure\n"); } }
65 _YARP_ASSERT (t != 0);
66 memset(t, 0,
sizeof(
T) * size);
81 ControlBoardHelper2(
int n,
const int *aMap,
const double *angToEncs,
const double *zs,
const double *nw,
const double *angToRot):
zeros(0),
95 memcpy(
zeros, zs,
sizeof(
double)*
nj);
97 memset(
zeros, 0,
sizeof(
double)*
nj);
117 for (i = 0; i <
nj; i++)
120 for (j = 0; j <
nj; j++)
160 checkAndDestroyDebug<double> (
zeros);
161 checkAndDestroyDebug<double> (
signs);
162 checkAndDestroyDebug<int> (
axisMap);
177 inline void toUser(
const double *hwData,
double *user)
179 for (
int k=0;k<
nj;k++)
180 user[
toUser(k)]=hwData[k];
184 inline void toUser(
const int *hwData,
int *user)
186 for (
int k=0;k<
nj;k++)
187 user[
toUser(k)]=hwData[k];
191 inline void toHw(
const double *usr,
double *hwData)
193 for (
int k=0;k<
nj;k++)
194 hwData[
toHw(k)]=usr[k];
198 inline void toHw(
const int *usr,
int *hwData)
200 for (
int k=0;k<
nj;k++)
201 hwData[
toHw(k)]=usr[k];
204 inline void posA2E(
double ang,
int j,
double &enc,
int &k)
215 inline void posE2A(
double enc,
int j,
double &ang,
int &k)
229 inline void posR2A(
double enc,
int j,
double &ang,
int &k)
243 inline void impN2S(
double newtons,
int j,
double &sens,
int &k)
249 inline double impN2S(
double newtons,
int j)
254 inline void impN2S(
const double *newtons,
double *sens)
258 for(
int j=0;j<
nj;j++)
260 impN2S(newtons[j], j, tmp, index);
265 inline void trqN2S(
double newtons,
int j,
double &sens,
int &k)
271 inline double trqN2S(
double newtons,
int j)
277 inline void trqN2S(
const double *newtons,
double *sens)
281 for(
int j=0;j<
nj;j++)
283 trqN2S(newtons[j], j, tmp, index);
289 inline void trqS2N(
const double *sens,
double *newtons)
293 for(
int j=0;j<
nj;j++)
295 trqS2N(sens[j], j, tmp, index);
300 inline void trqS2N(
double sens,
int j,
double &newton,
int &k)
314 inline void impS2N(
const double *sens,
double *newtons)
318 for(
int j=0;j<
nj;j++)
320 impS2N(sens[j], j, tmp, index);
325 inline void impS2N(
double sens,
int j,
double &newton,
int &k)
339 inline void velA2E(
double ang,
int j,
double &enc,
int &k)
345 inline void velA2E_abs(
double ang,
int j,
double &enc,
int &k)
351 inline void velE2A(
double enc,
int j,
double &ang,
int &k)
357 inline void velE2A_abs(
double enc,
int j,
double &ang,
int &k)
363 inline void accA2E(
double ang,
int j,
double &enc,
int &k)
368 inline void accA2E_abs(
double ang,
int j,
double &enc,
int &k)
373 inline void accE2A(
double enc,
int j,
double &ang,
int &k)
378 inline void accE2A_abs(
double enc,
int j,
double &ang,
int &k)
407 inline void posA2E(
const double *ang,
double *enc)
411 for(
int j=0;j<
nj;j++)
413 posA2E(ang[j], j, tmp, index);
419 inline void posE2A(
const double *enc,
double *ang)
423 for(
int j=0;j<
nj;j++)
425 posE2A(enc[j], j, tmp, index);
430 inline void velA2E(
const double *ang,
double *enc)
434 for(
int j=0;j<
nj;j++)
436 velA2E(ang[j], j, tmp, index);
445 for(
int j=0;j<
nj;j++)
452 inline void velE2A(
const double *enc,
double *ang)
456 for(
int j=0;j<
nj;j++)
458 velE2A(enc[j], j, tmp, index);
467 for(
int j=0;j<
nj;j++)
474 inline void accA2E(
const double *ang,
double *enc)
478 for(
int j=0;j<
nj;j++)
480 accA2E(ang[j], j, tmp, index);
489 for(
int j=0;j<
nj;j++)
496 inline void accE2A(
const double *enc,
double *ang)
500 for(
int j=0;j<
nj;j++)
502 accE2A(enc[j], j, tmp, index);
511 for(
int j=0;j<
nj;j++)
608 bool initialize(
int k,
const int *amap,
const double *angleToEncoder,
const double *
zeros,
const double *rotToEncoder);
612 bool setParameter (
int j,
unsigned int type,
double value);
613 bool getParameter (
int j,
unsigned int type,
double* value);
void checkAndDestroyDebug(T *&p)
ControlBoardHelper2 * castToMapper2(void *p)
#define _YARP_ASSERT_DEBUG(x)
T * allocAndCheckDebug(int size)
void toHw(const int *usr, int *hwData)
void accA2E_abs(const double *ang, double *enc)
void posE2A(const double *enc, double *ang)
void trqN2S(const double *newtons, double *sens)
void velE2A_abs(double enc, int j, double &ang, int &k)
void toUser(const double *hwData, double *user)
void impS2N(double sens, int j, double &newton, int &k)
void accA2E(double ang, int j, double &enc, int &k)
double posE2A(double enc, int j)
double posR2A(double enc, int j)
void posA2E(double ang, int j, double &enc, int &k)
void accE2A_abs(const double *enc, double *ang)
void accE2A(double enc, int j, double &ang, int &k)
void posA2E(const double *ang, double *enc)
double accE2A_abs(double enc, int j)
void trqN2S(double newtons, int j, double &sens, int &k)
void impN2S(const double *newtons, double *sens)
void velA2E_abs(const double *ang, double *enc)
double velE2A(double enc, int j)
void velE2A(double enc, int j, double &ang, int &k)
void velE2A_abs(const double *enc, double *ang)
double trqN2S(double newtons, int j)
double impN2S(double newtons, int j)
ControlBoardHelper2(int n, const int *aMap, const double *angToEncs, const double *zs, const double *nw, const double *angToRot)
void toHw(const double *usr, double *hwData)
void impN2S(double newtons, int j, double &sens, int &k)
void posR2A(double enc, int j, double &ang, int &k)
double posA2E(double ang, int j)
void toUser(const int *hwData, int *user)
void accA2E(const double *ang, double *enc)
void trqS2N(const double *sens, double *newtons)
void posE2A(double enc, int j, double &ang, int &k)
double * newtonsToSensors
double trqS2N(double sens, int j)
void accE2A_abs(double enc, int j, double &ang, int &k)
void velE2A(const double *enc, double *ang)
void impS2N(const double *sens, double *newtons)
void velA2E_abs(double ang, int j, double &enc, int &k)
void velA2E(const double *ang, double *enc)
void velA2E(double ang, int j, double &enc, int &k)
double accE2A(double enc, int j)
void accE2A(const double *enc, double *ang)
void accA2E_abs(double ang, int j, double &enc, int &k)
double velE2A_abs(double enc, int j)
void trqS2N(double sens, int j, double &newton, int &k)
double impS2N(double sens, int j)
virtual ~IDebugInterfaceRaw()
virtual bool setParameterRaw(int j, unsigned int type, double value)=0
virtual bool getParameterRaw(int j, unsigned int type, double *value)=0
virtual bool getDebugParameterRaw(int j, unsigned int index, double *value)=0
virtual bool setDebugParameterRaw(int j, unsigned int index, double value)=0
virtual bool getParameter(int j, unsigned int type, double *value)=0
virtual bool getDebugParameter(int j, unsigned int index, double *value)=0
virtual ~IDebugInterface()
virtual bool setDebugParameter(int j, unsigned int index, double value)=0
virtual bool setParameter(int j, unsigned int type, double value)=0
bool setDebugParameter(int j, unsigned int index, double value)
bool setParameter(int j, unsigned int type, double value)
bool initialize(int k, const int *amap, const double *angleToEncoder, const double *zeros, const double *rotToEncoder)
bool getDebugParameter(int j, unsigned int index, double *value)
bool getParameter(int j, unsigned int type, double *value)
~ImplementDebugInterface()
Copyright (C) 2008 RobotCub Consortium.