代码风格更新以及加入超电的对接
This commit is contained in:
1 parent
957c535bda
commit
9de485e4ef
117 files changed
+9046
-6457
No files matched your search
@@ -4,50 +4,24 @@
|
||||
#include <stdint.h>
|
||||
#include "dji_motor.h"
|
||||
|
||||
/* 底盘模块:麦轮逆解 + 四轮转速 PID + 跟随云台(双 INS 世界系,2026-09 重写)
|
||||
* 电机实际接线:
|
||||
* 0x201 右前 0x202 右后 0x203 左前 0x204 左后 */
|
||||
extern dji_motor_t motor_wheel_rf;//0x201右前轮(CAN1)
|
||||
extern dji_motor_t motor_wheel_lf;//0x202右后轮(CAN1,变量名沿用legacy)
|
||||
extern dji_motor_t motor_wheel_lr;//0x203左前轮(CAN1,变量名沿用legacy)
|
||||
extern dji_motor_t motor_wheel_rr;//0x204左后轮(CAN1,变量名沿用legacy)
|
||||
extern dji_motor_t motor_yaw_follow;//Yaw GM6020(CAN2 0x205,底盘跟随反馈)
|
||||
|
||||
extern dji_motor_t motor_wheel_rf; // 0x201 右前
|
||||
extern dji_motor_t motor_wheel_lf; // 0x202 右后(变量名沿用 legacy)
|
||||
extern dji_motor_t motor_wheel_lr; // 0x203 左前(变量名沿用 legacy)
|
||||
extern dji_motor_t motor_wheel_rr; // 0x204 左后(变量名沿用 legacy)
|
||||
extern dji_motor_t motor_yaw_follow; // Yaw GM6020,CAN2 0x205(跟随反馈)
|
||||
extern volatile float dbg_follow_err_deg;//跟随误差诊断(°)
|
||||
extern volatile float dbg_follow_out;//跟随环输出诊断(w)
|
||||
extern volatile float dbg_follow_sign;//综合后的跟随符号(0=未定)
|
||||
|
||||
extern void chassis_motor_init(void);
|
||||
void chassis_motor_init(void);//初始化底盘四轮/跟随电机实例与PID
|
||||
uint8_t chassis_motor_offline(void);//判定底盘任一轮电机是否掉线(1-掉线,0-正常)
|
||||
void chassis_control(float vx, float vy, float w, float power_scale);//麦轮逆解与四轮电流下发(2ms调用)
|
||||
uint8_t chassis_detect_follow_sign(void);//上电自检底盘跟随旋转符号(1-成功,0-失败)
|
||||
float chassis_follow_sign(void);//获取综合后的跟随符号(+1/-1)
|
||||
float chassis_follow_w(void);//计算FOLLOW模式下的底盘跟随角速度(2ms调用)
|
||||
void chassis_follow_reset(void);//请求下个周期重置跟随基准并清积分
|
||||
void chassis_output_zero(void);//底盘四轮电流输出清零
|
||||
void chassis_vector_to_body(float vx_g, float vy_g, float w, float * vx_c, float * vy_c);//将云台系平移速度投影到底盘自身坐标系
|
||||
|
||||
/* 判定任一轮电机掉线 */
|
||||
extern uint8_t chassis_motor_offline(void);
|
||||
|
||||
/* 底盘运动控制(2ms 调用)
|
||||
* vx:前进(+)/后退(-) vy:左(+)/右(-) w:逆时针(+)旋转
|
||||
* power_scale:功率限制系数(0~1),直接缩放输出电流 */
|
||||
extern void chassis_control(float vx, float vy, float w, float power_scale);
|
||||
|
||||
/* 底盘自检:小 w 脉冲+底盘 INS 测"w 正向=底盘 CCW/CW",与云台下发的
|
||||
* 编码器方向综合出跟随符号(阻塞约 200ms,整车会轻转)。
|
||||
* 返回 1-成功 0-失败 */
|
||||
extern uint8_t chassis_detect_follow_sign(void);
|
||||
|
||||
/* 综合后的跟随符号(+1/-1;自检未完成时为参数回退值) */
|
||||
extern float chassis_follow_sign(void);
|
||||
|
||||
/* 跟随一步(2ms,FOLLOW 模式调用;反馈为编码器相对角,零漂移) */
|
||||
extern float chassis_follow_w(void);
|
||||
|
||||
/* 请求下个周期重锁基准并清积分 */
|
||||
extern void chassis_follow_reset(void);
|
||||
|
||||
/* 底盘输出清零(停车) */
|
||||
extern void chassis_output_zero(void);
|
||||
|
||||
/* 跟随环诊断导出(debug_task 打印) */
|
||||
extern volatile float dbg_follow_err_deg;
|
||||
extern volatile float dbg_follow_out;
|
||||
extern volatile float dbg_follow_sign;
|
||||
|
||||
/* 将以云台为基准的平移速度(vx_g, vy_g)旋转投影到底盘自身坐标系(vx_c, vy_c)
|
||||
* 无论底盘是否处于小陀螺自旋状态,使 vx_g 始终代表沿云台枪口方向前进 */
|
||||
extern void chassis_vector_to_body(float vx_g, float vy_g, float w, float * vx_c, float * vy_c);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
Reference in new issue
Block a user