wheel_legged/application/chassis/leg.h

55 lines
995 B
C
Raw Normal View History

2023-12-26 23:54:56 +08:00
//
// Created by SJQ on 2023/12/25.
//
#ifndef WHEEL_LEGGED_LEG_H
#define WHEEL_LEGGED_LEG_H
#include "controller.h"
typedef struct
{
float L0;
float phi0;
float phi1;
float phi4;
float phi2;
float phi3;
}Leg_State_t;
typedef struct
{
float F;
float Tp;
}Leg_Input_t;
typedef struct
{
float T1;
float T2;
}Leg_Output_t;
typedef struct
{
Leg_State_t legState;
Leg_Input_t legInput;
Leg_Output_t legOutput;
float target_L0;
float target_phi0;
PIDInstance Length_PID;
PIDInstance Phi0_PID;
}LegInstance;
void Leg_State_update(Leg_State_t* leg_state, float phi1,float phi4);
void Leg_calc_output(Leg_State_t* leg_state,Leg_Input_t* leg_input,Leg_Output_t* leg_output);
void Leg_Input_update(Leg_Input_t* leg_Input, float F,float Tp);
void Leg_Init(LegInstance* legInstance,PID_Init_Config_s lengthConfig,PID_Init_Config_s phiConfig);
void Leg_length_control_loop(LegInstance* legInstance);
#endif //WHEEL_LEGGED_LEG_H