The carlaviz plugin is used to visualize the simulation in a web browser. A windows with some basic representation of the scene is created. Actors are updated on-the-fly, sensor data can be retrieved, and additional text, lines and polylines can be drawn in the scene.
- Linux — CARLA 0.9.6, 0.9.7, 0.9.8, 0.9.9, 0.9.10.
- Windows — CARLA 0.9.9, 0.9.10.
- Build from source — Latest updates.
- Docker — Visit the docs and install Docker.
- Operative system — Any OS able to run CARLA should work.
- Websocket-client —
pip3 install websocket_client. Install pip if it is not already in the system.
Download the plugin
Open a terminal and pull the Docker image of carlaviz, based on the CARLA version to be run.
# Pull only the image that matches the CARLA package being used docker pull mjxu96/carlaviz:0.9.6 docker pull mjxu96/carlaviz:0.9.7 docker pull mjxu96/carlaviz:0.9.8 docker pull mjxu96/carlaviz:0.9.9 docker pull mjxu96/carlaviz:0.9.10 # Pull this image if working on a CARLA build from source docker pull mjxu96/carlaviz:latest
Currently in Windows there is only support for 0.9.9 and 0.9.10.
CARLA up to 0.9.9 (included) is set to be single-stream. For later versions, multi-streaming for sensors is implemented.
In single-stream, a sensor can only be heard by one client. When a sensor is already being heard by another client, for example when running
manual_control.py, carlaviz is forced to duplicate the sensor in order to retrieve the data, and performance may suffer.
In multi-stream, a sensor can be heard by multiple clients. carlaviz has no need to duplicate these and performance does not suffer.
Alternatively on Linux, users can build carlaviz following the instructions here, but using a Docker image will make things much easier.
1. Run CARLA.
a) In a CARLA package — Go to the CARLA folder and start the simulation with
b) In a build from source — Go to the CARLA folder, run the UE editor with
make launchand press
2. Run carlaviz. In another terminal run the following command according to the Docker image that has been downloaded.
<name_of_Docker_image> for the name of the image previously downloaded, e.g.
# On Linux system docker run -it --network="host" -e CARLAVIZ_HOST_IP=localhost -e CARLA_SERVER_IP=localhost -e CARLA_SERVER_PORT=2000 <name_of_Docker_image> # On Windows/MacOS system docker run -it -e CARLAVIZ_HOST_IP=localhost -e CARLA_SERVER_IP=host.docker.internal -e CARLA_SERVER_PORT=2000 -p 8080-8081:8080-8081 -p 8089:8089 <name_of_Docker_image>
If the everything has been properly set, carlaviz will show a successful message similar to the following.
Remember to edit the previous command to match the Docker image being used.
3. Open the localhost Open your web browser and go to
http://127.0.0.1:8080/. carlaviz runs by default in port
8080. The output should be similar to the following.
Once the plugin is operative, it can be used to visualize the simulation, the actors that live in it, and the data the sensors retrieve. The plugin shows a visualization window on the right, were the scene is updated in real-tme, and a sidebar on the left with a list of items to be shown. Some of these items will appear in the visualization window, others (mainly sensor and game data) appear just above the items list.
Here is a list of options available for visualization. Additional elements may show, such as
View Mode — Change the point of view in the visualization window.
Top Down— Aerial point of view.
Perspective— Free point of view.
Driver— First person point of view.
/vehicle — Show properties of the ego vehicle. Includes a speedometer and accelerometer in the visualization window, and the data retrieved by IMU, GNSS and collision detector sensors.
/velocity— Velocity of the ego vehicle.
/acceleration— Acceleration of the ego vehicle.
- /drawing — Show additional elements in the visualization window drawn with CarlaPainter.
/texts— Text elements.
/points— Point elements.
/polylines— Polyline elements.
- /objects — Show actors in the visualization window.
/walkers— Update walkers.
/vehicles— Update vehicles.
- /game — Show game data.
/time— Current simulation time and frame.
- /lidar — LIDAR sensor data.
/points— Cloud of points detected by a LIDAR sensor.
- /radar — LIDAR sensor data.
/points— Cloud of points detected by a RADAR sensor.
- /traffic — Landmark data.
/traffic_light— Show the map's traffic lights in the visualization window.
/stop_sign— Show the map's stop signs in the visualization window.
Try to spawn some actors. These will be automatically updated in the visualization window.
cd PythonAPI/examples # Spawns actors in a synchronous mode simulation python3 generate_traffic.py -n 10 -w 5
Spawn an ego vehicle with manual control and move around, to see how the plugin updates sensor data.
cd PythonAPI/examples python3 manual_control.py
The contributor (wx9698), created an additional class, CarlaPainter, that allows the user to draw elements to be shown in the visualization window. These include text, points and polylines. Follow this example to spawn an ego vehicle with a LIDAR, and draw the LIDAR data, the trajectory and velocity of the vehicle.
That is all there is to know about the carlaviz plugin. If there are any doubts, feel free to post these in the forum.