增加调试功能,以及yaw补偿

This commit is contained in:
lyf committed 2026-11-18 16:05:46 +08:00
1 parent 267a659242
commit 957c535bda
257 files changed
+239436 -692

No files matched your search

+11 -1
View File
@@ -14,6 +14,7 @@
#include "cmsis_os.h"
#include "FreeRTOS.h"
#include "task.h"
#include <math.h>
#include "robot_typedef.h"
#include "chassis.h"
#include "attitude.h"
@@ -28,6 +29,11 @@
#define CALIB_GESTURE_MS 500 // 保持时长
#define CALIB_GESTURE_TICKS (CALIB_GESTURE_MS / 2) // 2ms 任务
/* 快陀螺变速自旋:w = MECANUM_SPIN_FAST_W + A*sin(ωt+φ) */
#define SPIN_WAVE_A 1.0f // 幅值(与 w 同量纲)
#define SPIN_WAVE_OMEGA 3.1415927f // 角频率 rad/s,周期 2 s
#define SPIN_WAVE_PHASE 0.0f // 初相 rad
typedef enum
{
F_WAIT = 0,
@@ -105,8 +111,12 @@ void chassis_task(void const * argument)
break;
case CHASSIS_MODE_SPIN_FAST:
w = MECANUM_SPIN_FAST_W;
{
/* 变速小陀螺:基准 -6,叠加 ±1 正弦,转速在 5~7 之间摆动 */
const float t = (float)HAL_GetTick() * 0.001f;
w = MECANUM_SPIN_FAST_W + SPIN_WAVE_A * sinf(SPIN_WAVE_OMEGA * t + SPIN_WAVE_PHASE);
break;
}
case CHASSIS_MODE_FOLLOW:
default: