Cheetah Software  1.0
SpineBoard.h
Go to the documentation of this file.
1 
5 #ifndef PROJECT_SPINEBOARD_H
6 #define PROJECT_SPINEBOARD_H
7 
8 #include "cTypes.h"
9 
10 struct SpiCommand {
11  float q_des_abad[4];
12  float q_des_hip[4];
13  float q_des_knee[4];
14 
15  float qd_des_abad[4];
16  float qd_des_hip[4];
17  float qd_des_knee[4];
18 
19  float kp_abad[4];
20  float kp_hip[4];
21  float kp_knee[4];
22 
23  float kd_abad[4];
24  float kd_hip[4];
25  float kd_knee[4];
26 
27  float tau_abad_ff[4];
28  float tau_hip_ff[4];
29  float tau_knee_ff[4];
30 
31  int32_t flags[4];
32 };
33 
34 struct SpiData {
35  float q_abad[4];
36  float q_hip[4];
37  float q_knee[4];
38  float qd_abad[4];
39  float qd_hip[4];
40  float qd_knee[4];
41  int32_t flags[4];
43 };
44 
45 class SpineBoard {
46  public:
48  void init(float side_sign, s32 board);
49  void run();
50  void resetData();
51  void resetCommand();
52  SpiCommand* cmd = nullptr;
53  SpiData* data = nullptr;
54  float torque_out[3];
55 
56  private:
57  float side_sign;
59  const float max_torque[3] = {17.f, 17.f, 26.f}; // TODO CHECK WITH BEN
60  const float wimp_torque[3] = {6.f, 6.f, 6.f}; // TODO CHECK WITH BEN
61  const float disabled_torque[3] = {0.f, 0.f, 0.f};
62  const float q_limit_p[3] = {1.5f, 5.0f, 0.f};
63  const float q_limit_n[3] = {-1.5f, -5.0f, 0.f};
64  const float kp_softstop = 100.f;
65  const float kd_softstop = 0.4f;
66  s32 iter_counter = 0;
67 };
68 
69 #endif // PROJECT_SPINEBOARD_H
Common types that are only valid in C++.
float qd_des_knee[4]
Definition: SpineBoard.h:17
const float max_torque[3]
Definition: rt_spi.cpp:33
float tau_abad_ff[4]
Definition: SpineBoard.h:27
float kd_hip[4]
Definition: SpineBoard.h:24
int32_t spi_driver_status
Definition: SpineBoard.h:42
float kd_knee[4]
Definition: SpineBoard.h:25
float q_des_knee[4]
Definition: SpineBoard.h:13
float kd_abad[4]
Definition: SpineBoard.h:23
s32 board_num
Definition: SpineBoard.h:58
const float disabled_torque[3]
Definition: rt_spi.cpp:35
float tau_knee_ff[4]
Definition: SpineBoard.h:29
float q_des_abad[4]
Definition: SpineBoard.h:11
float kp_knee[4]
Definition: SpineBoard.h:21
float q_des_hip[4]
Definition: SpineBoard.h:12
float qd_des_hip[4]
Definition: SpineBoard.h:16
int32_t flags[4]
Definition: SpineBoard.h:31
float kp_abad[4]
Definition: SpineBoard.h:19
float kp_hip[4]
Definition: SpineBoard.h:20
float tau_hip_ff[4]
Definition: SpineBoard.h:28
int32_t s32
Definition: cTypes.h:23
const float wimp_torque[3]
Definition: rt_spi.cpp:34
float qd_des_abad[4]
Definition: SpineBoard.h:15
float side_sign
Definition: SpineBoard.h:57