6 #ifndef YARP_DEV_CONTROLBOARDHELPER_H
7 #define YARP_DEV_CONTROLBOARDHELPER_H
14 #include <type_traits>
20 std::enable_if_t<std::is_trivial<T>::value,
int> = 0>
25 memset(
t, 0,
sizeof(T) * size);
30 std::enable_if_t<!std::is_trivial<T>::value,
int> = 0>
51 class ControlBoardHelper;
59 ControlBoardHelper(
int n,
const int *aMap,
const double *angToEncs =
nullptr,
const double *zs =
nullptr,
const double *newtons =
nullptr,
const double *amps =
nullptr,
const double *volts =
nullptr,
const double *dutycycles =
nullptr,
const double *kbemf =
nullptr,
const double *ktau =
nullptr);
66 bool checkAxesIds(
const int n_axes,
const int* axesList);
69 void toUser(
const double *hwData,
double *user);
70 void toUser(
const int *hwData,
int *user);
71 void toHw(
const double *usr,
double *hwData);
72 void toHw(
const int *usr,
int *hwData);
75 void posA2E(
double ang,
int j,
double &enc,
int &k);
76 double posA2E(
double ang,
int j);
77 void posE2A(
double enc,
int j,
double &ang,
int &k);
78 double posE2A(
double enc,
int j);
79 void posA2E(
const double *ang,
double *enc);
80 void posE2A(
const double *enc,
double *ang);
83 void velA2E(
double ang,
int j,
double &enc,
int &k);
84 double velA2E(
double ang,
int j);
85 void velA2E_abs(
double ang,
int j,
double &enc,
int &k);
86 void velE2A(
double enc,
int j,
double &ang,
int &k);
87 void velE2A_abs(
double enc,
int j,
double &ang,
int &k);
88 double velE2A(
double enc,
int j);
90 void velA2E(
const double *ang,
double *enc);
91 void velA2E_abs(
const double *ang,
double *enc);
92 void velE2A(
const double *enc,
double *ang);
93 void velE2A_abs(
const double *enc,
double *ang);
96 void accA2E(
double ang,
int j,
double &enc,
int &k);
97 void accA2E_abs(
double ang,
int j,
double &enc,
int &k);
98 void accE2A(
double enc,
int j,
double &ang,
int &k);
99 void accE2A_abs(
double enc,
int j,
double &ang,
int &k);
100 double accE2A(
double enc,
int j);
102 void accA2E(
const double *ang,
double *enc);
103 void accA2E_abs(
const double *ang,
double *enc);
104 void accE2A(
const double *enc,
double *ang);
105 void accE2A_abs(
const double *enc,
double *ang);
108 void trqN2S(
double newtons,
int j,
double &sens,
int &k);
109 double trqN2S(
double newtons,
int j);
110 void trqN2S(
const double *newtons,
double *sens);
111 void trqS2N(
const double *sens,
double *newtons);
112 void trqS2N(
double sens,
int j,
double &newton,
int &k);
113 double trqS2N(
double sens,
int j);
116 void impN2S(
double newtons,
int j,
double &sens,
int &k);
117 double impN2S(
double newtons,
int j);
118 void impN2S(
const double *newtons,
double *sens);
119 void impS2N(
const double *sens,
double *newtons);
120 void impS2N(
double sens,
int j,
double &newton,
int &k);
121 double impS2N(
double sens,
int j);
124 void ampereA2S(
double ampere,
int j,
double &sens,
int &k);
126 void ampereA2S(
const double *ampere,
double *sens);
127 void ampereS2A(
const double *sens,
double *ampere);
128 void ampereS2A(
double sens,
int j,
double &ere,
int &k);
132 void voltageV2S(
double voltage,
int j,
double &sens,
int &k);
134 void voltageV2S(
const double *voltage,
double *sens);
135 void voltageS2V(
const double *sens,
double *voltage);
136 void voltageS2V(
double sens,
int j,
double &voltage,
int &k);
140 void dutycycle2PWM(
double dutycycle,
int j,
double &pwm,
int &k);
144 void PWM2dutycycle(
double pwm_raw,
int k_raw,
double &dutycycle,
int &j);
150 void bemf_user2raw(
double bemf_user,
int j,
double &bemf_raw,
int &k);
151 void ktau_user2raw(
double ktau_user,
int j,
double &ktau_raw,
int &k);
152 void bemf_raw2user(
double bemf_raw,
int k_raw,
double &bemf_user,
int &j_user);
153 void ktau_raw2user(
double ktau_raw,
int k_raw,
double &ktau_user,
int &j_user);
void checkAndDestroy(T *&p)
yarp::dev::ControlBoardHelper * castToMapper(void *p)
T * allocAndCheck(int size)
define control board standard interfaces
double get_pidfeedback_conversion_factor_user2raw(const yarp::dev::PidControlTypeEnum &pidtype, int j)
void accE2A(double enc, int j, double &ang, int &k)
void convert_pid_to_user(const yarp::dev::PidControlTypeEnum &pidtype, const Pid &in_raw, int j_raw, Pid &out_usr, int &k_usr)
void ktau_raw2user(double ktau_raw, int k_raw, double &ktau_user, int &j_user)
void trqN2S(double newtons, int j, double &sens, int &k)
void velE2A_abs(double enc, int j, double &ang, int &k)
void convert_pidunits_to_machine(const yarp::dev::PidControlTypeEnum &pidtype, double userval, int j, double &machineval, int &k)
void bemf_raw2user(double bemf_raw, int k_raw, double &bemf_user, int &j_user)
void voltageS2V(const double *sens, double *voltage)
void convert_pid_to_machine(const yarp::dev::PidControlTypeEnum &pidtype, const Pid &in_usr, int j_usr, Pid &out_raw, int &k_raw)
void ampereA2S(double ampere, int j, double &sens, int &k)
void impN2S(double newtons, int j, double &sens, int &k)
double ktau_user2raw(double ktau_user, int j)
void velE2A(double enc, int j, double &ang, int &k)
void velA2E(double ang, int j, double &enc, int &k)
void dutycycle2PWM(double dutycycle, int j, double &pwm, int &k)
void ampereS2A(const double *sens, double *ampere)
void posE2A(double enc, int j, double &ang, int &k)
void trqS2N(const double *sens, double *newtons)
double get_pidoutput_conversion_factor_user2raw(const yarp::dev::PidControlTypeEnum &pidtype, int j)
void set_pid_conversion_units(const PidControlTypeEnum &pidtype, const PidFeedbackUnitsEnum fbk_conv_units, const PidOutputUnitsEnum out_conv_units)
void toUser(const int *hwData, int *user)
void voltageV2S(double voltage, int j, double &sens, int &k)
ControlBoardHelper & operator=(const ControlBoardHelper &other)
double bemf_user2raw(double bemf_user, int j)
void accA2E_abs(double ang, int j, double &enc, int &k)
void accA2E(double ang, int j, double &enc, int &k)
void accE2A_abs(double enc, int j, double &ang, int &k)
void velA2E_abs(double ang, int j, double &enc, int &k)
ControlBoardHelper(int n, const int *aMap, const double *angToEncs=nullptr, const double *zs=nullptr, const double *newtons=nullptr, const double *amps=nullptr, const double *volts=nullptr, const double *dutycycles=nullptr, const double *kbemf=nullptr, const double *ktau=nullptr)
void convert_pidunits_to_user(const yarp::dev::PidControlTypeEnum &pidtype, const double machineval, double *userval, int k)
void impS2N(const double *sens, double *newtons)
void PWM2dutycycle(const double *pwm, double *dutycycle)
bool checkAxesIds(const int n_axes, const int *axesList)
void posA2E(double ang, int j, double &enc, int &k)
Contains the parameters for a PID.
The main, catch-all namespace for YARP.