This plugin allows you to control an overhead camera in the Carla simulator, draw lines in the Carla simulator, and save reference points.
To install the required environment, run:
pip3 install -r requirements.txt
Copy cameras.py
to the Carla/PythonAPI/examples
directory.
To start the Carla simulator, run:
./CarlaUE4.sh
To start the line tool, run:
python cameras.py
If you start the tool by above way, the tool will generate a car and set it the ego vehicle. The vehicle coordinate system is calculated according to the ego vehicle.
Or you can launch the tool by another way. You can enter the actor_id, just ID
, to specify the initial position of the camera when the tool starts. The tool calculates the vehicle coordinate system based on the actor you specify. If you enter an ID
that doesn't exist, the tool will exit.
python cameras.py --actor_id ID
After starting the tool, it will load a map in the Carla simulator (default is Town01). A new window will open and display a camera view. The default camera height is z=50
, and the default window size is 800×800
.
- Use
W
,A
,S
,D
keys to control the camera's horizontal position. - Use the mouse wheel to control the camera height.
In the new window, you can draw lines with the mouse. The tool will draw red lines and a series of reference points in the Carla simulator at the corresponding x and y coordinates. When drawing multiple lines, new lines will start from the last point of the previous line.
- Press
P
to clear the lines and reference points. - Press
C
to save the list of reference points, both in the simulator's coordinates and relative to the ego vehicle's position. - Press
H
to reset the camera height to the default value. - Press
Y
to calculate yaw of ego car at the reference point - Press
B
to smooth the curve