摩擦轮,拨盘 driver

This commit is contained in:
guoxy06
2026-03-18 21:08:49 +08:00
parent caec6bb497
commit d0faf90d5e
2 changed files with 16 additions and 9 deletions

View File

@@ -12,6 +12,7 @@
#include "bsp_dwt.h"
#include "bsp_log.h"
#include "main.h"
#include "shoot.h"
// 私有宏,自动将编码器转换成角度值
#define YAW_ALIGN_ANGLE (YAW_CHASSIS_ALIGN_ECD * ECD_ANGLE_COEF_DJI) // 对齐时的角度,0-360
#define PTICH_HORIZON_ANGLE (PITCH_HORIZON_ECD * ECD_ANGLE_COEF_DJI) // pitch水平时电机的角度,0-360
@@ -356,8 +357,7 @@ static void EmergencyHandler()
}
/* 机器人核心控制任务,200Hz频率运行(必须高于视觉发送频率) */
void RobotCMDTask()
{
void RobotCMDTask() {
// 从其他应用获取回传数据
#ifdef ONE_BOARD
SubGetMessage(chassis_feed_sub, (void *)&chassis_fetch_data);
@@ -371,11 +371,18 @@ void RobotCMDTask()
// 根据gimbal的反馈值计算云台和底盘正方向的夹角,不需要传参,通过static私有变量完成
CalcOffsetAngle();
// 根据遥控器左侧开关,确定当前使用的控制模式为遥控器调试还是键鼠
if (switch_is_down(rc_data[TEMP].rc.switch_left)) // 遥控器左侧开关状态为[下],遥控器控制
if (switch_is_down(rc_data[TEMP].rc.switch_left)){ // 遥控器左侧开关状态为[下],遥控器控制
RemoteControlSet();
else if (switch_is_up(rc_data[TEMP].rc.switch_left)) // 遥控器左侧开关状态为[上],键盘控制
shoot_cmd_send.shoot_mode =SHOOT_OFF;
}
else if (switch_is_up(rc_data[TEMP].rc.switch_left)) {
// 遥控器左侧开关状态为[上],键盘控制
MouseKeySet();
shoot_cmd_send.shoot_mode =SHOOT_OFF;
}
else if (switch_is_mid( rc_data[TEMP].rc.switch_left)) {
shoot_cmd_send.shoot_mode =SHOOT_ON;
}
EmergencyHandler(); // 处理模块离线和遥控器急停等紧急情况
// 设置视觉发送数据,还需增加加速度和角速度数据