022e3424da
- 新增 PIDClear() 仅清运行时状态,保留 Kp/Ki/Kd 等配置 - 命令帧 0xA7 (3B): 自动/手动/调试三模式切换,带模式状态追踪 - 手动控制帧 0xA6 (8B): 解析 motor_speed_base(int16) + angle_velocity(float) - 调试调参帧 0xA8 (38B): 在线更新全部9个 Kp/Ki/Kd 参数 - Command 解析纳入 Task_50ms (20Hz) 定时执行 - 添加通信协议文档 docs/通信协议.md
37 lines
1.1 KiB
C
37 lines
1.1 KiB
C
#ifndef __TASK_H
|
|
#define __TASK_H
|
|
|
|
#include "zf_common_typedef.h"
|
|
|
|
#include "PID_Controller.h"
|
|
|
|
void task_init(void);
|
|
|
|
//建议不直接修改此变量,而是通过set_yaw_ref(float set_value)设置,以防预期之外的值
|
|
extern volatile float yaw_ref;
|
|
void set_yaw_ref(float set_value);
|
|
|
|
//供外部控制使用
|
|
extern volatile uint8_t motor_control_task_enable;
|
|
extern volatile uint8_t angle_control_task_enable;
|
|
extern volatile uint8_t position_control_task_enable;
|
|
|
|
extern volatile PIDInstance pid_speed_right;
|
|
extern volatile PIDInstance pid_speed_left;
|
|
extern volatile PIDInstance pid_yaw;
|
|
extern volatile PIDInstance pid_position;
|
|
|
|
/*速度环的输入,开启角度环后由角度环接管(范围-50到+50)*/
|
|
extern volatile int16_t motor_speed_right_ref;
|
|
extern volatile int16_t motor_speed_left_ref;
|
|
/*角度环接管速度之后的基础直行速度*/
|
|
extern volatile int16_t motor_speed_base;
|
|
/*角度环参考值*/
|
|
extern volatile float yaw_ref;
|
|
/*角度速率控制,开启位置环后由位置环接管*/
|
|
extern volatile float angle_velocity;
|
|
//配置项
|
|
/*自动模式下的基础直行速度*/
|
|
#define AUTO_MODE_BASE_SPEED 10
|
|
|
|
#endif |