6#include "mechanism/pipe/ec_pipe_pdo.h"
7#include "mechanism/zmq/ec_zmq_pdo.h"
9 static const std::vector<std::string>name = {
"status_word",
10 "link_pos",
"motor_pos",
"link_vel",
11 "motor_vel",
"torque",
"current",
"motor_temp",
12 "board_temp",
"fault",
"fault_info",
"rtt",
13 "pos_ref_fb",
"vel_ref_fb",
"tor_ref_fb",
"curr_ref_fb"};
14 static const int pdo_size=16;
15 using pdo_t= std::tuple<uint32_t,float, float, float, float,float,float,float,float,uint32_t,std::array<char, 64>, uint32_t,float, float, float,
float>;
17 inline bool make_vector_from_tuple(
const pdo_t &pdo_tuple,std::vector<T> &pdo_vector){
18 if(pdo_vector.size()!=pdo_size){
21 pdo_vector[0]=
static_cast<T
>(std::get<0>(pdo_tuple));
22 pdo_vector[1]=
static_cast<T
>(std::get<1>(pdo_tuple));
23 pdo_vector[2]=
static_cast<T
>(std::get<2>(pdo_tuple));
24 pdo_vector[3]=
static_cast<T
>(std::get<3>(pdo_tuple));
25 pdo_vector[4]=
static_cast<T
>(std::get<4>(pdo_tuple));
26 pdo_vector[5]=
static_cast<T
>(std::get<5>(pdo_tuple));
27 pdo_vector[6]=
static_cast<T
>(std::get<6>(pdo_tuple));
28 pdo_vector[7]=
static_cast<T
>(std::get<7>(pdo_tuple));
29 pdo_vector[8]=
static_cast<T
>(std::get<8>(pdo_tuple));
30 pdo_vector[9]=
static_cast<T
>(std::get<9>(pdo_tuple));
32 pdo_vector[11]=
static_cast<T
>(std::get<11>(pdo_tuple));
33 pdo_vector[12]=
static_cast<T
>(std::get<12>(pdo_tuple));
34 pdo_vector[13]=
static_cast<T
>(std::get<13>(pdo_tuple));
35 pdo_vector[14]=
static_cast<T
>(std::get<14>(pdo_tuple));
36 pdo_vector[15]=
static_cast<T
>(std::get<15>(pdo_tuple));
42 static const std::vector<std::string>name = {
"ctrl_type",
"pos_ref",
"vel_ref",
"tor_ref",
43 "gains_0",
"gains_1",
"gains_2",
"gains_3",
"gains_4",
45 static const int pdo_size=12;
46 using pdo_t= std::tuple<int32_t,float, float, float, float,float,float,float,float,uint32_t, uint32_t, float>;
48 inline bool make_vector_from_tuple(
const pdo_t &pdo_tuple,std::vector<T> &pdo_vector){
49 if(pdo_vector.size()!=pdo_size){
52 pdo_vector[0]=
static_cast<T
>(std::get<0>(pdo_tuple));
53 pdo_vector[1]=
static_cast<T
>(std::get<1>(pdo_tuple));
54 pdo_vector[2]=
static_cast<T
>(std::get<2>(pdo_tuple));
55 pdo_vector[3]=
static_cast<T
>(std::get<3>(pdo_tuple));
56 pdo_vector[4]=
static_cast<T
>(std::get<4>(pdo_tuple));
57 pdo_vector[5]=
static_cast<T
>(std::get<5>(pdo_tuple));
58 pdo_vector[6]=
static_cast<T
>(std::get<6>(pdo_tuple));
59 pdo_vector[7]=
static_cast<T
>(std::get<7>(pdo_tuple));
60 pdo_vector[8]=
static_cast<T
>(std::get<8>(pdo_tuple));
61 pdo_vector[9]=
static_cast<T
>(std::get<9>(pdo_tuple));
62 pdo_vector[10]=
static_cast<T
>(std::get<10>(pdo_tuple));
63 pdo_vector[11]=
static_cast<T
>(std::get<11>(pdo_tuple));
69class MotorPdo:
public T{
73 MotorPdo(
const std::string ,int32_t
id, uint32_t type);
76 virtual void get_from_pb(
void)=0;
78 virtual void set_to_pb(
void)=0;
80 MotorPdoRx::pdo_t rx_pdo{};
81 MotorPdoTx::pdo_t tx_pdo{};
82 bool init_rx_pdo=
false;
85 iit::advr::Gains_Type _ctrl_type_cast=
static_cast<iit::advr::Gains_Type
>(0x00);
86 virtual void init_pb();
90inline void MotorPdo<T>::init_pb()
92 uint8_t pb_buf[MAX_PB_SIZE];
96 msg_size = T::pb_tx_pdos.ByteSizeLong();
97 T::pb_tx_pdos.SerializeToArray( (
void*)(pb_buf+
sizeof(msg_size)), msg_size);
101inline MotorPdo<T>::MotorPdo(
const std::string value,int32_t
id, uint32_t type):
109inline MotorPdo<T>::~MotorPdo()
Definition motor_pdo.h:69