-
Notifications
You must be signed in to change notification settings - Fork 0
/
sender_LCM.cpp
105 lines (79 loc) · 2.56 KB
/
sender_LCM.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
// run method
// g++ -o sender_LCM sender_LCM.cpp -llcm
#include "sender_LCM.h"
int main(int argc, char **argv)
{
lcm::LCM *lcm = new lcm::LCM("udpm://239.255.76.67:7667?ttl=255");
spi_command_t IHMC_data;
IHMC_data.q_des_abad[0] = 0.1;
IHMC_data.q_des_abad[1] = 0.2;
IHMC_data.q_des_abad[2] = 0.3;
IHMC_data.q_des_abad[3] = 0.4;
IHMC_data.q_des_hip[0] = 0.1;
IHMC_data.q_des_hip[1] = 0.2;
IHMC_data.q_des_hip[2] = 0.3;
IHMC_data.q_des_hip[3] = 0.4;
IHMC_data.q_des_knee[0] = 1;
IHMC_data.q_des_knee[1] = 0;
IHMC_data.q_des_knee[2] = 0;
IHMC_data.q_des_knee[3] = 0;
IHMC_data.qd_des_abad[0] = 0.2;
IHMC_data.qd_des_abad[1] = 0.2;
IHMC_data.qd_des_abad[2] = 0.3;
IHMC_data.qd_des_abad[3] = 0.1;
IHMC_data.qd_des_hip[0] = 0.2;
IHMC_data.qd_des_hip[1] = 0.2;
IHMC_data.qd_des_hip[2] = 0.3;
IHMC_data.qd_des_hip[3] = 0.1;
IHMC_data.qd_des_knee[0] = 0.2;
IHMC_data.qd_des_knee[1] = 0.2;
IHMC_data.qd_des_knee[2] = 0.3;
IHMC_data.qd_des_knee[3] = 0.1;
IHMC_data.kp_abad[0] = 0.2;
IHMC_data.kp_abad[1] = 0.2;
IHMC_data.kp_abad[2] = 0.3;
IHMC_data.kp_abad[3] = 0.1;
IHMC_data.kp_hip[0] = 0.2;
IHMC_data.kp_hip[1] = 0.2;
IHMC_data.kp_hip[2] = 0.3;
IHMC_data.kp_hip[3] = 0.1;
IHMC_data.kp_knee[0] = 0.2;
IHMC_data.kp_knee[1] = 0.2;
IHMC_data.kp_knee[2] = 0.3;
IHMC_data.kp_knee[3] = 0.1;
IHMC_data.kd_abad[0] = 0.2;
IHMC_data.kd_abad[1] = 0.2;
IHMC_data.kd_abad[2] = 0.3;
IHMC_data.kd_abad[3] = 0.1;
IHMC_data.kd_abad[0] = 0.2;
IHMC_data.kd_abad[1] = 0.2;
IHMC_data.kd_abad[2] = 0.3;
IHMC_data.kd_abad[3] = 0.1;
IHMC_data.kd_knee[0] = 0.2;
IHMC_data.kd_knee[1] = 0.2;
IHMC_data.kd_knee[2] = 0.3;
IHMC_data.kd_knee[3] = 0.1;
IHMC_data.tau_abad_ff[0] = 0.2;
IHMC_data.tau_abad_ff[1] = 0.2;
IHMC_data.tau_abad_ff[2] = 0.3;
IHMC_data.tau_abad_ff[3] = 0.1;
IHMC_data.tau_hip_ff[0] = 0.2;
IHMC_data.tau_hip_ff[1] = 0.2;
IHMC_data.tau_hip_ff[2] = 0.3;
IHMC_data.tau_hip_ff[3] = 0.1;
IHMC_data.tau_knee_ff[0] = 0.2;
IHMC_data.tau_knee_ff[1] = 0.2;
IHMC_data.tau_knee_ff[2] = 0.3;
IHMC_data.tau_knee_ff[3] = 0.1;
IHMC_data.flags[0] = 1;
IHMC_data.flags[1] = 0;
IHMC_data.flags[2] = 0;
IHMC_data.flags[3] = 0;
if (!lcm->good())
return 1;
lcm->publish("spi_command_IHMC", &IHMC_data);
Handler handlerObject;
lcm->subscribe("spi_data", &Handler::handleMessage, &handlerObject);
lcm->handleTimeout(1200);
return 0;
}