diff options
author | 2024-07-01 00:10:54 +0530 | |
---|---|---|
committer | 2024-07-15 07:52:42 +0530 | |
commit | b0844193f37f477c9e7e509e0b4eaf221886192b (patch) | |
tree | a125cc5d3d90db067eb65399b1c4d812a0f0a4b1 /Scripts/README.md | |
parent | 25d451d87046a1cfbf7ac3cd47c2303fd29a22c5 (diff) |
Add Python Script to Convert CARLA data into CAN messagessalmon_18.90.0salmon/18.90.018.90.0
V1:
- Add carla_to_CAN.py script to convert CARLA data into CAN messages
- Add README and requirements.txt
V2:
- Add script to record and playback messages from can interface
- Fix mappings to agl-vcar.dbc file
V3:
- Fix playback feature for record_playback.py
- Update requirements.txt
- Update README to explain setup and usage of Scripts with CARLA
V4:
- Add file playback feature to Demo Control Panel
- Remove dependency on numpy to calculate vehicle speed, use math lib instead
- record_playback.py can now be imported and also be used in standalone mode
- Fix: Now data is sent to CAN interface only when it is updated
- Fix: Delay is now based on previous timestamp and not the starting timestamp
- Fix: Send correct Gear messages, compatible with the agl-vcar signals
Bug-AGL: SPEC-5161
Change-Id: I18a14e8e6ac4d24e6ed8774402fb93a36dec274e
Signed-off-by: Suchinton <suchinton.2001@gmail.com>
Diffstat (limited to 'Scripts/README.md')
-rw-r--r-- | Scripts/README.md | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/Scripts/README.md b/Scripts/README.md new file mode 100644 index 0000000..e3ca6df --- /dev/null +++ b/Scripts/README.md @@ -0,0 +1,84 @@ +## Setting up CARLA + +You can follow the steps provided in the [CARLA documentation](https://carla.readthedocs.io/en/latest/start_quickstart/#carla-installation) for installing CARLA. + +We recommend using the [latest release](https://github.com/carla-simulator/carla/releases/), and using the supported Python version to run the `carla_to_CAN.py` Script. + +1. Running the CARLA Server + + ```bash + # Move to the installation directory + $ cd /path/to/CARLA_<version> + + # Start the CARLA Server + $ ./CarlaUE4.sh + + # To run using minimum resources + $ ./CarlaUE4.sh -quality-level=Low -prefernvidia + ``` + + You may also add the `-RenderOffScreen` flag to start CARLA in off-screen mode. Refer to the various [rendering options](https://carla.readthedocs.io/en/latest/adv_rendering_options/#no-rendering-mode) for more details. + + Another way of running the CARLA server without a display is by using [CARLA in Docker](https://carla.readthedocs.io/en/latest/build_docker/). + +2. Starting a Manual Simulation + + ```bash + # Navigate to directory containing the demo python scripts + # + $ cd /path/to/CARLA_<version>/PythonAPI/examples + ``` + + Create a Python virtual environment and resolve dependencies + ```bash + $ python3 -m venv carlavenv + $ source carlavenv/bin/activate + $ pip3 install -r requirements.txt + + # Start the manual_control.py script + $ python3 manual_control.py + ``` + +## Converting CARLA data into CAN + +The `carla_to_CAN.py` script can be run run alongside an existing CARLA simulation to fetch data and convert it into CAN messages based on the [agl-vcar.dbc](https://git.automotivelinux.org/src/agl-dbc/plain/agl-vcar.dbc) file. + +While the `record_playback.py` script is responsible for recording amd playing back the CAN data for later sessions. + +_NOTE_: This does **not** require the CARLA server to be running. + +To access these scripts, clone the [AGL Demo Control Panel](https://gerrit.automotivelinux.org/gerrit/admin/repos/src/agl-demo-control-panel,general) project. + +```bash +# Move to the Scripts directory +$ cd /path/to//agl-demo-control-panel/Scripts + +# Fetch the agl-vcar.dbc file +$ wget -nd -c "https://git.automotivelinux.org/src/agl-dbc/plain/agl-vcar.dbc" +``` + +Create a Python virtual environment and resolve dependencies +```bash +$ python3 -m venv carlavenv +$ source carlavenv/bin/activate +$ pip3 install -r requirements.txt + +# Optionally, set up the vcan0 interface +$ ./vcan.sh +``` + +1. Converting CARLA Data into CAN + + ```bash + $ python -u carla_to_CAN.py + # OR + $ python -u carla_to_CAN.py --host <carla_server_ip> --port <carla_server_port> + ``` + +2. Recording and Playback of CAN messages + + ```bash + $ python -u record_playback.py + # OR + $ python -u record_playback.py --interface (or) -i can0 # default vcan0 + ```
\ No newline at end of file |