2020-03-10 13:38:40 -07:00
openpilot in simulator
2020-03-01 19:50:03 +01:00
=====================
2020-02-04 19:46:57 -08:00
2023-12-11 20:38:37 -08:00
openpilot implements a [bridge ](run_bridge.py ) that allows it to run in the [MetaDrive simulator ](https://github.com/metadriverse/metadrive ).
2021-10-10 15:50:30 -07:00
2023-09-29 12:44:12 -07:00
## Launching openpilot
2024-01-25 12:45:43 -08:00
First, start openpilot. Note that you will either need a [mapbox token ](https://docs.mapbox.com/help/getting-started/access-tokens/#how-access-tokens-work ) (set with ```export MAPBOX_TOKEN="1234"` ``), or to disable mapsd with ` ``export BLOCK=mapsd` ``
2023-09-29 12:44:12 -07:00
``` bash
# Run locally
./tools/sim/launch_openpilot.sh
```
2021-10-10 15:50:30 -07:00
2023-09-29 12:44:12 -07:00
## Bridge usage
```
$ ./run_bridge.py -h
2023-12-12 09:45:34 -08:00
usage: run_bridge.py [-h] [--joystick] [--high_quality] [--dual_camera]
2023-09-29 12:44:12 -07:00
Bridge between the simulator and openpilot.
2020-09-10 03:14:49 -07:00
2023-09-29 12:44:12 -07:00
options:
-h, --help show this help message and exit
--joystick
--high_quality
--dual_camera
```
2022-04-29 07:15:05 -07:00
2023-09-29 12:44:12 -07:00
#### Bridge Controls:
- To engage openpilot press 2, then press 1 to increase the speed and 2 to decrease.
- To disengage, press "S" (simulates a user brake)
2022-04-29 07:15:05 -07:00
2023-09-29 12:44:12 -07:00
#### All inputs:
2020-09-10 03:14:49 -07:00
2020-09-11 17:42:12 +02:00
```
2023-09-29 12:44:12 -07:00
| key | functionality |
|------|-----------------------|
| 1 | Cruise Resume / Accel |
| 2 | Cruise Set / Decel |
| 3 | Cruise Cancel |
| r | Reset Simulation |
| i | Toggle Ignition |
| q | Exit all |
| wasd | Control manually |
```
2022-04-29 07:15:05 -07:00
2023-09-29 12:44:12 -07:00
## MetaDrive
### Launching Metadrive
Start bridge processes located in tools/sim:
``` bash
2023-12-12 09:45:34 -08:00
./run_bridge.py
2023-12-11 20:38:37 -08:00
```