Skip to content

Commit 2893dc6

Browse files
authored
Merge pull request #16 from carla-simulator/feature/release_0.9.2_docu
Updated readme
2 parents 85ac33c + 5dc9bd6 commit 2893dc6

File tree

1 file changed

+144
-173
lines changed

1 file changed

+144
-173
lines changed

Readme.md

Lines changed: 144 additions & 173 deletions
Original file line numberDiff line numberDiff line change
@@ -1,173 +1,144 @@
1-
2-
# Ros bridge for Carla simulator
3-
4-
This ros package aims at providing a simple ros bridge for carla simulator.
5-
6-
![rviz setup](./assets/rviz_carla_default.png "rviz")
7-
![depthcloud](./assets/depth_cloud_and_lidar.png "depthcloud")
8-
9-
![short video](https://youtu.be/S_NoN2GBtdY)
10-
11-
12-
# Features
13-
14-
- [x] Cameras (depth, segmentation, rgb) support
15-
- [x] Transform publications
16-
- [x] Manual control using ackermann msg
17-
- [x] Handle ros dependencies
18-
- [x] Marker/bounding box messages for cars/pedestrian
19-
- [X] Lidar sensor support
20-
- [ ] Rosbag in the bridge (in order to avoid rosbag record -a small time errors)
21-
- [ ] Add traffic light support
22-
23-
# Setup
24-
25-
## Create a catkin workspace and install carla_ros_bridge package
26-
27-
### Create the catkin workspace:
28-
29-
mkdir -p ~/ros/catkin_ws_for_carla/src
30-
cd ~/ros/catkin_ws_for_carla
31-
source /opt/ros/kinetic/setup.bash
32-
catkin_make
33-
source ~/ros/catkin_ws_for_carla/devel/setup.bash
34-
35-
For more information about configuring a ros environment see
36-
http://wiki.ros.org/ROS/Tutorials/InstallingandConfiguringROSEnvironment
37-
38-
## Install carla python client API in your workspace
39-
40-
cd carla/PythonAPI
41-
pip2 install -e . --user --upgrade
42-
43-
Check the installation is successfull by trying to import carla from python:
44-
45-
python -c 'import carla;print("Success")'
46-
47-
You should see the Success message without any errors.
48-
49-
### Install recent protobuf version [optional]
50-
51-
sudo apt-get remove python-protobuf
52-
sudo pip2 install --upgrade protobuf
53-
54-
55-
### Add the carla_ros_bridge in the catkin workspace
56-
57-
Run the following command after replacing [PATH_TO_ROS_BRIDGE] with the actual path to carla ros bridge directory on your machine:
58-
59-
ln -s [PATH_TO_ROS_BRIDGE]/carla_ros_bridge/ ~/ros/catkin_ws_for_carla/src/
60-
source ~/ros/catkin_ws_for_carla/devel/setup.bash
61-
rosdep update
62-
rosdep install --from-paths ~/ros/catkin_ws_for_carla
63-
cd ~/ros/catkin_ws_for_carla
64-
catkin_make
65-
source ~/ros/catkin_ws_for_carla/devel/setup.bash
66-
67-
68-
### Test your installation (section outdated)
69-
70-
If you use the builded binary (0.9.1):
71-
72-
./CarlaUE4.sh -carla-server -windowed -ResX=320 -ResY=240
73-
74-
75-
Wait for the message:
76-
77-
Waiting for the client to connect...
78-
79-
Then run the tests
80-
81-
rostest carla_ros_bridge ros_bridge_client.test
82-
83-
you should see:
84-
85-
[carla_ros_bridge.rosunit-testTopics/test_publish][passed]
86-
87-
SUMMARY
88-
* RESULT: SUCCESS
89-
90-
91-
92-
# Start the ros bridge
93-
94-
First run the simulator (see carla documentation: http://carla.readthedocs.io/en/latest/)
95-
96-
./CarlaUE4 -carla-server -windowed -ResX=320 -ResY=240
97-
98-
99-
Wait for the message:
100-
101-
Waiting for the client to connect...
102-
103-
Then start the ros bridge:
104-
105-
source ~/ros/catkin_ws_for_carla/devel/setup.bash
106-
roslaunch carla_ros_bridge client.launch
107-
108-
To start the ros bridge with rviz use:
109-
110-
roslaunch carla_ros_bridge client_with_rviz.launch
111-
112-
You can setup the vehicle wanted to used as ego vehicle in config/settings.yaml.
113-
114-
Then you can make use of the CARLA python API scripts manual_control.py. This spawns a vehicle with role_name='hero' which is interpreted
115-
as the ego vehicle as defined by the config/settings.yaml.
116-
117-
You can then further spawn other vehicles using spawn_npc.py from CARLA python API. Then those vehicles will show up also on ROS side.
118-
119-
# Test control messages
120-
You can send command to the car using the /carla/ego_vehicle/ackermann_cmd topic.
121-
122-
Example of forward movements, speed in in meters/sec.
123-
124-
rostopic pub /carla/ego_vehicle/ackermann_cmd ackermann_msgs/AckermannDrive "{steering_angle: 0.0, steering_angle_velocity: 0.0, speed: 10, acceleration: 0.0,
125-
jerk: 0.0}" -r 10
126-
127-
128-
Example of forward with steering
129-
130-
rostopic pub /carla/ego_vehicle/ackermann_cmd ackermann_msgs/AckermannDrive "{steering_angle: 5.41, steering_angle_velocity: 0.0, speed: 10, acceleration: 0.0,
131-
jerk: 0.0}" -r 10
132-
133-
Warning: the steering_angle is the driving angle (in radians) not the wheel angle, for now max wheel is set to 500 degrees.
134-
135-
136-
Example for backward :
137-
138-
rostopic pub /carla/ego_vehicle/ackermann_cmd ackermann_msgs/AckermannDrive "{steering_angle: 0, steering_angle_velocity: 0.0, speed: -10, acceleration: 0.0,
139-
jerk: 0.0}" -r 10
140-
141-
# Test sensor messages
142-
143-
## Object information
144-
145-
### Ego vehicle
146-
147-
The ego vehicle status is provided via the topic /carla/ego_vehicle/odometry (nav_msgs.Odometry)
148-
149-
### Other vehicles
150-
151-
The other vehicles data is provided via the 'ideal' object list /carla/objects (derived_object_msgs.ObjectArray)
152-
153-
## Map information
154-
155-
The OPEN Drive map description is published via /map topic (std_msgs.String)
156-
157-
## Sensor information
158-
159-
### Ego vehicle
160-
The ego Vehicle sensors are provided via topics with prefix /carla/ego_vehicle/<sensor_topic>
161-
162-
163-
# ROSBAG recording (not yet tested)
164-
165-
The carla_ros_bridge could also be used to record all published topics into a rosbag:
166-
167-
roslaunch carla_ros_bridge client_with_rviz.launch rosbag_fname:=/tmp/save_session.bag
168-
169-
This command will create a rosbag /tmp/save_session.bag
170-
171-
You can of course also use rosbag record to do the same, but using the ros_bridge to do the recording you have the guarentee that all the message are saved without small desynchronization that could occurs when using *rosbag record* in an other process.
172-
173-
1+
2+
# ROS bridge for CARLA simulator
3+
4+
This ROS package aims at providing a simple ROS bridge for CARLA simulator.
5+
6+
__Important Note:__
7+
This documentation is for CARLA versions *newer* than 0.9.1. The CARLA release 0.9.1
8+
does not work out of the box with the ROS bridge.
9+
10+
![rviz setup](./assets/rviz_carla_default.png "rviz")
11+
![depthcloud](./assets/depth_cloud_and_lidar.png "depthcloud")
12+
13+
![short video](https://youtu.be/S_NoN2GBtdY)
14+
15+
16+
# Features
17+
18+
- [x] Cameras (depth, segmentation, rgb) support
19+
- [x] Transform publications
20+
- [x] Manual control using ackermann msg
21+
- [x] Handle ROS dependencies
22+
- [x] Marker/bounding box messages for cars/pedestrian
23+
- [x] Lidar sensor support
24+
- [ ] Rosbag in the bridge (in order to avoid rosbag record -a small time errors)
25+
- [ ] Add traffic light support
26+
27+
# Setup
28+
29+
## Create a catkin workspace and install carla_ros_bridge package
30+
31+
First, clone or download the carla_ros_bridge, for example into
32+
33+
~/carla_ros_bridge
34+
35+
### Create the catkin workspace:
36+
37+
mkdir -p ~/ros/catkin_ws_for_carla/src
38+
cd ~/ros/catkin_ws_for_carla/src
39+
cp ~/carla_ros_bridge/* .
40+
source /opt/ros/kinetic/setup.bash
41+
catkin_make
42+
source ~/ros/catkin_ws_for_carla/devel/setup.bash
43+
44+
For more information about configuring a ROS environment see
45+
http://wiki.ros.org/ROS/Tutorials/InstallingandConfiguringROSEnvironment
46+
47+
## Install the CARLA Python API
48+
49+
export PYTHONPATH=$PYTHONPATH:<path/to/carla/>/PythonAPI/<your_egg_file>
50+
51+
Please note that you have to put in the complete path to the egg-file including
52+
the egg-file itself. Please use the one, that is supported by your Python version.
53+
Depending on the type of CARLA (pre-build, or build from source), the egg files
54+
are typically located either directly in the PythonAPI folder or in PythonAPI/dist.
55+
56+
Check the installation is successfull by trying to import carla from python:
57+
58+
python -c 'import carla;print("Success")'
59+
60+
You should see the Success message without any errors.
61+
62+
## Install other requirements:
63+
64+
sudo apt-get install python-protobuf
65+
pip install --user simple-pid
66+
67+
68+
# Start the ROS bridge
69+
70+
First run the simulator (see carla documentation: http://carla.readthedocs.io/en/latest/)
71+
72+
./CarlaUE4 -carla-server -windowed -ResX=320 -ResY=240
73+
74+
75+
Wait for the message:
76+
77+
Waiting for the client to connect...
78+
79+
Then start the ros bridge:
80+
81+
source ~/ros/catkin_ws_for_carla/devel/setup.bash
82+
roslaunch carla_ros_bridge client.launch
83+
84+
To start the ros bridge with rviz use:
85+
86+
source ~/ros/catkin_ws_for_carla/devel/setup.bash
87+
roslaunch carla_ros_bridge client_with_rviz.launch
88+
89+
You can setup the vehicle configuration config/settings.yaml.
90+
91+
Then you can make use of the CARLA Python API script manual_control.py.
92+
This spawns a vehicle with role_name='hero' which is interpreted as the ego
93+
vehicle as defined by the config/settings.yaml.
94+
95+
You can then further spawn other vehicles using spawn_npc.py from CARLA Python API.
96+
Then those vehicles will show up also on ROS side.
97+
98+
# Test control messages
99+
You can send command to the car using the /carla/ego_vehicle/ackermann_cmd topic.
100+
101+
Example of forward movements, speed in in meters/sec.
102+
103+
rostopic pub /carla/ego_vehicle/ackermann_cmd ackermann_msgs/AckermannDrive "{steering_angle: 0.0, steering_angle_velocity: 0.0, speed: 10, acceleration: 0.0,
104+
jerk: 0.0}" -r 10
105+
106+
107+
Example of forward with steering
108+
109+
rostopic pub /carla/ego_vehicle/ackermann_cmd ackermann_msgs/AckermannDrive "{steering_angle: 5.41, steering_angle_velocity: 0.0, speed: 10, acceleration: 0.0,
110+
jerk: 0.0}" -r 10
111+
112+
Warning: the steering_angle is the driving angle (in radians) not the wheel angle, for now max wheel is set to 500 degrees.
113+
114+
# Test sensor messages
115+
116+
## Object information
117+
118+
### Ego vehicle
119+
120+
The ego vehicle status is provided via the topic /carla/ego_vehicle/odometry (nav_msgs.Odometry)
121+
122+
### Other vehicles
123+
124+
The other vehicles data is provided via the 'ideal' object list /carla/objects (derived_object_msgs.ObjectArray)
125+
126+
## Map information
127+
128+
The OPEN Drive map description is published via /map topic (std_msgs.String)
129+
130+
## Sensor information
131+
132+
### Ego vehicle
133+
The ego Vehicle sensors are provided via topics with prefix /carla/ego_vehicle/<sensor_topic>
134+
135+
136+
# ROSBAG recording (not yet tested)
137+
138+
The carla_ros_bridge could also be used to record all published topics into a rosbag:
139+
140+
roslaunch carla_ros_bridge client_with_rviz.launch rosbag_fname:=/tmp/save_session.bag
141+
142+
This command will create a rosbag /tmp/save_session.bag
143+
144+
You can of course also use rosbag record to do the same, but using the ros_bridge to do the recording you have the guarentee that all the message are saved without small desynchronization that could occurs when using *rosbag record* in an other process.

0 commit comments

Comments
 (0)