对齐控制方法
This commit is contained in:
21
README.md
21
README.md
@@ -147,23 +147,14 @@ curl -X POST http://{IP}:8765/cmd \
|
||||
-d '{"speed": 1.0, "steer": 0.3}'
|
||||
```
|
||||
|
||||
**Ackermann 模式**:
|
||||
匹配串口协议(11 字节帧),对接 `cmd_vel/Twist`:
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| `speed` | float | 目标速度 m/s,正=前进,负=后退 |
|
||||
| `steer` | float | 目标转向角 rad,正=左转,负=右转 |
|
||||
|
||||
**差速模式**(兼容 `cmd_vel/Twist`):
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| `vx` | float | 线速度 m/s |
|
||||
| `vy` | float | 横向速度 m/s(忽略) |
|
||||
| `wz` | float | 角速度 rad/s,自动转为转向角 |
|
||||
| `vx` | float | 线速度 m/s(对应 `X_speed`) |
|
||||
| `wz` | float | 角速度 rad/s(对应 `Z_speed`,固件内用 bicycle model 转阿克曼转向角) |
|
||||
|
||||
```bash
|
||||
# 差速模式
|
||||
curl -X POST http://{IP}:8765/cmd \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"vx": 1.0, "wz": 0.5}'
|
||||
@@ -186,10 +177,10 @@ with open("frame.jpg", "wb") as f:
|
||||
state = requests.get(f"http://{IP}:8765/state").json()
|
||||
print(f"位置: ({state['x']}, {state['y']}), 速度: {state['speed_actual']} m/s")
|
||||
|
||||
# 发送控制指令
|
||||
requests.post(f"http://{IP}:8765/cmd", json={"speed": 1.0, "steer": 0.2})
|
||||
# 发送控制指令(串口协议格式:vx + wz)
|
||||
requests.post(f"http://{IP}:8765/cmd", json={"vx": 1.0, "wz": 0.5})
|
||||
time.sleep(2)
|
||||
requests.post(f"http://{IP}:8765/cmd", json={"speed": 0.0, "steer": 0.0})
|
||||
requests.post(f"http://{IP}:8765/cmd", json={"vx": 0.0, "wz": 0.0})
|
||||
```
|
||||
|
||||
**ROS2 桥接示例**(仿真机 HTTP → ROS2 局域网):
|
||||
|
||||
Reference in New Issue
Block a user