Files
car_stm32f103vet6/Core/Bsp/track_ir_algo.h
wangbeihong a5f8e8149a feat: 修正红外循迹方向符号,解决循迹偏差越修越偏问题
- 反转了循迹P控制输出的角速度修正方向,保证检测到黑线时车辆向正确方向修正
- 同步修正丢线回找时的转向方向
- 相关代码在 track_ir_algo.c
- 编译通过,功能已现场验证
2026-04-16 00:44:01 +08:00

19 lines
588 B
C
Raw Permalink 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 __TRACK_IR_ALGO_H
#define __TRACK_IR_ALGO_H
#include "main.h"
#include "bsp_track_ir.h"
typedef struct {
float yaw_correction_rpm; // 角速度修正量(用于 target_v_w
uint8_t speed_scale_percent; // 前进速度缩放0~100
int16_t deviation; // 线偏差(负=偏左,正=偏右)
track_ir_state_t state; // 当前循迹状态
} track_ir_ctrl_output_t;
void track_ir_algo_init(void);
void track_ir_algo_reset(void);
void track_ir_algo_step(uint8_t line_mask, track_ir_ctrl_output_t *out);
#endif /* __TRACK_IR_ALGO_H */