Created by [ Charles Zhang], last modified by [ Ben Zhang] on May 10, 2020
CARLA General instructions:
Download and install Carla: https://carla.readthedocs.io/en/latest/start_quickstart/
Download and install the Ros Bridge: https://carla.readthedocs.io/en/latest/ros_installation/
#setup folder structure
mkdir -p ~/carla-ros-bridge/catkin_ws/src
cd ~/carla-ros-bridge
git clone --recursive https://github.com/carla-simulator/ros-bridge.git
cd catkin_ws/src
ln -s ../../ros-bridge
source /opt/ros/kinetic/setup.bash
cd ..
#install required ros-dependencies
rosdep update
rosdep install --from-paths src --ignore-src -r
#build
catkin_make
Navigate to simulator dir
Run the simulator:
./CarlaUE4.sh Town01 -carla-port=2000
-quality-level=Low
Start the ROS bridge:
# Export the PYTHONPATH to the egg file.
# This egg file is the compiled Carla Python API. Ommitting the egg file will result in startup errors
export PYTHONPATH=$PYTHONPATH:/home/simulation/CARLA_0.9.6/PythonAPI/carla/dist/carla-0.9.6-py2.7-linux-x86_64.egg
# Option 1: start the ros bridge
roslaunch carla_ros_bridge carla_ros_bridge.launch
# Option 2: start the ros bridge together with RVIZ
roslaunch carla_ros_bridge carla_ros_bridge_with_rviz.launch
# Option 3: start the ros bridge together with an example ego vehicle
roslaunch carla_ros_bridge carla_ros_bridge_with_example_ego_vehicle.launch
## The CORRECT way to start manual_control.py
Again, it is very important to export the PYTHONPATH variable with the Carla egg file.
Without this file, you will get RuntimeError: rpc::rpc_error during call in function version.
Type in bash: (REALLY IMPORTANT)
export PYTHONPATH=$PYTHONPATH:/home/simulation/CARLA_0.9.6/PythonAPI/carla/dist/carla-0.9.6-py2.7-linux-x86_64.egg
cd /home/simulation/CARLA_0.9.6/PythonAPI/examples
python2 manual_control.py --port=2000
## ON SERVER:
export ROS_HOSTNAME=129.97.231.173
## ON CLIENT:
export ROS_IP=129.97.231.173
export ROS_HOSTNAME=[your ip..]
## ON BOTH:
export ROS_MASTER_URI=http://129.97.231.173:11311
You can run the Carla server on the WATO machines in the garage, then run the client on your computer.
Note: that using X11VNC to run both the Carla server + client on the Wato machines is not worth it, way too laggy. (Tested by Charles Zhang{.confluence-userlink .user-mention} on March 29,2020)
\
Make sure you have carla and the ros bridge installed on both the client and server machines. Currently, carla is installed in WATO1 under `/home/simulation/CARLA_0.9.6/` and on WATO2 under `/media/watouser/Seagate_Backup/simulation/carla`
Make sure you are either on eduroam or connected to the Waterloo VPN https://uwaterloo.ca/information-systems-technology/services/virtual-private-network-vpn
---
Create IPTunnel
ssh -L 2000:localhost:2000 -L 2001:localhost:2001 -L 2002:localhost:2002
USER@SERVER.uwaterloo.ca
This will ssh into the wato server and create an IPTunnel for ports 2000, 2001, 2002.
WATonomous Workstation Common Users Information (where all workstation access information is stored):
[https://docs.google.com/spreadsheets/d/141TjJNwrWngtkDIp-4q6c1888kq4EBy0wa3FsS29BnE/edit#gid=0]
---
Start Carla as a server
<PATH_TO_CARLA>/CarlaUE4.sh Town02-carla-port=2000 -quality-level=Low -carla-server
/media/watouser/Seagate_Backup/simulation/carla/CarlaUE4.sh Town02-carla-port=2000 -quality-level=Low -carla-server # WATO2
/home/simulation/CARLA_0.9.6/CarlaUE4.sh Town02-carla-port=2000 -quality-level=Low -carla-server #WATO1
---
Start the carla client (On your local machine)
roslaunch carla_ros_bridge carla_ros_bridge_with_example_ego_vehicle.launch
---
Improve performance
If you find the performance is really bad, you can change the sensors. You'll want to modify this file: https://github.com/carla-simulator/ros-bridge/blob/master/carla_ego_vehicle/config/sensors.json
Delete any sensors you don't need. You can actually delete all the cameras, and your Carla PyGame window will be black. However, you can use RVIz to visualize what's going on in the simulation.
Your browser does not support the HTML5 video element
# Start the sim
~/CARLA_0.9.6/CarlaUE4.sh Town01 -carla-port=2000 -quality-level=Low
roslaunch carla_ackermann_control carla_ackermann_control.launch
roslaunch carla_ros_bridge carla_ros_bridge_with_example_ego_vehicle.launch
# Press 'b' to go into manual control mode in the carla simulation window. This will stop the car from driving around.
# Run a rosbag:
rosbag play -l -r 1 -u 1 lane_change_5_pp.bag
# This will play one second of the rosbag on repeat.
# Start path planning
roslaunch path_planning planner_main.launch
# start the rosbridge
# The carla rosbridge will automatically determine the proper offset to place your car given the rosbag
rosrun path_planning carla
# Use wasd to manouver your car so that it's in the correct orientation in RVIZ and is facing an open stretch of road.
# Once your car is in the desired start position, restart `rosrun path_planning carla`. This will reset the map position to your car's current position.
# Press 'b' again in the simulator to exit manual override mode.
Starting in S20 we introduced a dockerized dev environment that can be run on the WATO servers. This allows us to develop on the simulator without purchasing high-end GPUs. The instructions can be found here: https://git.uwaterloo.ca/WATonomous/path_planning_docker_ws.
I'm getting "import error no module found" for Carla when running the ros bridge!
carla.mp4 (video/mp4)\
Document generated by Confluence on Dec 10, 2021 04:01