Skip to content

Using the Simulator (CARLA)

Will Heitman edited this page Mar 3, 2022 · 11 revisions

TL;DR

  1. $ /home/share/carla/CarlaUE4.sh -RenderOffscreen
  2. ros2 run sim_bridge sim_bridge_node
  3. Good to go. Run the rest of Navigator or ros2 run manual_control manual_control_node

Instructions

  1. Run the CARLA server: $ /home/share/carla/CarlaUE4.sh -RenderOffscreen

    • The "RenderOffscreen" flag hides the rendering window, which saves some resources. See here for more details
  2. In a separate term, run our sim_bridge_node: a. Source Navigator, e.g. . navigator/install/setup.bash b. ros2 run sim_bridge sim_bridge_node

This should produce something like:

[INFO] [1645631990.794344351] [sim_bridge_node]: Connecting to CARLA on port 2000
[INFO] [1645631993.616481805] [sim_bridge_node]: Spawning ego vehicle (vehicle.audi.etron) @ Transform(Location(x=-64.644844, y=24.471010, z=0.600000), Rotation(pitch=0.000000, yaw=0.159198, roll=0.000000))
  1. Run the rest of our stack. The sim_bridge will publish sensor data just as if you were driving on campus, and it will similary accept commands from our standard topics. As of writing, our custom bridge publishes:
  • GNSS (GPS)
  • IMU
  • Front and rear Lidar (not fully functional)
  • Front RGB camera
  • Front depth camera
  • CARLA ground truths for
    • Car's odometry (position, orientation, speed)
    • CARLA virtual bird's-eye camera (/carla/birds_eye_rgb)

The most up-to-date information on our bridge's capabilities can be found at the top of the script itself.

Extras

  • You can control our ego vehicle with ros2 run manual_control manual_control_node
    • At the moment, this only supports keyboard control through NoMachine or similar, not SSH.
    • If you get a "pynput" error, try running pip3 install pynput.
  • You can change a number of simulation settings by editing our script's contants (here).
    • Don't forget to rebuild the package or use colcon build --symlink-install (recommended).
    • ROS param support in the works.

Troubleshooting

  • If you get a "pynput" error, try running pip3 install pynput.
  • If you get a CARLA segmentation fault, it's likely you just need to restart CARLA. This will be fixed... eventually. This should only happen after starting the bridge 10 times or so, and should not happen while the bridge is running.
Clone this wiki locally