清理编码器+死代码+可读性整理: 删除ENCODER类(含UB析构), MotorController简化为PWM+GPIO裸控制器, 移除mortor_kp/ki/kd全局变量, 排除vl53l0x/zebra_detect死代码, 修复image_cv行列写反, 清理无关include

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
spdis
2026-06-10 15:15:34 +08:00
parent d284e18407
commit 114d93cec7
16 changed files with 264 additions and 519 deletions
+17 -12
View File
@@ -2,18 +2,12 @@
#define GLOBAL_H
#include <string>
#include <iostream>
#include <fstream>
#include <atomic>
// ── 参数文件名 ──
const std::string kp_file = "./kp";
const std::string ki_file = "./ki";
const std::string kd_file = "./kd";
const std::string mortor_kp_file = "./mortor_kp";
const std::string mortor_ki_file = "./mortor_ki";
const std::string mortor_kd_file = "./mortor_kd";
const std::string start_file = "./start";
const std::string showImg_file = "./showImg";
const std::string destfps_file = "./destfps";
@@ -24,14 +18,25 @@ const std::string speed_file = "./speed";
const std::string deadband_file = "./deadband";
const std::string steer_gain_file = "./steer_gain";
const std::string center_bias_file = "./center_bias";
const std::string debug_file = "./debug";
// 从文件读取双精度值
double readDoubleFromFile(const std::string &filename);
bool readFlag(const std::string &filename);
void cfg_load_all();
// 从文件中读取标志
bool readFlag(const std::string &filename);
extern std::atomic<double> PID_rotate;
// ── 启动时缓存的运行参数 ──
struct CfgCache {
double speed = 60; // 目标速度(占空比 %)
double foresee = 80; // 前瞻行
double zebrasee = 60; // 斑马线触发距离阈值
double deadband = 5; // 舵机死区
double steer_gain = 1.0; // 舵机增益
double center_bias = 0; // 中线偏移修正
int start = 0; // 1=启动 0=停止
int showImg = 0; // LCD 预览开关
int debug = 0; // debug 模式
};
extern CfgCache g_cfg;
extern double target_speed;