C路: VL53L0X 用户态I2C直驱 + 高速模式 29.6fps
- 搬运 ST API C 源码到 lib/vl53l0x/, 替换 I2C 层为用户态 i2c-dev - 新增 vl53l0x_platform_user.cpp: WriteMulti/ReadMulti 等全平台接口 - 重写 vl53l0x.cpp: start时unbind内核驱动, 单次测距, 无后台轮询 - 高速模式 20000μs timing budget, 模型缓存零污染(41-43ms) - LiDAR 每5帧一读(~20ms), 隔帧模型推理, fps 25.1→29.6 (+18%) - 同事的LiDAR避障集成: 12个配置参数, 中线变形绕行, 刹车注释 - nice -10 + sched_yield 优先级优化
This commit is contained in:
@@ -31,6 +31,19 @@ const std::string cone_hold_frames_file = "./cone_hold_frames";
|
||||
const std::string brake_scale_file = "./brake_scale";
|
||||
const std::string brake_max_file = "./brake_max";
|
||||
|
||||
const std::string lidar_thresh_file = "./lidar_thresh";
|
||||
const std::string lidar_near_file = "./lidar_near";
|
||||
const std::string lidar_far_file = "./lidar_far";
|
||||
const std::string lidar_near_start_file = "./lidar_near_start";
|
||||
const std::string lidar_near_end_file = "./lidar_near_end";
|
||||
const std::string lidar_far_span_file = "./lidar_far_span";
|
||||
const std::string lidar_min_frames_file = "./lidar_min_frames";
|
||||
const std::string lidar_avoid_gain_file = "./lidar_avoid_gain";
|
||||
const std::string lidar_avoid_range_file = "./lidar_avoid_range";
|
||||
const std::string lidar_speed_file = "./lidar_speed";
|
||||
const std::string lidar_hold_frames_file = "./lidar_hold_frames";
|
||||
const std::string lidar_enable_file = "./lidar_enable";
|
||||
|
||||
double readDoubleFromFile(const std::string &filename);
|
||||
bool readFlag(const std::string &filename);
|
||||
void cfg_load_all();
|
||||
@@ -57,6 +70,19 @@ struct CfgCache {
|
||||
|
||||
double brake_scale = 10; // 速度(pps) → 刹车占空比(ns) 缩放系数
|
||||
int brake_max = 10000; // 最大刹车占空比 (ns)
|
||||
|
||||
int lidar_thresh = 300; // 激光障碍判定距离阈值 (mm)
|
||||
int lidar_near = 50; // row=lt_h-1 对应的物理距离 (mm)
|
||||
int lidar_far = 1200; // row=10 对应的物理距离 (mm)
|
||||
int lidar_near_start = 1; // near_valid 检测起始偏移
|
||||
int lidar_near_end = 4; // near_valid 检测终止偏移
|
||||
int lidar_far_span = 6; // far_lost 检测跨度
|
||||
int lidar_min_frames = 3; // 连续确认帧数
|
||||
double lidar_avoid_gain = 0.4; // 绕行中线推离力度 (归一化)
|
||||
int lidar_avoid_range = 30; // 绕行斜坡陡峭度 (行数)
|
||||
double lidar_speed = 0.4; // 绕行时速度倍率
|
||||
int lidar_hold_frames = 30; // 消失后变形保持帧数
|
||||
int lidar_enable = 1; // 激光避障总开关
|
||||
};
|
||||
extern CfgCache g_cfg;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user