Sergi e/p098 ros (#2591)

* New style iteration

* New iteration style ROS

* Iteration on H comments

* Fix arch=amd 64 trusted=yes

* Fixed codacy issues

* Fixes for J revie

* Fixed typo.
This commit is contained in:
sergi.e 2020-03-19 14:01:01 +01:00 committed by GitHub
parent 3bef703f24
commit 65555c3844
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 761 additions and 285 deletions

View File

@ -1,23 +1,20 @@
# ROS bridge installation # ROS bridge installation
* [__Requirements__](#requirements) * [__Requirements__](#requirements)
* [__Bridge installation__](#bridge-installation) * [__Bridge installation__](#bridge-installation)
* a) using apt repository * a) using apt repository
* b) using source repository * b) using source repository
* [__Run the ROS bridge__](#run-the-ros-bridge) * [__Run the ROS bridge__](#run-the-ros-bridge)
* Solving ImportError: No module named CARLA * [__Setting CARLA__](#setting-carla)
* [__Setting CARLA__](#setting-carla)
The ROS bridge enables two-way communication between ROS and CARLA. The ROS bridge enables two-way communication between ROS and CARLA. The information from the CARLA server is translated to ROS topics. In the same way, the messages sent between nodes in ROS get translated to commands to be applied in CARLA.
In order to do so, the information from the CARLA server is translated to ROS topics. For example, the information retrieved by sensors is structured to fit ROS messages.
In the same way, the messages sent between nodes in ROS get translated to commands to be applied in CARLA. This is commonly used to update the state of a vehicle and apply controllers.
--- ---
## Requirements ## Requirements
#### ROS melodic ### ROS Kinetic/Melodic
* __ROS Kinetic/Melodic:__ follow the official documentation to [install ROS](http://wiki.ros.org/melodic/Installation/Ubuntu). Some ROS packages may be required, depending on the user needs, such as [rviz](https://wiki.ros.org/ainstein_radar_rviz_plugins) to visualize ROS data. * __ROS Kinetic/Melodic.__ Install ROS [Melodic](http://wiki.ros.org/melodic/Installation/Ubuntu), for Ubuntu 18.04, or [Kinetic](http://wiki.ros.org/kinetic/Installation), for Ubuntu 16.04. ROS packages may be required, depending on the user needs. [rviz](http://wiki.ros.org/rviz) to visualize ROS data.
* __CARLA 0.9.7:__ previous versions are not compatible with the ROS bridge. Follow the [quick start installation](../getting_started/quickstart) or make the build for the corresponding platform. * __CARLA 0.9.7 or later.__ Previous versions are not compatible with the ROS bridge. Follow the [quick start installation](../getting_started/quickstart) or make the build for the corresponding platform.
!!! Important !!! Important
Make sure that both CARLA and ROS work properly before continuing with the installation. Make sure that both CARLA and ROS work properly before continuing with the installation.
@ -25,32 +22,32 @@ In the same way, the messages sent between nodes in ROS get translated to comman
--- ---
## Bridge installation ## Bridge installation
#### a) Using apt repository ### a) Using apt repository
First add the apt repository: Add the apt repository.
* __Bridge for ROS Melodic:__ * __Bridge for ROS Melodic.__
```sh ```sh
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 81061A1A042F527D && sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 81061A1A042F527D &&
sudo add-apt-repository "deb [trusted=yes] http://dist.carla.org/carla-ros-bridge-melodic/ bionic main" sudo add-apt-repository "deb [arch=amd64 trusted=yes] http://dist.carla.org/carla-ros-bridge-melodic/ bionic main"
``` ```
* __Bridge for ROS Kinetic:__ * __Bridge for ROS Kinetic.__
```sh ```sh
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9BE2A0CDC0161D6C && sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9BE2A0CDC0161D6C &&
sudo add-apt-repository "deb [trusted=yes] http://dist.carla.org/carla-ros-bridge-kinetic xenial main" sudo add-apt-repository "deb [arch=amd64 trusted=yes] http://dist.carla.org/carla-ros-bridge-kinetic xenial main"
``` ```
Then simply install the ROS bridge: Install the ROS bridge.
```sh ```sh
sudo apt update && sudo apt update &&
sudo apt install carla-ros-bridge-<melodic or kinetic> sudo apt install carla-ros-bridge-<melodic or kinetic>
``` ```
#### b) Using source repository ### b) Using source repository
A catkin workspace is needed to use the ROS bridge. It should be cloned and built in there. The following code creates a new workspace, and clones the repository in there.
In order to use the ROS bridge, a catkin workspace is needed. It should be cloned and built in there.
The following fragment creates a new workspace and clones the repository in there.
```sh ```sh
#setup folder structure #setup folder structure
mkdir -p ~/carla-ros-bridge/catkin_ws/src mkdir -p ~/carla-ros-bridge/catkin_ws/src
@ -72,28 +69,28 @@ catkin_make
--- ---
## Run the ROS bridge ## Run the ROS bridge
__1) run CARLA:__ the way to do so will depend on the the CARLA installation chosen, so here is a brief summary: __1) Run CARLA.__ The way to do so depends on the CARLA installation.
* __Quick start/release package:__ run `./CarlaUE4.sh` in `/carla/`. * __Quick start/release package.__ `./CarlaUE4.sh` in `carla/`.
* __apt installation:__ run `./CarlaUE4.sh` in `/opt/carla/bin/`. * __apt installation.__ `./CarlaUE4.sh` in `opt/carla/bin/`.
* __Build installation:__ run `make launch` in `/carla/`. * __Build installation.__ `make launch` in `carla/`.
__2) Add the source path:__ the source path for the workspace should be added so that the ROS bridge can be used from a terminal: __2) Add the source path.__ The source path for the workspace has to be added, so that the ROS bridge can be used from a terminal.
* __Source for apt ROS bridge:__ * __Source for apt ROS bridge.__
```sh ```sh
source /opt/carla-ros-bridge/<melodic or kinetic>/setup.bash source /opt/carla-ros-bridge/<melodic or kinetic>/setup.bash
``` ```
* __Source for ROS bridge repository download:__ * __Source for ROS bridge repository download.__
```sh ```sh
source ~/carla-ros-bridge/catkin_ws/devel/setup.bash source ~/carla-ros-bridge/catkin_ws/devel/setup.bash
``` ```
!!! Important !!! Important
The source path can be added to the environment to be set permanently, but it will cause conflict when working with another workspace. The source path can be set permanently, but it will cause conflict when working with another workspace.
__3) start the ROS bridge:__ use any of the different launch files available that will serve to check if the bridge is running properly. Here are some suggestions: __3) Start the ROS bridge.__ Use any of the different launch files available to check the installation. Here are some suggestions.
```sh ```sh
# Option 1: start the ros bridge # Option 1: start the ros bridge
@ -106,54 +103,58 @@ roslaunch carla_ros_bridge carla_ros_bridge_with_rviz.launch
roslaunch carla_ros_bridge carla_ros_bridge_with_example_ego_vehicle.launch roslaunch carla_ros_bridge carla_ros_bridge_with_example_ego_vehicle.launch
``` ```
#### Solving ImportError: no module named CARLA <details>
<summary>
<h6>ImportError: no module named CARLA</h6>
</summary>
The path to CARLA Python is missing. The apt installation does this automatically, but it may be missing for other installations. Execute the following command with the complete path to the _.egg_ file (included). Use the one that, is supported by the Python version installed: The path to CARLA Python is missing. The apt installation does this automatically, but it may be missing for other installations. Execute the following command with the complete path to the <i>.egg</i> file (included). Use the one supported by the Python version installed.
<br>
<i><small><b>Note: </b>.egg files may be either in `/PythonAPI/` or `/PythonAPI/dist/` depending on the CARLA installation.</small></i>
```sh
export PYTHONPATH=$PYTHONPATH:<path/to/carla/>/PythonAPI/<your_egg_file> export PYTHONPATH=$PYTHONPATH:<path/to/carla/>/PythonAPI/<your_egg_file>
```
!!! Note Import CARLA from Python and wait for a sucess message to check the installation.
_.egg_ files may be either in `/PythonAPI/` or `/PythonAPI/dist/` depending on the CARLA installation.
To check the installation, import CARLA from Python and wait for a sucess message:
```sh ```sh
python -c 'import carla;print("Success")' python -c 'import carla;print("Success")'
``` ```
</details>
--- ---
## Setting CARLA ## Setting CARLA
Settings can be changed, in order to modify the way CARLA works along with the ROS bridge, by editing the file: [`share/carla_ros_bridge/config/settings.yaml`](https://github.com/carla-simulator/ros-bridge/blob/master/carla_ros_bridge/config/settings.yaml). To modify the way CARLA works along with the ROS bridge, edit [`share/carla_ros_bridge/config/settings.yaml`](https://github.com/carla-simulator/ros-bridge/blob/master/carla_ros_bridge/config/settings.yaml).
The parameters available refer to:
* __Host/port:__ the network settings to connect to CARLA using a Python client.
* __Synchronous mode:__
* __If false (default):__ data is published on every `world.on_tick()` and every `sensor.listen()` callbacks.
* __If true:__ the bridge waits for all the sensor messages expected before the next tick. This might slow down the overall simulation but ensures reproducible results.
* __Wait for vehicle command:__ in synchronous mode, pauses the tick until a vehicle control is completed.
* __Simulation time-step:__ simulation time (delta seconds) between simulation steps. __It must be lower than 0.1__. Take a look at the [documentation](../simulation_time_and_synchrony) to learn more about this.
* __Role names for the Ego vehicles:__ role names to identify ego vehicles. These will be controllable from ROS and thus, relevant topics will be created.
* __Host/port.__ Network settings to connect to CARLA using a Python client.
* __Synchronous mode.__
* __If false (default).__ Data is published on every `world.on_tick()` and every `sensor.listen()` callbacks.
* __If true__ The bridge waits for all the sensor messages expected before the next tick. This might slow down the overall simulation but ensures reproducible results.
* __Wait for vehicle command.__ In synchronous mode, pauses the tick until a vehicle control is completed.
* __Simulation time-step.__ Simulation time (delta seconds) between simulation steps. __It must be lower than 0.1__. Take a look at the [documentation](../simulation_time_and_synchrony) to learn more about this.
* __Role names for the Ego vehicles.__ Role names to identify ego vehicles. These will be controllable from ROS and thus, relevant topics will be created.
!!! Warning !!! Warning
In synchronous mode only the ros-bridge is allowed to tick. Other CARLA clients must passively wait. In synchronous mode only the ros-bridge is allowed to tick. Other clients must passively wait.
#### Synchronous mode ### Synchronous mode
The following topic allows to control the step update when in synchronous mode: To control the step update when in synchronous mode, use the following topic. The message contains a constant named `command` that allows to __Pause/Play__ the simulation, and execute a __single step__.
| Topic | Message type | <table class ="defTable">
| ---------------- | ----------------------- | <thead>
| `/carla/control` | [carla_msgs.CarlaControl](../ros_msgs#carlacontrolmsg) | <th>Topic</th>
<th>Message type</th>
</thead>
<tbody>
<td><code>/carla/control</code> </td>
<td><a href="../ros_msgs#carlacontrolmsg">carla_msgs.CarlaControl</a></td>
</tbody>
</table>
<br>
The message contains a constant named `command` that allows to: The [Control rqt plugin](https://github.com/carla-simulator/ros-bridge/blob/master/rqt_carla_control/README.md) launches a new window with a simple interface. It is used to manage the steps and publish in the corresponding topic. Simply run the following when CARLA in synchronous mode.
* Pause/Play the simulation.
* Execute a single step.
The [Control rqt plugin](https://github.com/carla-simulator/ros-bridge/blob/master/rqt_carla_control/README.md) launches a new window with a simple interface to manage these steps and publish in the corresponding topic.
Simply run the following when CARLA is in synchronous mode:
```sh ```sh
rqt --standalone rqt_carla_control rqt --standalone rqt_carla_control
``` ```

View File

@ -3,17 +3,20 @@
--- ---
## carla_ackermann_control.launch ## carla_ackermann_control.launch
Creates a node to manage a vehicle using Ackermann controls instead of the CARLA control messages. The node reads the vehicle info from CARLA and uses it to define the controller. A simple Python PID is used to adjust acceleration/velocity. It can be installed using: Creates a node to manage a vehicle using Ackermann controls instead of the CARLA control messages. The node reads the vehicle info from CARLA and uses it to define the controller. A simple Python PID is used to adjust acceleration/velocity. This is a Python dependency that can be easily installed with _pip_.
```sh ```sh
pip install --user simple-pid pip install --user simple-pid
``` ```
Initial parameters can be set in: `share/carla_ackermann_control/config/settings.yaml`. It is possible to modify the parameters in runtime via ROS dynamic reconfigure. Initial parameters can be set using a `settings.yaml`. The path to it depends on the bridge installation.
It is possible to modify the parameters during runtime via ROS dynamic reconfigure.
* __Deb repository installation__,
`/opt/carla-ros-bridge/melodic/share/carla_ackermann_control/config/settings.yaml`.
* __Source repository installation__,
`/catkin_ws/src/ros-bridge/carla_ackermann_control/config/settings.yaml`.
<!---NODE--> <!---NODE-->
<h4 style="margin-bottom: 5px"> <u>/carla_ackermann_control_ego_vehicle</u> <small><i>(Node)</i></small> </h4> <h4 style="margin-bottom: 5px"> <u>/carla_ackermann_control_ego_vehicle</u> <small><i>(Node)</i></small> </h4>
Converts [AckermannDrive messages](http://docs.ros.org/jade/api/ackermann_msgs/html/msg/AckermannDrive.htm) to [CarlaEgoVehicleControl.msg](../ros_msgs#carlaegovehiclemsg). Converts [AckermannDrive messages](http://docs.ros.org/jade/api/ackermann_msgs/html/msg/AckermannDrive.htm) to [CarlaEgoVehicleControl.msg](../ros_msgs#carlaegovehiclemsg). Speed is in __m/s__, steering angle in __radians__ and refers to driving angle, not wheel angle.
Speed is in __m/s__, steering angle is driving angle (not wheel angle) in __radians__.
<p style="margin-bottom:-5px"> <b>Subscribed to:</b> </p> <p style="margin-bottom:-5px"> <b>Subscribed to:</b> </p>
@ -32,12 +35,13 @@ Speed is in __m/s__, steering angle is driving angle (not wheel angle) in __radi
--- ---
## carla_ego_vehicle.launch ## carla_ego_vehicle.launch
Spawns an ego vehicle (`role-name="ego_vehicle"`). To describe the sensors attached to the vehicle, the `sensor_definition_file argument` is used. This contains the location of a __.json__ file describing sensors attached to the vehicle. The format for this file is explained [here](https://github.com/carla-simulator/ros-bridge/tree/master/carla_ego_vehicle). Spawns an ego vehicle (`role-name="ego_vehicle"`). The argument `sensor_definition_file` describes the sensors attached to the vehicle. It is the location of a __.json__ file. The format of this file is explained [here](https://github.com/carla-simulator/ros-bridge/tree/master/carla_ego_vehicle).
To spawn the vehicle at a specific location, publish in: `/carla/ego_vehicle/initialpose` or use __RVIZ__ and select a position with: __2D Pose estimate__.
To spawn the vehicle at a specific location, publish in `/carla/ego_vehicle/initialpose`, or use __RVIZ__ and select a position with __2D Pose estimate__.
<!---NODE--> <!---NODE-->
<h4 style="margin-bottom: 5px"> <u>carla_ego_vehicle_ego_vehicle</u> <small><i>(Node)</i></small> </h4> <h4 style="margin-bottom: 5px"> <u>carla_ego_vehicle_ego_vehicle</u> <small><i>(Node)</i></small> </h4>
Spawns an ego vehicle with sensors attached and waits for world information. Spawns an ego vehicle with sensors attached, and waits for world information.
<p style="margin-bottom:-5px"> <b>Subscribed to:</b> </p> <p style="margin-bottom:-5px"> <b>Subscribed to:</b> </p>
@ -46,7 +50,12 @@ Spawns an ego vehicle with sensors attached and waits for world information.
--- ---
## carla_example_ego_vehicle.launch ## carla_example_ego_vehicle.launch
Based on [carla_ego_vehicle.launch](#carla-ego-vehicle-launch), spawns an ego vehicle (`role-name="ego_vehicle"`) using a provided file describing the sensors. Said file can be found in: `share/carla_ego_vehicle/config/sensors.json`. Based on [carla_ego_vehicle.launch](#carla-ego-vehicle-launch), spawns an ego vehicle (`role-name="ego_vehicle"`). The file `sensors.json` describes the sensors attached. The path to it depends on the bridge installation.
* __Deb repository installation__,
`/opt/carla-ros-bridge/melodic/share/carla_ego_vehicle/config/sensors.json`.
* __Source repository installation__,
`/catkin_ws/src/ros-bridge/carla_ego_vehicle/config/sensors.json`.
<!---NODE--> <!---NODE-->
<h4 style="margin-bottom: 5px"> <u>carla_ego_vehicle_ego_vehicle</u> <small><i>(Node)</i></small> </h4> <h4 style="margin-bottom: 5px"> <u>carla_ego_vehicle_ego_vehicle</u> <small><i>(Node)</i></small> </h4>
@ -75,8 +84,7 @@ Creates a node with some basic communications between CARLA and ROS.
<!---NODE--> <!---NODE-->
<h4 style="margin-bottom: 5px"> <u>carla_ros_bridge</u> <small><i>(Node)</i></small> </h4> <h4 style="margin-bottom: 5px"> <u>carla_ros_bridge</u> <small><i>(Node)</i></small> </h4>
Publishes the data regarding the current state of the simulation: world, objects, trafic lights, actors... Publishes the data regarding the current state of the simulation. Reads the debug shapes being drawn.
Receives the debug shapes being drawn, which include: arrows, points, cubes and line strips.
<p style="margin-bottom:-5px"> <b>Subscribed to:</b> </p> <p style="margin-bottom:-5px"> <b>Subscribed to:</b> </p>
@ -93,12 +101,11 @@ Receives the debug shapes being drawn, which include: arrows, points, cubes and
--- ---
## carla_ros_bridge_with_ackermann_control.launch ## carla_ros_bridge_with_ackermann_control.launch
Launches two basic nodes, one to retrieve simulation data and another one to control a vehicle using [AckermannDrive messages](http://docs.ros.org/jade/api/ackermann_msgs/html/msg/AckermannDrive.htm). Launches two basic nodes. One retrieves simulation data, the other controls a vehicle using [AckermannDrive messages](http://docs.ros.org/jade/api/ackermann_msgs/html/msg/AckermannDrive.htm).
<!---NODE--> <!---NODE-->
<h4 style="margin-bottom: 5px"> <u>carla_ros_bridge</u> <small><i>(Node)</i></small> </h4> <h4 style="margin-bottom: 5px"> <u>carla_ros_bridge</u> <small><i>(Node)</i></small> </h4>
Publishes the data regarding the current state of the simulation: world, objects, trafic lights, actors... Publishes data regarding the current state of the simulation. Reads the debug shapes being drawn.
Receives the debug shapes being drawn, which include: arrows, points, cubes and line strips.10px
<p style="margin-bottom:-5px"> <b>Subscribed to:</b> </p> <p style="margin-bottom:-5px"> <b>Subscribed to:</b> </p>
@ -114,8 +121,7 @@ Receives the debug shapes being drawn, which include: arrows, points, cubes and
<!---NODE--> <!---NODE-->
<h4 style="margin-bottom: 5px"> <u>/carla_ackermann_control_ego_vehicle</u> <small><i>(Node)</i></small> </h4> <h4 style="margin-bottom: 5px"> <u>/carla_ackermann_control_ego_vehicle</u> <small><i>(Node)</i></small> </h4>
Converts [AckermannDrive messages](http://docs.ros.org/jade/api/ackermann_msgs/html/msg/AckermannDrive.htm) to [CarlaEgoVehicleControl.msg](../ros_msgs#carlaegovehiclemsg). Converts [AckermannDrive messages](http://docs.ros.org/jade/api/ackermann_msgs/html/msg/AckermannDrive.htm) to [CarlaEgoVehicleControl.msg](../ros_msgs#carlaegovehiclemsg). Speed is in __m/s__, steering angle is in __radians__ and refers to driving angle, not wheel angle.
Speed is in __m/s__, steering angle is driving angle (not wheel angle) in __radians__.
<p style="margin-bottom:-5px"> <b>Subscribed to:</b> </p> <p style="margin-bottom:-5px"> <b>Subscribed to:</b> </p>
@ -134,12 +140,11 @@ Speed is in __m/s__, steering angle is driving angle (not wheel angle) in __radi
--- ---
## carla_ros_bridge_with_example_ego_vehicle.launch ## carla_ros_bridge_with_example_ego_vehicle.launch
Spawns an ego vehicle with sensors attached and starts communications between CARLA and ROS sharing current simulation state, sensor and ego vehicle data. Spawns an ego vehicle with sensors attached, and starts communications between CARLA and ROS. Both share current simulation state, sensor and ego vehicle data. The ego vehicle is set ready to be used in manual control.
The ego vehicle is set ready to be used in manual control.
<!---NODE--> <!---NODE-->
<h4 style="margin-bottom: 5px"> <u>carla_ros_bridge</u> <small><i>(Node)</i></small> </h4> <h4 style="margin-bottom: 5px"> <u>carla_ros_bridge</u> <small><i>(Node)</i></small> </h4>
This node is in charge of most of the communications between CARLA and ROS for both the current state of the simulation, traffic lights, vehicle controllers and sensor data. In charge of the communications between CARLA and ROS. They share the current state of the simulation, traffic lights, vehicle controllers and sensor data.
<p style="margin-bottom:-5px"> <b>Subscribed to:</b> </p> <p style="margin-bottom:-5px"> <b>Subscribed to:</b> </p>
* <font color="f8815c"><b>/carla/debug_marker</b></font> — [visualization_msgs.MarkerArray](http://docs.ros.org/melodic/api/visualization_msgs/html/msg/MarkerArray.html) * <font color="f8815c"><b>/carla/debug_marker</b></font> — [visualization_msgs.MarkerArray](http://docs.ros.org/melodic/api/visualization_msgs/html/msg/MarkerArray.html)
@ -172,8 +177,7 @@ This node is in charge of most of the communications between CARLA and ROS for b
<!---NODE--> <!---NODE-->
<h4 style="margin-bottom: 5px"> <u>/carla_manual_control_ego_vehicle</u> <small><i>(Node)</i></small> </h4> <h4 style="margin-bottom: 5px"> <u>/carla_manual_control_ego_vehicle</u> <small><i>(Node)</i></small> </h4>
Retrieves information from CARLA regarding the ego vehicle. Uses keyboard input to publish messages containing the controller data to manage the ego vehicle. Retrieves information from CARLA regarding the ego vehicle. Uses keyboard input to publish controller messages for the ego vehicle. The information retrieved includes static data, current state, sensor data, and simulation settings.
The information retrieved includes both static and current state, the sensor data registered on every step and the general settings of the simulation.
<p style="margin-bottom:-5px"> <b>Subscribed to:</b> </p> <p style="margin-bottom:-5px"> <b>Subscribed to:</b> </p>
@ -195,16 +199,16 @@ The information retrieved includes both static and current state, the sensor dat
<!---NODE--> <!---NODE-->
<h4 style="margin-bottom: 5px"> <u>/carla_ego_vehicle_ego_vehicle</u> <small><i>(Node)</i></small> </h4> <h4 style="margin-bottom: 5px"> <u>/carla_ego_vehicle_ego_vehicle</u> <small><i>(Node)</i></small> </h4>
Spawns an ego vehicle with sensors attached and waits for world information. Spawns an ego vehicle with sensors attached. Reads world information.
<p style="margin-bottom:-5px"> <b>Subscribed to:</b> </p> <p style="margin-bottom:-5px"> <b>Subscribed to:</b> </p>
* <font color="f8815c"><b>/carla/ego_vehicle/initialpose</b></font> — [geometry_msgs/PoseWithCovarianceStamped](http://docs.ros.org/melodic/api/geometry_msgs/html/msg/PoseWithCovarianceStamped.html) * <font color="f8815c"><b>/carla/ego_vehicle/initialpose</b></font> — [geometry_msgs/PoseWithCovarianceStamped](http://docs.ros.org/melodic/api/geometry_msgs/html/msg/PoseWithCovarianceStamped.html)
--- ---
## carla_ros_bridge_with_rviz.launch ## carla_ros_bridge_with_rviz.launch
Starts some basic communications between CARLA and ROS and launches an instance of RVIZ ready to retrieve Lidar data.
Starts communications between CARLA and ROS, and launches RVIZ to retrieve Lidar data.
<!---NODE--> <!---NODE-->
<h4 style="margin-bottom: 5px"> <u>carla_ros_bridge</u> <small><i>(Node)</i></small> </h4> <h4 style="margin-bottom: 5px"> <u>carla_ros_bridge</u> <small><i>(Node)</i></small> </h4>
Shares information between CARLA and ROS regarding the current simulation state. Shares information between CARLA and ROS regarding the current simulation state.
@ -223,7 +227,7 @@ Shares information between CARLA and ROS regarding the current simulation state.
<!---NODE--> <!---NODE-->
<h4 style="margin-bottom: 5px"> <u>/rviz</u> <small><i>(Node)</i></small> </h4> <h4 style="margin-bottom: 5px"> <u>/rviz</u> <small><i>(Node)</i></small> </h4>
Runs an instance of RVIZ waiting for Lidar data. Runs an instance of RVIZ, and waits for Lidar data.
<p style="margin-bottom:-5px"> <b>Subscribed to:</b> </p> <p style="margin-bottom:-5px"> <b>Subscribed to:</b> </p>
@ -235,18 +239,16 @@ Runs an instance of RVIZ waiting for Lidar data.
--- ---
## carla_manual_control.launch ## carla_manual_control.launch
A ROS version of the CARLA script `manual_control.py` that receives and manages the information using ROS topics. It has some prerequisites: A ROS version of the CARLA script `manual_control.py`. It has some prequisites.
* To display an image: a camera with role-name 'view' and resolution 800x600. * __To display an image__, a camera with role-name `view` and resolution 800x600.
* To display the position: a gnss sensor with role-name 'gnss1'. * __To display the position__, a gnss sensor with role-name `gnss1`.
* To detect other sensor data: the corresponding sensor. * __To detect other sensor data__, the corresponding sensor.
<!---NODE--> <!---NODE-->
<h4 style="margin-bottom: 5px"> <u>/carla_manual_control_ego_vehicle</u> <small><i>(Node)</i></small> </h4> <h4 style="margin-bottom: 5px"> <u>/carla_manual_control_ego_vehicle</u> <small><i>(Node)</i></small> </h4>
Retrieves information from CARLA regarding the ego vehicle. Uses keyboard input to publish messages containing the controller data to manage the ego vehicle. Retrieves information from CARLA regarding the ego vehicle. Uses keyboard input to publish controller messages for the ego vehicle. The information retrieved includes static data, current state, sensor data, and simulation settings.
The information retrieved includes both static and current state, the sensor data registered on every step and the general settings of the simulation.
<p style="margin-bottom:-5px"> <b>Subscribed to:</b> </p> <p style="margin-bottom:-5px"> <b>Subscribed to:</b> </p>
@ -268,8 +270,10 @@ The information retrieved includes both static and current state, the sensor dat
--- ---
## carla_pcl_recorder.launch ## carla_pcl_recorder.launch
Creates a pointcloud map for the current CARLA level by letting an ego vehicle in autopilot mode roam around with a Lidar sensor attached. Creates a pointcloud map for the current CARLA level. An autopilot ego vehicle roams around the map with a LIDAR sensor attached.
The captured point clouds are saved in the `/tmp/pcl_capture` directory. Once the capture is done, the overall size can be reduced:
The point clouds are saved in the `/tmp/pcl_capture` directory. Once the capture is done, the overall size can be reduced.
```sh ```sh
#create one point cloud file #create one point cloud file
pcl_concatenate_points_pcd /tmp/pcl_capture/*.pcd pcl_concatenate_points_pcd /tmp/pcl_capture/*.pcd
@ -281,14 +285,15 @@ pcl_voxel_grid -leaf 0.1,0.1,0.1 output.pcd map.pcd
pcl_viewer map.pcd pcl_viewer map.pcd
``` ```
In order to run it, the launch file requires some functionality that is not part of the python egg-file, so the PYTHONPATH has to be extended: The launch file requires some functionality that is not part of the python egg-file. The PYTHONPATH has to be extended.
```sh ```sh
export PYTHONPATH=<path-to-carla>/PythonAPI/carla/dist/carla-<version_and_arch>.egg:<path-to-carla>/PythonAPI/carla/ export PYTHONPATH=<path-to-carla>/PythonAPI/carla/dist/carla-<version_and_arch>.egg:<path-to-carla>/PythonAPI/carla/
``` ```
<!---NODE--> <!---NODE-->
<h4 style="margin-bottom: 5px"> <u>carla_ros_bridge</u> <small><i>(Node)</i></small> </h4> <h4 style="margin-bottom: 5px"> <u>carla_ros_bridge</u> <small><i>(Node)</i></small> </h4>
This node is in charge of most of the communications between CARLA and ROS for both the current state of the simulation, traffic lights, vehicle controllers and sensor data. In charge of most of the communications between CARLA and ROS. Both share the current state of the simulation, traffic lights, vehicle controllers and sensor data.
<p style="margin-bottom:-5px"> <b>Subscribed to:</b> </p> <p style="margin-bottom:-5px"> <b>Subscribed to:</b> </p>
@ -322,8 +327,7 @@ This node is in charge of most of the communications between CARLA and ROS for b
<!---NODE--> <!---NODE-->
<h4 style="margin-bottom: 5px"> <u>/carla_manual_control_ego_vehicle</u> <small><i>(Node)</i></small> </h4> <h4 style="margin-bottom: 5px"> <u>/carla_manual_control_ego_vehicle</u> <small><i>(Node)</i></small> </h4>
Retrieves information from CARLA regarding the ego vehicle. Uses keyboard input to publish messages containing the controller data to manage the ego vehicle. Retrieves information from CARLA regarding the ego vehicle. Uses keyboard input to publish controller messages for the ego vehicle. The information retrieved includes static data, current state, sensor data, and simulation settings.
The information retrieved includes both static and current state, the sensor data registered on every step and the general settings of the simulation.
<p style="margin-bottom:-5px"> <b>Subscribed to:</b> </p> <p style="margin-bottom:-5px"> <b>Subscribed to:</b> </p>
@ -345,7 +349,7 @@ The information retrieved includes both static and current state, the sensor dat
<!---NODE--> <!---NODE-->
<h4 style="margin-bottom: 5px"> <u>/carla_ego_vehicle_ego_vehicle</u> <small><i>(Node)</i></small> </h4> <h4 style="margin-bottom: 5px"> <u>/carla_ego_vehicle_ego_vehicle</u> <small><i>(Node)</i></small> </h4>
Spawns an ego vehicle with sensors attached and waits for world information. Spawns an ego vehicle with sensors attached. Waits for world information.
<p style="margin-bottom:-5px"> <b>Subscribed to:</b> </p> <p style="margin-bottom:-5px"> <b>Subscribed to:</b> </p>
@ -362,7 +366,7 @@ Changes between autopilot and manual control modes.
<!---NODE--> <!---NODE-->
<h4 style="margin-bottom: 5px"> <u>/pcl_recorder_node</u> <small><i>(Node)</i></small> </h4> <h4 style="margin-bottom: 5px"> <u>/pcl_recorder_node</u> <small><i>(Node)</i></small> </h4>
Receives the cloud point data to map the surroundings. Receives the cloud point data.
<p style="margin-bottom:-5px"> <b>Subscribed to:</b> </p> <p style="margin-bottom:-5px"> <b>Subscribed to:</b> </p>
@ -371,20 +375,17 @@ Receives the cloud point data to map the surroundings.
--- ---
## carla_waypoint_publisher.launch ## carla_waypoint_publisher.launch
Calculates a waypoint route for an ego vehicle. Calculates a waypoint route for an ego vehicle. The route is published in `/carla/<ego vehicle name>/waypoints`. The goal is either read from the ROS topic `/carla/<ROLE NAME>/goal`, or a fixed spawnpoint is used.
The calculated route is published in: `/carla/<ego vehicle name>/waypoints`. The prefered way of setting a goal is to click __2D Nav Goal__ in RVIZ.
The goal is either read from the ROS topic `/carla/<ROLE NAME>/goal`, if available, or a fixed spawnpoint is used.
The prefered way of setting a goal is to click __2D Nav Goal__ in RVIZ.
The launch file requires some functionality that is not part of the python egg-file. The PYTHONPATH has to be extended.
In order to run it, the launch file requires some functionality that is not part of the python egg-file, so the PYTHONPATH has to be extended:
```sh ```sh
export PYTHONPATH=$PYTHONPATH:<path-to-carla>/PythonAPI/carla-<carla_version_and_arch>.egg:<path-to-carla>/PythonAPI/carla/ export PYTHONPATH=$PYTHONPATH:<path-to-carla>/PythonAPI/carla-<carla_version_and_arch>.egg:<path-to-carla>/PythonAPI/carla/
``` ```
<!---NODE--> <!---NODE-->
<h4 style="margin-bottom: 5px"> <u>/carla_waypoint_publisher</u> <small><i>(Node)</i></small> </h4> <h4 style="margin-bottom: 5px"> <u>/carla_waypoint_publisher</u> <small><i>(Node)</i></small> </h4>
Uses the current pose of the ego vehicle with role-name `ego_vehicle` as starting point. If the vehicle is respawned or moved, the route is calculated again. Uses the current pose of the ego vehicle as starting point. If the vehicle is respawned or moved, the route is calculated again.
<p style="margin-bottom:-5px"> <b>Subscribed to:</b> </p> <p style="margin-bottom:-5px"> <b>Subscribed to:</b> </p>

View File

@ -1,7 +1,8 @@
# CARLA messages reference # CARLA messages reference
The following reference lists all the CARLA messages available in the ROS bridge. These can be used to enable communication in both ways. The following reference lists all the CARLA messages available in the ROS bridge.
Any doubts regarding these messages or the CARLA-ROS bridge can be solved in the forum:
Any doubts regarding these messages or the CARLA-ROS bridge can be solved in the forum.
<div class="build-buttons"> <div class="build-buttons">
<!-- Latest release button --> <!-- Latest release button -->
@ -14,45 +15,96 @@ CARLA forum</a>
--- ---
## CarlaActorInfo.msg ## CarlaActorInfo.msg
Comprises the information regarding an actor to be shared between ROS and CARLA. Information shared between ROS and CARLA regarding an actor.
The [CarlaActorList.msg](#carlaactorlist) message is a list of these items.
<table class ="defTable">
<thead>
<th>Field</th>
<th>Type</th>
<th>Description</th>
</thead>
<tbody>
<td><code>id</code> </td>
<td>uint32</td>
<td>The ID of the actor.</td>
<tr>
<td><code>parent_id</code> </td>
<td>uint32</td>
<td>The ID of the parent actor. `0` if no parent available.</td>
<tr>
<td><code>type</code> </td>
<td>string</td>
<td>The identifier of the blueprint this actor was based on.</td>
<tr>
<td><code>rolename</code> </td>
<td>string</td>
<td>Role assigned to the actor when spawned.</td>
</tbody>
</table>
| Field | Type | Description |
| ----------- | ------ | ----------- |
| `id` | uint32 | The ID of the actor. |
| `parent_id` | uint32 | The ID of the parent actor. `0` if no parent available. |
| `type` | string | The identifier of the blueprint this actor was based on. |
| `rolename` | string | Role assigned to the actor when spawned. |
--- ---
## CarlaActorList.msg ## CarlaActorList.msg
Contains a list of messages with some basic information for CARLA actors. A list of messages with some basic information for CARLA actors.
| Field | Type | Description | <table class ="defTable">
| ----------- | ---------------- | ----------- | <thead>
| `actors` | [CarlaActorInfo](#carlaactorinfomsg)[] | List of messages with actors' information. | <th>Field</th>
<th>Type</th>
<th>Description</th>
</thead>
<tbody>
<td><code>actors</code> </td>
<td><a href="#carlaactorinfomsg">CarlaActorInfo</a></td>
<td>List of messages with actors' information.</td>
</tobody>
</table>
--- ---
## CarlaCollisionEvent.msg ## CarlaCollisionEvent.msg
Registers information regarding a collision event detected by the collision sensor of an actor. Data retrieved on a collision event detected by the collision sensor of an actor.
<table class ="defTable">
<thead>
<th>Field</th>
<th>Type</th>
<th>Description</th>
</thead>
<tbody>
<td><code>header</code> </td>
<td><a href="http://docs.ros.org/melodic/api/std_msgs/html/msg/Header.html">Header</a></td>
<td>Time stamp and frame ID when the message is published.</td>
<tr>
<td><code>other_actor_id</code> </td>
<td>uint32</td>
<td>ID of the actor against whom the collision was detected.</td>
<tr>
<td><code>normal_impulse</code> </td>
<td>geometry_msgs/Vector3</td>
<td>Vector representing resulting impulse from the collision.</td>
</tbody>
</table>
| Field | Type | Description |
| ---------------- | --------------------- | ----------- |
| `header` | [Header](http://docs.ros.org/melodic/api/std_msgs/html/msg/Header.html) | Time stamp and frame ID when the message is published. |
| `other_actor_id` | uint32 | ID of the actor against whom the collision was detected. |
| `normal_impulse` | geometry_msgs/Vector3 | Vector representing resulting impulse from the collision. |
--- ---
## CarlaControl.msg ## CarlaControl.msg
These messages are used to control the simulation while in synchronous mode. The constant defined is translated as stepping commands. These messages control the simulation while in synchronous mode. The constant defined is translated as stepping commands.
| Field | Type | Description |
| ----------- | ---- | ----------- |
| `command` | int8 | __PLAY__=0 <br> __PAUSE__=1 <br> __STEP_ONCE__=2 |
<table class ="defTable">
<thead>
<th>Field</th>
<th>Type</th>
<th>Description</th>
</thead>
<tbody>
<td><code>command</code> </td>
<td>int8</td>
<td><b>PLAY</b>=0 <br> <b>PAUSE</b>=1 <br> <b>STEP_ONCE</b>=2</td>
</tbody>
</table>
<br> <br>
!!! Important !!! Important
@ -63,239 +115,644 @@ These messages are used to control the simulation while in synchronous mode. The
Messages sent to apply a control to a vehicle in both modes, autopilot and manual. These are published in a stack. Messages sent to apply a control to a vehicle in both modes, autopilot and manual. These are published in a stack.
| Field | Type | Description | <table class ="defTable">
| ------------------- | ------- | ----------- | <thead>
| `header` | [Header](http://docs.ros.org/melodic/api/std_msgs/html/msg/Header.html) | Time stamp and frame ID when the message is published. | <th>Field</th>
| `throttle` | float32 | Scalar value to cotrol the vehicle throttle: __[0.0, 1.0]__ | <th>Type</th>
| `steer` | float32 | Scalar value to control the vehicle steering direction: __[-1.0, 1.0]__ to control the vehicle steering | <th>Description</th>
| `brake` | float32 | Scalar value to control the vehicle brakes: __[0.0, 1.0]__ | </thead>
| `hand_brake` | bool | If __True__, the hand brake is enabled. | <tbody>
| `reverse` | bool | If __True__, the vehicle will move reverse. | <td><code>header</code> </td>
| `gear` | int32 | Changes between the available gears in a vehicle. | <td><a href="http://docs.ros.org/melodic/api/std_msgs/html/msg/Header.html">Header</a></td>
| `manual_gear_shift` | bool | If __True__, the gears will be shifted using `gear`. | <td>Time stamp and frame ID when the message is published.</td>
<tr>
<td><code>throttle</code> </td>
<td>float32</td>
<td>Scalar value to cotrol the vehicle throttle: <b>[0.0, 1.0]</b></td>
<tr>
<td><code>steer</code> </td>
<td>float32</td>
<td>Scalar value to control the vehicle steering direction: <b>[-1.0, 1.0]</b> to control the vehicle steering</td>
<tr>
<td><code>brake</code> </td>
<td>float32</td>
<td>Scalar value to control the vehicle brakes: <b>[0.0, 1.0]</b></td>
<tr>
<td><code>hand_brake</code> </td>
<td>bool</td>
<td>If <b>True</b>, the hand brake is enabled.</td>
<tr>
<td><code>reverse</code> </td>
<td>bool</td>
<td>If <b>True</b>, the vehicle will move reverse.</td>
<tr>
<td><code>gear</code> </td>
<td>int32</td>
<td>Changes between the available gears in a vehicle.</td>
<tr>
<td><code>manual_gear_shift</code> </td>
<td>bool</td>
<td>If <b>True</b>, the gears will be shifted using <code>gear</code>.</td>
</tbody>
</table>
<br>
--- ---
## CarlaEgoVehicleInfo.msg ## CarlaEgoVehicleInfo.msg
Contains some static information regarding a vehicle, mostly the attributes used to define the vehicle's physics. Static information regarding a vehicle, mostly the attributes used to define the vehicle's physics.
<table class ="defTable">
<thead>
<th>Field</th>
<th>Type</th>
<th>Description</th>
</thead>
<tbody>
<td><code>id</code> </td>
<td>uint32</td>
<td>ID of the vehicle actor.</td>
<tr>
<td><code>type</code> </td>
<td>string</td>
<td>The identifier of the blueprint this vehicle was based on.</td>
<tr>
<td><code>type</code> </td>
<td>string</td>
<td>The identifier of the blueprint this vehicle was based on.</td>
<tr>
<td><code>rolename</code> </td>
<td>string</td>
<td>Role assigned to the vehicle.</td>
<tr>
<td><code>wheels</code> </td>
<td><a href="#carlaegovehicleinfowheel">CarlaEgoVehicleInfoWheel</a></td>
<td>List of messages with information regarding wheels.</td>
<tr>
<td><code>max_rpm</code> </td>
<td>float32</td>
<td>Maximum RPM of the vehicle's engine.</td>
<tr>
<td><code>moi</code> </td>
<td>float32</td>
<td>Moment of inertia of the vehicle's engine.</td>
<tr>
<td><code>damping_rate_full_throttle</code> </td>
<td>float32</td>
<td>Damping rate when the throttle is at maximum.</td>
<tr>
<td><code>damping_rate_zero_throttle</code><br><code>_clutch_engaged</code> </td>
<td>float32</td>
<td>Damping rate when the throttle is zero with clutch engaged.</td>
<tr>
<td><code>damping_rate_zero_throttle</code><br><code>_clutch_disengaged</code> </td>
<td>float32</td>
<td>Damping rate when the throttle is zero with clutch disengaged.</td>
<tr>
<td><code>use_gear_autobox</code> </td>
<td>bool</td>
<td>If <b>True</b>, the vehicle will have an automatic transmission.</td>
<tr>
<td><code>gear_switch_time</code> </td>
<td>float32</td>
<td>Switching time between gears.</td>
<tr>
<td><code>clutch_strength</code> </td>
<td>float32</td>
<td>The clutch strength of the vehicle. Measured in <b>Kgm^2/s</b>.</td>
<tr>
<td><code>mass</code> </td>
<td>float32</td>
<td>The mass of the vehicle measured in Kg.</td>
<tr>
<td><code>drag_coefficient</code> </td>
<td>float32</td>
<td>Drag coefficient of the vehicle's chassis.</td>
<tr>
<td><code>center_of_mass</code> </td>
<td>geometry_msgs/Vector3</td>
<td>The center of mass of the vehicle.</td>
</tbody>
</table>
<br>
| Field | Type | Description |
| --------------------------------------------- | ------------------------------------------------------- | ----------- |
| `id` | uint32 | ID of the vehicle actor. |
| `type` | string | The identifier of the blueprint this vehicle was based on. |
| `rolename` | string | Role assigned to the vehicle. |
| `wheels` | [CarlaEgoVehicleInfoWheel](#carlaegovehicleinfowheel)[] | List of messages with information regarding wheels. |
| `max_rpm` | float32 | Maximum RPM of the vehicle's engine. |
| `moi` | float32 | Moment of inertia of the vehicle's engine. |
| `damping_rate_full_throttle` | float32 | Damping rate when the throttle is at maximum. |
| `damping_rate_zero_throttle_clutch_engaged` | float32 | Damping rate when the throttle is zero with clutch engaged. |
| `damping_rate_zero_throttle_clutch_disengaged`| float32 | Damping rate when the throttle is zero with clutch disengaged. |
| `use_gear_autobox` | bool | If __True__, the vehicle will have an automatic transmission. |
| `gear_switch_time` | float32 | Switching time between gears. |
| `clutch_strength` | float32 | The clutch strength of the vehicle. Measured in __Kgm^2/s__. |
| `mass` | float32 | The mass of the vehicle measured in Kg. |
| `drag_coefficient` | float32 | Drag coefficient of the vehicle's chassis. |
| `center_of_mass` | geometry_msgs/Vector3 | The center of mass of the vehicle. |
--- ---
## CarlaEgoVehicleInfoWheel.msg ## CarlaEgoVehicleInfoWheel.msg
Contains some static information regarding a wheel that will be part of a [CarlaEgoVehicleInfo.msg](#carlaegovehicleinfo) message. Static information regarding a wheel that will be part of a [CarlaEgoVehicleInfo.msg](#carlaegovehicleinfo) message.
| Field | Type | Description | <table class ="defTable">
| ---------------------- | --------------------- | ----------- | <thead>
| `tire_friction` | float32 | A scalar value that indicates the friction of the wheel. | <th>Field</th>
| `damping_rate` | float32 | The damping rate of the wheel. | <th>Type</th>
| `max_steer_angle` | float32 | The maximum angle in degrees that the wheel can steer. | <th>Description</th>
| `radius` | float32 | The radius of the wheel in centimeters. | </thead>
| `max_brake_torque` | float32 | The maximum brake torque in Nm. | <tbody>
| `max_handbrake_torque` | float32 | The maximum handbrake torque in Nm. | <td><code>tire_friction</code> </td>
| `position` | gemoetry_msgs/Vector3 | World position of the wheel. | <td>float32</td>
<td>A scalar value that indicates the friction of the wheel.</td>
<tr>
<td><code>damping_rate</code> </td>
<td>float32</td>
<td>The damping rate of the wheel.</td>
<tr>
<td><code>max_steer_angle</code> </td>
<td>float32</td>
<td>The maximum angle in degrees that the wheel can steer.</td>
<tr>
<td><code>radius</code> </td>
<td>float32</td>
<td>The radius of the wheel in centimeters.</td>
<tr>
<td><code>max_brake_torque</code> </td>
<td>float32</td>
<td>The maximum brake torque in Nm.</td>
<tr>
<td><code>max_handbrake_torque</code> </td>
<td>float32</td>
<td>The maximum handbrake torque in Nm.</td>
<tr>
<td><code>position</code> </td>
<td>geometry_msgs/Vector3</td>
<td>World position of the wheel.</td>
</tbody>
</table>
<br>
--- ---
## CarlaEgoVehicleStatus.msg ## CarlaEgoVehicleStatus.msg
Details the current status of the vehicle as an object in the world. Current status of the vehicle as an object in the world.
| Fied | Type | Description | <table class ="defTable">
| ------------- | ------------------------------------------------- | ----------- | <thead>
| `header` | [Header](http://docs.ros.org/melodic/api/std_msgs/html/msg/Header.html) | Time stamp and frame ID when the message is published. | <th>Field</th>
| `velocity` | float32 | Current speed of the vehicle. | <th>Type</th>
| `acceleration`| geometry_msgs/Accel | Current acceleration of the vehicle. | <th>Description</th>
| `orientation` | geometry_msgs/Quaternion | Current orientation of the vehicle. | </thead>
| `control` | [CarlaEgoVehicleControl](#carlaegovehiclecontrol) | Current control values as reported by CARLA. | <tbody>
<td><code>header</code> </td>
<td><a hre="http://docs.ros.org/melodic/api/std_msgs/html/msg/Header.html">header</a></td>
<td>Time stamp and frame ID when the message is published.</td>
<tr>
<td><code>velocity</code> </td>
<td>float32</td>
<td>Current speed of the vehicle.</td>
<tr>
<td><code>acceleration</code> </td>
<td>geometry_msgs/Accel</td>
<td>Current acceleration of the vehicle.</td>
<tr>
<td><code>orientation</code> </td>
<td>geometry_msgs/Quaternion</td>
<td>Current orientation of the vehicle.</td>
<tr>
<td><code>control</code> </td>
<td><a href="#carlaegovehiclecontrol">CarlaEgoVehicleControl</a></td>
<td>Current control values as reported by CARLA.</td>
</tbody>
</table>
<br>
--- ---
## CarlaLaneInvasionEvent.msg ## CarlaLaneInvasionEvent.msg
These messages are used to publish lane invasions detected by a lane-invasion sensor attached to a vehicle. The invasions detected in the last step are passed as a list with a constant definition to identify the lane crossed. These messages publish lane invasions detected by a lane-invasion sensor attached to a vehicle. The invasions detected in the last step are passed as a list with a constant definition to identify the lane crossed.
<table class ="defTable">
<thead>
<th>Field</th>
<th>Type</th>
<th>Description</th>
</thead>
<tbody>
<td><code>header</code> </td>
<td><a href="http://docs.ros.org/melodic/api/std_msgs/html/msg/Header.html">header</a></td>
<td>Time stamp and frame ID when the message is published.</td>
<tr>
<td><code>crossed_lane_markings</code> </td>
<td>int32[]</td>
<td><b>LANE_MARKING_OTHER</b>=0 <br> <b>LANE_MARKING_BROKEN</b>=1 <br> <b>LANE_MARKING_SOLID</b>=2</td>
</tbody>
</table>
<br>
| Field | Type | Description |
| ----------------------- | ------- | ----------- |
| `header` | [Header](http://docs.ros.org/melodic/api/std_msgs/html/msg/Header.html) | Time stamp and frame ID when the message is published. |
| `crossed_lane_markings` | int32[] | __LANE_MARKING_OTHER__=0 <br> __LANE_MARKING_BROKEN__=1 <br> __LANE_MARKING_SOLID__=2 |
--- ---
## CarlaScenario.msg ## CarlaScenario.msg
Details for a test scenario. Details for a test scenario.
| Field | Type | Description | <table class ="defTable">
| ---------------| ------------------ | --------------------------------------------- | <thead>
| `name` | string | Name of the scenario. | <th>Field</th>
| `scenario_file`| string | Test file for the scenario. | <th>Type</th>
| `destination` | geometry_msgs/Pose | Goal location of the scenario. | <th>Description</th>
| `target_speed` | float64 | Desired speed to drive at during the scenario | </thead>
<tbody>
<td><code>name</code> </td>
<td>string</td>
<td>Name of the scenario.</td>
<tr>
<td><code>scenario_file</code> </td>
<td>string</td>
<td>Test file for the scenario.</td>
<tr>
<td><code>destination</code> </td>
<td>geometry_msgs/Pose</td>
<td>Goal location of the scenario.</td>
<tr>
<td><code>target_speed</code> </td>
<td>float64</td>
<td>Desired speed during the scenario.</td>
</tbody>
</table>
<br>
--- ---
## CarlaScenarioList.msg ## CarlaScenarioList.msg
Contains a list of test scenarios to run in ScenarioRunner. List of test scenarios to run in ScenarioRunner.
| Field | Type | Description | <table class ="defTable">
| ----------- | ------------------------------------ | ---------------------- | <thead>
| `scenarios` | [CarlaScenario](#carlascenariomsg)[] | The list of scenarios. | <th>Field</th>
<th>Type</th>
<th>Description</th>
</thead>
<tbody>
<td><code>scenarios</code> </td>
<td><a href="#carlascenariomsg">CarlaScenario[]</a></td>
<td>List of scenarios.</td>
</tbody>
</table>
<br>
--- ---
## CarlaScenarioRunnerStatus.msg ## CarlaScenarioRunnerStatus.msg
Represents the current state of the ScenarioRunner, that can be managed using an enum definition. Current state of the ScenarioRunner. It is managed using a constant.
| Field | Type | Description | <table class ="defTable">
| -------- | ----- | -------------------------------------------------------------------------------------------------------------------------------------------- | <thead>
| `status` | uint8 | Current state of the scenario as an enum: <br> __STOPPED__=0 <br> __STARTING__=1 <br> __RUNNING__=2 <br> __SHUTTINGDOWN__=3 <br> __ERROR__=4 | <th>Field</th>
<th>Type</th>
<th>Description</th>
</thead>
<tbody>
<td><code>status</code> </td>
<td>uint8</td>
<td>Current state of the scenario as an enum: <br> <b>STOPPED</b>=0 <br> <b>STARTING</b>=1 <br> <b>RUNNING</b>=2 <br> <b>SHUTTINGDOWN</b>=3 <br> <b>ERROR</b>=4</td>
</tbody>
</table>
<br>
--- ---
## CarlaStatus.msg ## CarlaStatus.msg
Details the current world settings of the simulation. Current world settings of the simulation.
| Field | Type | Description | <table class ="defTable">
| -------------------------- | ------- | ------------------------------------------------------------- | <thead>
| `frame` | uint64 | Current frame number. | <th>Field</th>
| `fixed_delta_seconds` | float32 | Simulation time between last and current step. | <th>Type</th>
| `synchronous_mode` | bool | If __True__, synchronous mode is enabled. | <th>Description</th>
| `synchronous_mode_running` | bool | __True__ when the simulation is running. __False__ when it is paused. | </thead>
<tbody>
<td><code>frame</code> </td>
<td>uint64</td>
<td>Current frame number.</td>
<tr>
<td><code>fixed_delta_seconds</code> </td>
<td>float32</td>
<td>Simulation time between last and current step.</td>
<tr>
<td><code>synchronous_mode</code> </td>
<td>bool</td>
<td>If <b>True</b>, synchronous mode is enabled.</td>
<tr>
<td><code>synchronous_mode_running</code> </td>
<td>bool</td>
<td><b>True</b> when the simulation is running. <b>False</b> when it is paused.</td>
</tbody>
</table>
<br>
--- ---
## CarlaTrafficLightStatus.msg ## CarlaTrafficLightStatus.msg
Contains a constant definition regarding the state of a traffic light. Constant definition regarding the state of a traffic light.
| Field | Type | Description | <table class ="defTable">
| -------------------------- | ------- | ----------------------------------------- | <thead>
| `id` | uint32 | ID of the traffic light actor. | <th>Field</th>
| `state` | uint8 | __RED__=0 <br> __YELLOW__=1 <br> __GREEN__=2 <br> __OFF__=3 <br> __UNKNOWN__=4 | <th>Type</th>
<th>Description</th>
</thead>
<tbody>
<td><code>id</code> </td>
<td>uint32</td>
<td>ID of the traffic light actor.</td>
<tr>
<td><code>state</code> </td>
<td>uint8</td>
<td><b>RED</b>=0 <br> <b>YELLOW</b>=1 <br> <b>GREEN</b>=2 <br> <b>OFF</b>=3 <br> <b>UNKNOWN</b>=4</td>
</tbody>
</table>
<br>
--- ---
## CarlaTrafficLightStatusList.msg ## CarlaTrafficLightStatusList.msg
Comprises a list of all traffic lights with their status. List of traffic lights with their status.
| Field | Type | Description | <table class ="defTable">
| ---------------- | ----------------------------------------------------- | ---------------- | <thead>
| `traffic_lights` | [CarlaTrafficLightStatus](#carlatrafficlightstatus)[] | A list of messages summarizing traffic light states. | <th>Field</th>
<th>Type</th>
<th>Description</th>
</thead>
<tbody>
<td><code>scenarios</code> </td>
<td><a href="#carlatrafficlightstatus">CarlaTrafficLightStatus`[]</a></td>
<td>A list of messages summarizing traffic light states.</td>
</tbody>
</table>
<br>
--- ---
## CarlaWalkerControl.msg ## CarlaWalkerControl.msg
Contains the information needed to apply a movement controller to a walker. Information needed to apply a movement controller to a walker.
| Field | Type | Description | <table class ="defTable">
| ----------- | ---------------------- | ----------------------------- | <thead>
| `direction` | geometry_msgs/Vector3 | Vector that controls the direction of the walker. | <th>Field</th>
| `speed` | float32 | A scalar value to control the walker's speed. | <th>Type</th>
| `jump` | bool | If __True__, the walker will jump. | <th>Description</th>
</thead>
<tbody>
<td><code>direction</code> </td>
<td>geometry_msgs/Vector3</td>
<td>Vector that controls the direction of the walker.</td>
<tr>
<td><code>speed</code> </td>
<td>float32</td>
<td>A scalar value to control the walker's speed.</td>
<tr>
<td><code>jump</code> </td>
<td>bool</td>
<td>If <b>True</b>, the walker will jump.</td>
</tbody>
</table>
<br>
--- ---
## CarlaWaypoint.msg ## CarlaWaypoint.msg
Summarizes data contained in a waypoint. Data contained in a waypoint object.
| Field | Type | Description | <table class ="defTable">
| ------------- | ------------------ | ----------------------------- | <thead>
| `road_id` | int32 | OpenDRIVE road's id. | <th>Field</th>
| `section_id` | int32 | OpenDRIVE section's id, based on the order that they are originally defined. | <th>Type</th>
| `lane_id` | int32 | OpenDRIVE lane's id, this value can be positive or negative which represents the direction of the current lane with respect to the road. | <th>Description</th>
| `is_junction` | bool | __True__ if the current Waypoint is on a junction as defined by OpenDRIVE. | </thead>
| `pose` | [geometry_msgs/Pose](http://docs.ros.org/api/geometry_msgs/html/msg/Pose.html) | Position and orientation of the waypoint. | <tbody>
<td><code>road_id</code> </td>
<td>int32</td>
<td>OpenDRIVE road's id.</td>
<tr>
<td><code>section_id</code> </td>
<td>int32</td>
<td>OpenDRIVE section's id, based on the order that they are originally defined.</td>
<tr>
<td><code>lane_id</code> </td>
<td>int32</td>
<td>OpenDRIVE lane's id, this value can be positive or negative which represents the direction of the current lane with respect to the road.</td>
<tr>
<td><code>is_junction</code> </td>
<td>bool</td>
<td><b>True</b>, if the current Waypoint is on a junction as defined by OpenDRIVE.</td>
<tr>
<td><code>is_junction</code> </td>
<td><a href="http://docs.ros.org/api/geometry_msgs/html/msg/Pose.html">geometry_msgs/Pose</a></td>
<td><b>True</b> when the simulation is running. <b>False</b> when it is paused.</td>
</tbody>
</table>
<br>
--- ---
## CarlaWorldInfo.msg ## CarlaWorldInfo.msg
Information about the current CARLA map (name and OpenDRIVE). Information about the current CARLA map.
| Field | Type | Description | <table class ="defTable">
| ----------- | ------- | ----------------------------- | <thead>
| `map_name` | string | Name of the CARLA map loaded in the current world. | <th>Field</th>
| `opendrive` | string | .xodr OpenDRIVE file of the current map as a string. | <th>Type</th>
<th>Description</th>
</thead>
<tbody>
<td><code>map_name</code> </td>
<td>string</td>
<td>Name of the CARLA map loaded in the current world.</td>
<tr>
<td><code>opendrive</code> </td>
<td>string</td>
<td>.xodr OpenDRIVE file of the current map as a string.</td>
</tbody>
</table>
<br>
--- ---
## EgoVehicleControlCurrent.msg ## EgoVehicleControlCurrent.msg
Represents the current time, speed and acceleration values of the vehicle used by the controller. It is part of a `Carla_Ackermann_Control.EgoVehicleControlInfo.msg` message. Current time, speed and acceleration values of the vehicle. Used by the controller. It is part of a `Carla_Ackermann_Control.EgoVehicleControlInfo.msg` message.
| Field | Type | Description | <table class ="defTable">
| ----------- | -------- | ----------------------------- | <thead>
| `time_sec` | float32 | Current time when the controller is applied. | <th>Field</th>
| `speed` | float32 | Current speed applied by the controller. | <th>Type</th>
| `speed_abs` | float32 | Speed as an absolute value. | <th>Description</th>
| `accel` | float32 | Current acceleration applied by the controller. | </thead>
<tbody>
<td><code>time_sec</code> </td>
<td>float32</td>
<td>Current time when the controller is applied.</td>
<tr>
<td><code>speed</code> </td>
<td>float32</td>
<td>Current speed applied by the controller.</td>
<tr>
<td><code>speed_abs</code> </td>
<td>float32</td>
<td>Speed as an absolute value.</td>
<tr>
<td><code>accel</code> </td>
<td>float32</td>
<td>Current acceleration applied by the controller.</td>
</tbody>
</table>
<br>
--- ---
## EgoVehicleControlInfo.msg ## EgoVehicleControlInfo.msg
Contains all the current values used within an Ackermann controller. These messages are useful for debugging. Current values within an Ackermann controller. These messages are useful for debugging.
| Field | Type | Description |
| -------------- | ----------------------------------------------------------------------- | ------------------------------ |
| `header` | [Header](http://docs.ros.org/melodic/api/std_msgs/html/msg/Header.html) | Time stamp and frame ID when the message is published. |
| `restrictions` | [EgoVehicleControlMaxima](#egovehiclecontrolmaximamsg) | Limits to the controller values. |
| `target` | [EgoVehicleControlTarget](#egovehiclecontroltargetmsg) | Target values the controller aims for. |
| `current` | [EgoVehicleControlCurrent](#egovehiclecontrolcurrentmsg) | Currently measured values. |
| `status` | [EgoVehicleControlStatus](#egovehiclecontrolstatusmsg) | Current control status. |
| `output` | [CarlaEgoVehicleControl](#carlaegovehiclecontrolmsg) | Output controller that will be applied in CARLA. |
<table class ="defTable">
<thead>
<th>Field</th>
<th>Type</th>
<th>Description</th>
</thead>
<tbody>
<td><code>header</code> </td>
<td><a href="http://docs.ros.org/melodic/api/std_msgs/html/msg/Header.html">header</a></td>
<td>Time stamp and frame ID when the message is published.</td>
<tr>
<td><code>restrictions</code> </td>
<td><a href="#egovehiclecontrolmaximamsg">EgoVehicleControlMaxima</a></td>
<td>Limits to the controller values.</td>
<tr>
<td><code>target</code> </td>
<td><a href="#egovehiclecontroltargetmsg">EgoVehicleControlTarget</a></td>
<td>Limits to the controller values.</td>
<tr>
<td><code>current</code> </td>
<td><a href="#egovehiclecontrolcurrentmsg">EgoVehicleControlCurrent</a></td>
<td>Limits to the controller values.</td>
<tr>
<td><code>status</code> </td>
<td><a href="#egovehiclecontrolstatusmsg">EgoVehicleControlStatus</a></td>
<td>Limits to the controller values.</td>
<tr>
<td><code>output</code> </td>
<td><a href="#carlaegovehiclecontrolmsg">CarlaEgoVehicleControl</a></td>
<td>Limits to the controller values.</td>
</tbody>
</table>
<br>
--- ---
## EgoVehicleControlMaxima.msg ## EgoVehicleControlMaxima.msg
Represents the restrictions of a controller (limit values). It is part of a `Carla_Ackermann_Control.EgoVehicleControlInfo.msg` message. Controller restrictions (limit values). It is part of a `Carla_Ackermann_Control.EgoVehicleControlInfo.msg` message.
| Field | Type | Description | <table class ="defTable">
| -------------------- | -------- | ----------------------------- | <thead>
| `max_steering_angle` | float32 | Max. steering angle for a vehicle. | <th>Field</th>
| `max_speed` | float32 | Max. speed for a vehicle. | <th>Type</th>
| `max_accel` | float32 | Max. acceleration for a vehicle. | <th>Description</th>
| `max_decel` | float32 | Max. deceleration for a vehicle. Default: __8 m/s^2__ | </thead>
| `min_accel` | float32 | Min. acceleration for a vehicle. When the Ackermann taget accel. exceeds this value, the input accel. is controlled. | <tbody>
| `max_pedal` | float32 | Min. pedal. |<!---- TBF> <td><code>max_steering_angle</code> </td>
<td>float32</td>
<td>Max. steering angle for a vehicle.</td>
<tr>
<td><code>max_speed</code> </td>
<td>float32</td>
<td>Max. speed for a vehicle.</td>
<tr>
<td><code>max_accel</code> </td>
<td>float32</td>
<td>Max. acceleration for a vehicle.</td>
<tr>
<td><code>max_decel</code> </td>
<td>float32</td>
<td>Max. deceleration for a vehicle. Default: <b>8m/s^2</b></td>
<tr>
<td><code>min_accel</code> </td>
<td>float32</td>
<td>Min. acceleration for a vehicle. When the Ackermann taget accel. exceeds this value, the input accel. is controlled.</td>
<tr>
<td><code>max_pedal</code> </td><!---- TBF> <---->
<td>float32</td>
<td>Min. pedal.</td>
</tbody>
</table>
<br>
--- ---
## EgoVehicleControlStatus.msg ## EgoVehicleControlStatus.msg
Represents the current status of the ego vehicle controller. It is part of a `Carla_Ackermann_Control.EgoVehicleControlInfo.msg` message. Current status of the ego vehicle controller. It is part of a `Carla_Ackermann_Control.EgoVehicleControlInfo.msg` message.
| Field | Type | Description | <table class ="defTable">
| -------------------------------- | ------- | ----------------------------- | <thead>
| `status` | string | Current control status. |<!---- TBF> <th>Field</th>
| `speed_control_activation_count` | uint8 | Speed controller. |<!---- TBF> <th>Type</th>
| `speed_control_accel_delta` | float32 | Speed controller. |<!---- TBF> <th>Description</th>
| `speed_control_accel_target` | float32 | Speed controller. |<!---- TBF> </thead>
| `accel_control_pedal_delta` | float32 | Acceleration controller. |<!---- TBF> <tbody>
| `accel_control_pedal_delta` | float32 | Acceleration controller. |<!---- TBF> <td><code>status</code> </td><!---- TBF> <---->
| `brake_upper_border` | float32 | Borders for lay off pedal. |<!---- TBF> <td>string</td>
| `throttle_lower_border` | float32 | Borders for lay off pedal. |<!---- TBF> <td>Current control status.</td>
<tr>
<td><code>speed_control_activation_count</code> </td><!---- TBF> <---->
<td>uint8</td>
<td>Speed controller.</td>
<tr>
<td><code>speed_control_accel_delta</code> </td><!---- TBF> <---->
<td>float32</td>
<td>Speed controller.</td>
<tr>
<td><code>speed_control_accel_target</code> </td><!---- TBF> <---->
<td>float32</td>
<td>Speed controller.</td>
<tr>
<td><code>accel_control_pedal_delta</code> </td><!---- TBF> <---->
<td>float32</td>
<td>Acceleration controller.</td>
<tr>
<td><code>accel_control_pedal_target</code> </td><!---- TBF> <---->
<td>float32</td>
<td>Acceleration controller.</td>
<tr>
<td><code>brake_upper_border</code> </td><!---- TBF> <---->
<td>float32</td>
<td>Borders for lay off pedal.</td>
<tr>
<td><code>throttle_lower_border</code> </td><!---- TBF> <---->
<td>float32</td>
<td>Borders for lay off pedal.</td>
</tbody>
</table>
<br>
--- ---
## EgoVehicleControlTarget.msg ## EgoVehicleControlTarget.msg
Represents the target values for the variables of the ego vehicle controller. It is part of a `Carla_Ackermann_Control.EgoVehicleControlInfo.msg` message. Target values of the ego vehicle controller. It is part of a `Carla_Ackermann_Control.EgoVehicleControlInfo.msg` message.
| Field | Type | Description | <table class ="defTable">
| ---------------- | -------- | ----------------------------- | <thead>
| `steering_angle` | float32 | Target steering angle for the controller. | <th>Field</th>
| `speed` | float32 | Target speed for the controller. | <th>Type</th>
| `speed_abs` | float32 | Speed as an absolute value. | <th>Description</th>
| `accel` | float32 | Target acceleration for the controller. | </thead>
| `jerk` | float32 | Target jerk for the controller. | <tbody>
<td><code>steering_angle</code> </td>
<td>float32</td>
<td>Target steering angle for the controller.</td>
<tr>
<td><code>speed</code> </td>
<td>float32</td>
<td>Target speed for the controller. </td>
<tr>
<td><code>speed_abs</code> </td>
<td>float32</td>
<td>Speed as an absolute value.</td>
<tr>
<td><code>accel</code> </td>
<td>float32</td>
<td>Target acceleration for the controller.</td>
<tr>
<td><code>jerk</code> </td>
<td>float32</td>
<td>Target jerk for the controller.</td>
</tbody>
</table>
<br>

View File

@ -2,7 +2,7 @@
* __[Installation summary](#installation-summary)__ * __[Installation summary](#installation-summary)__
* __[Requirements](#requirements)__ * __[Requirements](#requirements)__
* __[Downloading CARLA](#downloading-carla)__ * __[CARLA installation](#carla-installation)__
* a) deb CARLA installation * a) deb CARLA installation
* b) GitHub repository installation * b) GitHub repository installation
* __[Running CARLA](#running-carla)__ * __[Running CARLA](#running-carla)__
@ -22,9 +22,16 @@
# Install required modules Pygame and Numpy. # Install required modules Pygame and Numpy.
pip install --user pygame numpy pip install --user pygame numpy
# Option A) deb package installation (only Linux) # Option A) deb package installation of CARLA 0.9.8 (only Linux)
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 304F9BC29914A77D &&
sudo add-apt-repository "deb [arch=amd64 trusted=yes] http://dist.carla.org/carla-0.9.8/ all main"
sudo apt-get update
sudo apt-get install carla
cd /opt/carla/bin
./CarlaUE4.sh
# To install CARLA 0.9.7 instead of 0.9.8
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys DB53A429E64554FC && sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys DB53A429E64554FC &&
sudo add-apt-repository "deb [trusted=yes] http://dist.carla.org/carla-0.9.7/ bionic main" sudo add-apt-repository "deb [arch=amd64 trusted=yes] http://dist.carla.org/carla-0.9.7/ all main"
sudo apt-get update sudo apt-get update
sudo apt-get install carla sudo apt-get install carla
cd /opt/carla/bin cd /opt/carla/bin
@ -63,17 +70,17 @@ To install both modules using [pip](https://pip.pypa.io/en/stable/installing/),
pip install --user pygame numpy pip install --user pygame numpy
``` ```
--- ---
## Downloading CARLA ## CARLA installation
The __deb installation__ is the easiest way to get the latest release in Linux. The __deb installation__ is the easiest way to get the latest release in Linux.
__Download the GitHub repository__ to get either a specific release or the Windows version of CARLA. __Download the GitHub repository__ to get either a specific release or the Windows version of CARLA.
### a) deb CARLA installation ### a) deb CARLA installation
Add the repository to the system. Add the CARLA 0.9.8 repository to the system.
```sh ```sh
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys DB53A429E64554FC && sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 304F9BC29914A77D &&
sudo add-apt-repository "deb [trusted=yes] http://dist.carla.org/carla-0.9.7/ bionic main" sudo add-apt-repository "deb [arch=amd64 trusted=yes] http://dist.carla.org/carla-0.9.8/ all main"
``` ```
Install CARLA and check for the installation in the `/opt/` folder. Install CARLA and check for the installation in the `/opt/` folder.
```sh ```sh
@ -82,6 +89,16 @@ sudo apt-get install carla
cd /opt/carla cd /opt/carla
``` ```
The installation of CARLA 0.9.7 instead of 0.9.8 would be quite similar.
```sh
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys DB53A429E64554FC &&
sudo add-apt-repository "deb [arch=amd64 trusted=yes] http://dist.carla.org/carla-0.9.7/ all main"
sudo apt-get update
sudo apt-get install carla
cd /opt/carla/bin
./CarlaUE4.sh
```
### b) GitHub repository installation ### b) GitHub repository installation
<div class="build-buttons"> <div class="build-buttons">
@ -115,7 +132,7 @@ Open a terminal in the main CARLA folder. Run the following command to execute t
> CarlaUE4.exe > CarlaUE4.exe
``` ```
!!! Important !!! Important
In the __deb installation__, `CarlaUE4.sh` will be in `/opt/carla/bin/`, instead of the main `/carla/` folder where it normally is. In the __deb installation__, `CarlaUE4.sh` will be in `/opt/carla/bin/`, instead of the main `carla/` folder where it normally is.
A window containing a view over the city will pop up. This is the _spectator view_. To fly around the city use the mouse and `WASD` keys (while clicking). The server simulator is now running and waiting for a client to connect and interact with the world. A window containing a view over the city will pop up. This is the _spectator view_. To fly around the city use the mouse and `WASD` keys (while clicking). The server simulator is now running and waiting for a client to connect and interact with the world.
Now it is time to start running scripts. The following example will spawn some life into the city: Now it is time to start running scripts. The following example will spawn some life into the city: