R2_UP/User/Algorithm/navi.h

109 lines
2.0 KiB
C
Raw Permalink Normal View History

2025-03-12 10:46:02 +08:00
#ifndef NAVI_H
#define NAVI_H
#include "Action.h"
#include "pid.h"
#include "ahrs.h"
#include "bmi088.h"
#include "map.h"
typedef enum {
AUTO_MODE, // <20>Զ<EFBFBD><D4B6>ܵ<EFBFBD>ģʽ
MANUAL_MODE , // <20><><EFBFBD><EFBFBD>ģʽ
NO_MODE
} Navi_Mode_t;
typedef struct {
Navi_Mode_t mode;
int Trig_flag;//<2F><><EFBFBD><EFBFBD><EFBFBD>أ<EFBFBD><D8A3><EFBFBD>ʼֵΪ<D6B5><EFBFBD><E3A3AC><EFBFBD>ֿ<EFBFBD><D6BF><EFBFBD>ģʽ<C4A3>£<EFBFBD><C2A3><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>Ϊ1<CEAA><31><EFBFBD><EFBFBD>ʹcnt+1<><31>Ϊ-1<><31>ʹcnt-1
} Navi_COT_MODE_t;
typedef struct{
float pos_x;
float pos_y;
float last_pos_x;
float last_pos_y;
}chassis_position_t;
typedef enum{
YES,
NO,
NEXT1,
NEXT2
}is_cpt_e;
typedef struct{
pid_param_t pid_PosSpeed_x_param;
pid_param_t pid_PosSpeed_y_param;
pid_param_t pid_pos_x_out_param;
pid_param_t pid_pos_x_inner_param;
pid_param_t pid_pos_y_out_param;
pid_param_t pid_pos_y_inner_param;
pid_param_t pid_OutAngle_param;
pid_param_t pid_InnerAngle_param;
pid_param_t path_speed_pid_param;
}ops_pid_param_t;
typedef struct {
ops_pid_param_t ops_pid;
const point_t *path;
int8_t path_num;
}ops_param_t;
/**
* @brief
*
*/
typedef struct {
Action_POS_t *chassis_pos;
fp32 current_x;
fp32 current_y;
fp32 next_mapx;
fp32 next_mapy;
const point_t *chassis_map;
const ops_param_t *param;
PathState_t state;
Navi_COT_MODE_t Navi_Mode;
AHRS_Eulr_t ops_imu_pos;
AHRS_Gyro_t ops_gyro;
pid_type_def pid_PosSpeed_x;
pid_type_def pid_PosSpeed_y;
pid_type_def pid_pos_x_out;
pid_type_def pid_pos_x_inner;
pid_type_def pid_pos_y_out;
pid_type_def pid_pos_y_inner;
pid_type_def pid_OutAngle;
pid_type_def pid_InnerAngle;
pid_type_def path_speed_pid;
is_cpt_e POS_IS_CPT;
struct
{
fp32 vx;
fp32 vy;
fp32 yaw_angle;
}final_out;
}ops_t;
int8_t Action_init(ops_t *o,const ops_param_t *param,Action_POS_t *pos);
int8_t go_path(ops_t *o,CMD_ACTION_t *ops_out);
#endif