test code for SPI communications with any board

Dependencies:   mbed-dev

leg_message.h

Committer:
adimmit
Date:
2021-05-12
Revision:
12:b203f3ae57d0
Parent:
11:f3f01f363dd1
Child:
15:d3c93f01a02b

File content as of revision 12:b203f3ae57d0:

#ifndef _leg_message
#define _leg_message

#include <stdint.h>

// 36 bytes
// 18 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;
};

// 52 bytes
// 26 16-bit words
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; //removed a2 and a3
    };
struct grouped_act_control{
    joint_control a1;
    }
    ;
#endif