test code for SPI communications with any board

Dependencies:   mbed-dev

leg_message.h

Committer:
adimmit
Date:
2021-05-11
Revision:
11:f3f01f363dd1
Parent:
10:42438194e82b
Child:
12:b203f3ae57d0

File content as of revision 11:f3f01f363dd1:

#ifndef _leg_message
#define _leg_message

#include <stdint.h>

// 124 bytes
// 62 16-bit words
struct spi_data_t
{
    float q_1s[2];
    float qd_1s[2];
    float tau_1s[2];
    int32_t flags[2];
    int32_t checksum;
};

// 196 bytes
struct spi_command_t
{
    float q_des_1s[2]; //first motor on each can bus 0-can1, 1-can2, 2-can3
    float qd_des_1s[2];
    float kp_1s[2];
    float kd_1s[2];
    float tau_1s_ff[2];
    int32_t flags[2];
    int32_t checksum;
};



struct joint_control{
    float p_des, v_des, kp, kd, t_ff;
    };
    
struct joint_state{
    float p, v, t;
    };
    
struct grouped_act_state{
    joint_state a1, a2, a3;
    };
struct grouped_act_control{
    joint_control a1, a2, a3;
    }
    ;
#endif