Skip to content

Commit

Permalink
Merge pull request #611 from Dhruv2012/gh-pages
Browse files Browse the repository at this point in the history
Added details about using custom CARLA object file and setting its env variables
  • Loading branch information
sergiopaniego authored Apr 13, 2023
2 parents 3d8eece + 78d9207 commit 075063a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
3 changes: 3 additions & 0 deletions _pages/install/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,10 @@ For installing CARLA and supporting this new simulator:
export CARLA_ROOT=<PATH-TO-CARLA>/carla_simulator/
export PYTHONPATH=$PYTHONPATH:$CARLA_ROOT/PythonAPI/carla
export PYTHONPATH=$PYTHONPATH:$CARLA_ROOT/PythonAPI/carla/dist/carla-0.9.13-py3.7-linux-x86_64.egg
export OBJECT_PATH=<PATH-TO-BEHAVIOR-METRICS>/behavior_metrics/configs/CARLA_launch_files/CARLA_object_files/parked_car_objects.json
```
Note: `$OBJECT_PATH` is a sample CARLA objects json file containing objects to be spawned in the CARLA simulator. You can use your own json file by setting $OBJECT_PATH. More details about this are added in [Quick Start guide](../quick_start/)

5. Test that everything is correctly set up running the example configuration file:
```bash
python3 driver_carla.py -c configs/default_carla.yml -g
Expand Down
28 changes: 28 additions & 0 deletions _pages/quick_start/quick_start.md
Original file line number Diff line number Diff line change
Expand Up @@ -421,3 +421,31 @@ As you type down the name of the frame, you will see how the name in the top-lef
Once you have chosen the frame name (this is important for later), you have to chose the data type the frame will show, from one of the checkboxes below the name textbox. After that, you will only have to click the **Confirm** button and the sensor will show its data.
{% include gallery id="gallery17" caption="" %}
### Launching different objects in CARLA
By default, while running ```python3 driver_carla.py -c configs/default_carla.yml -g``` , CARLA allows to spawn an ego vehicle along with its sensors. The default object file called here can be found in ```$(find carla_spawn_objects)/config/objects.json```.
However, we can spawn different objects in the simulation by changing the object file.
To spawn, For Eg: an additional car (here an Audi), as an obstacle in CARLA Town, we can add the following in the object file at relevant hierarchy after the ego vehicle object:
```json
{
"type": "vehicle",
"id": "vehicle.audi.a2",
}
```
A sample CARLA object file for this can be found [here](https://github.com/JdeRobot/BehaviorMetrics/blob/noetic-devel/behavior_metrics/configs/CARLA_launch_files/CARLA_object_files/parked_car_objects.json).

The new object file env variable can be set as below:
```bash
export OBJECT_PATH=<PATH-TO-CARLA-OBJECT-FILE>
```

Now, replace the value of ```objects_definition_file``` args in the corresponding CARLA launch file with ```'$(env OBJECT_PATH)'```

Sample launch file for this can be found [here](https://github.com/JdeRobot/BehaviorMetrics/blob/noetic-devel/behavior_metrics/configs/CARLA_launch_files/town_01_anticlockwise.launch)

Now, pass this launch file to the CARLA configuration file ```default_carla.yml``` (under the **World** parameter) and run the driver as usual by ```python3 driver_carla.py -c configs/default_carla.yml -g```.

0 comments on commit 075063a

Please sign in to comment.