Files
Loongson_2k0300_SmartCar/docs/比赛参数固化.md
T
2026-07-06 17:02:10 +08:00

73 lines
2.5 KiB
Markdown
Raw 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.
# 比赛参数固化
> 截至 2026-07-0416速,45秒两圈
## 设备实际配置文件 (`/home/root/smartcar2/`)
```bash
speed=16 # 目标速度 (% 占空比)
deadband=8 # 舵机死区 (显示空间像素)
steer_gain=1.5 # 舵机增益
foresee=40 # 舵机前瞻行 (显示空间像素)
foresee_lost_scale=0.6# 丢线时前瞻缩放
sharp_turn_scale=0.5 # 急弯前瞻缩放
zebrasee=18 # 斑马线近界阈值 (模型空间 cy)
curve_slope=0.2 # 弯道减速斜率
curve_min=0.8 # 弯道最低速度倍率
cone_avoid_gain=0.3 # 锥桶推离力度
cone_avoid_range=30 # 锥桶斜坡陡峭度
cone_speed=0.5 # 锥桶速度倍率 (当前未生效)
cone_min_frames=3 # 锥桶确认帧数
cone_margin=0 # 0=中心点, 1=框边缘
cone_thresh=0.80 # 锥桶置信度阈值
cone_hold_frames=30 # 锥桶消失后保持帧数
brake_scale=10 # 刹车速度→占空比系数
brake_max=10000 # 最大刹车占空比 (ns)
lidar_enable=1 # 激光避障 (代码中已禁用)
start=1 # 电机使能运行中
debug=1 # 热调参模式 (每30帧重载配置)
showImg=0 # LCD 预览关闭
```
## 代码硬编码行为
### 斑马线状态机
- **进入 Z_STOP**: 播报语音 + LCD 显示 `pedestrian_stop.png`
- **停车**: 3 秒编码器刹车
- **冷却 Z_COOLDOWN**: 5 秒内不检测斑马线
### 斑马线冷却期控制 (Z_COOLDOWN)
| 时间 | 控制 |
|------|------|
| 0~0.7s | boost 1.5x 起步 |
| 2~5s | foresee 缩短为 24 |
| 3.3~5s | 降速上限 13 + 方向锁定一次性打满 |
### 斑马线冷却期 bang-bang 转向
- 3.3~5 秒内部署
- 偏差超出死区后锁定方向一次性打满
- 方向翻转或回到死区即退出,机会用完
- 退出后走正常线性转向
### 模型
- **Mild v13** (文件名为 `mild_v12.bin`)
- 输入 160×120 BGR,输出 4 类:锥桶/红灯/绿灯/斑马线
- 阈值:`{0.80, 0.70, 0.80, 0.85}`
- 推理频率:每 2 帧一次
### 硬件
- **LCD**: 160×128 RGB565
- **摄像头**: 640×480 MJPEG → 1/4 解码 160×120
- **舵机**: pwmchip1/pwm0, 3ms 周期, 1.2~1.8ms 量程
- **电机**: pwmchip8/pwm1+2, 20kHz, 开环占空比
- **编码器**: GPIO67 脉冲, GPIO72 方向, 100ms 窗口测速
- **语音**: I2C-2 地址 0x34
### 编译
```bash
cd smartcar2 && mkdir -p build && cd build
cmake .. && make -j$(nproc)
```
- 工具链: `/opt/loongson-gnu-toolchain-8.3-x86_64-loongarch64-linux-gnu-rc1.6`
- OpenCV: 4.13.0 (交叉编译, 仅 core/imgproc/imgcodecs/videoio)