Skip to content

Using the Simulator in a VM (CARLA)

Connor Scally edited this page Mar 21, 2022 · 5 revisions

Starting RVIZ2

  1. RVIZ2 should be started first. In a new terminal window, run source /install/setup.bash

  2. Run rviz2

  3. Navigate to file, then open config. Choose a configuration file in the share folder or your own. There is a file with Will's name in share that is known to work.


Starting CARLA:


To start CARLA, run:

  1. ./home/share/carla/CarlaUE4.sh -RenderOffscreen to start a new CARLA instance.

The -RenderOffScreen flag is self explanatory. Remove this if you want to vizualive the vehicle on the map.

If CARLA gived you a SIGFAULT error attach the -carla-rpc-port=N where N = your favorite port number.


Running the bridge:


  1. Open a new terminal window.

  2. Navigate to where you have installed our stack. Run source /install/setup.bash

  3. Return to the root directory of the stack and run: ros2 run sim_bridge sim_bridge_node

Succsess will result including this output:

[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))

As of right now, our custom bridge currrently publishes:

  • GNSS (GPS)
  • Velocity
  • 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.


Running the stack:


  1. Open a new terminal window.

  2. Navigate to the root directory of Navigator.

  3. Run source /install/setup.bash

  4. Run ros2 launch carla.launch.py

carla.launch.py has extra nodes specfic to CARLA. If using SVL, run main.launch.py instead.


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