Files
base/app/app_turn.h
2025-08-26 10:53:01 +08:00

95 lines
2.2 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef TURN_H
#define TURN_H
#ifdef __cplusplus
extern "C" {
#endif
#include "app_power.h"
#define LIMIT_SPEED_INDEX 0x7017//CSP的速度
#define LOC_REF_INDEX 0x7016//CSP的位置
#define RUM_MODE 0x7005//mode模式
#define OPERATION_MODE 0 // 运控模式
#define POSITION_MODE_PP 1 // 位置模式 (PP - Profile Position)
#define VELOCITY_MODE 2 // 速度模式
#define CURRENT_MODE 3 // 电流模式
#define POSITION_MODE_CSP 5 // 位置模式 (CSP - Cyclic Synchronous Position)
typedef struct TurnData
{
uint8_t mode ; // 控制模式
Timer turn_timer; // 定时器结构体
float desired_curvature; // 期望曲率
float curvature; // 当前曲率
uint32_t position; // 转动位置
uint8_t direction; // 转动方向
uint8_t old_direction; // 转动方向
float yaw_rate; // 转动角速度、
float inner_rad; //内轮角度
float outer_rad; //外轮角度
uint8_t motor_sleep; // 电机状态 0未上电1已上电
uint8_t emergency_stop_switch; // 急停开关
uint8_t remote_emergency_stop; // 遥控器急停开关
uint8_t emergency_stop_state; // 急停状态
PowerState current_state; // 当前电源状态
float right_max_position; // 右边最大角度 rad
float right_zero_position; // 右边归零角度 rad
float right_speed; // 右边速度 rad/s
float left_max_position; // 左边最大角度 rad
float left_zero_position; // 左边归零角度 rad
float left_speed; // 左边速度 rad/s
float wheel_base; // 轴距 m
float track_width; // 轮距 m
} TurnData;
//外部函数
void turnAppInit(void);
#ifdef __cplusplus
}
#endif
#endif // TURN_H