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:
spdis
2026-06-17 13:47:13 +08:00
parent 06a73b0f02
commit 95a46c130d
31 changed files with 11645 additions and 191 deletions
+14
View File
@@ -4,6 +4,8 @@
#include <atomic>
#include <thread>
#include <chrono>
#include <sched.h>
#include <sys/resource.h>
#include "global.h"
#include "camera.h"
@@ -25,6 +27,15 @@ int main(void)
if (avoid_range_val > 0) g_cfg.cone_avoid_range = avoid_range_val;
if (hold_frames_val > 0) g_cfg.cone_hold_frames = hold_frames_val;
double lidar_gain_val = readDoubleFromFile(lidar_avoid_gain_file);
int lidar_range_val = (int)readDoubleFromFile(lidar_avoid_range_file);
int lidar_hold_val = (int)readDoubleFromFile(lidar_hold_frames_file);
int lidar_thresh_val = (int)readDoubleFromFile(lidar_thresh_file);
if (lidar_gain_val > 0) g_cfg.lidar_avoid_gain = lidar_gain_val;
if (lidar_range_val > 0) g_cfg.lidar_avoid_range = lidar_range_val;
if (lidar_hold_val > 0) g_cfg.lidar_hold_frames = lidar_hold_val;
if (lidar_thresh_val > 0) g_cfg.lidar_thresh = lidar_thresh_val;
if (CameraInit(0) < 0) {
std::cerr << "CameraInit failed" << std::endl;
return -1;
@@ -32,9 +43,12 @@ int main(void)
ControlInit();
std::cout << "All services started" << std::endl;
setpriority(PRIO_PROCESS, 0, -10);
while (running.load()) {
CameraHandler();
target_speed = g_cfg.speed;
sched_yield();
}
std::cout << "Stopping..." << std::endl;