Skip to content

Latest commit

 

History

History
56 lines (35 loc) · 2.04 KB

ROS2 Rust workshop devcontainer.md

File metadata and controls

56 lines (35 loc) · 2.04 KB

ROS2 Rust workshop using DevContainer

Install the DevContainer extension in VSCode.

Click on 'Open in DevContainer' in the popup. Check what is going on in the background by clicking 'Show log'.

images/reopen_in_container.png

If you missed the popup, you can go to View > Command Palette > Dev Containers: ReOpen in Container.

Note: It will download a lot of things, it may take a while in a slow connection. It took about 3min in my moderate machine with 100mb internet connection.

You will be dropped in a terminal, or you can open another one pressing '+'. The terminal will be inside of docker, and you'll see you are user cuser@your-machine.

Everything you do will be saved in the folder of the project (your_path/ros2_rust_workshop) (but owned by the container user). You won't lose progress. If things break, remove from ros_ws build, install, log. If it goes really bad, remove what is inside of src and start over.

Next time you open the project, you can just click on 'Open in DevContainer' and it will open what you built before. If you have any issues, go to View > Command Palette > Dev Containers: Rebuild Container.

Build

Build the workspace, about 3min30s in my moderate machine.

cd ~/ros2_rust_workshop/ros_ws/
sudo apt-get update
rosdep update
rosdep install --from-paths src --ignore-src -r -y
source /opt/ros/humble/setup.sh
colcon build

Run

source install/setup.bash
ros2 launch champ_config gazebo.launch.py

Troubleshooting

NOTE: If you are using Ubuntu 24.04 you might encounter issues when opening Gazebo. To resolve this, execute the following command in the terminal:

export DISPLAY=:1

(Ensure that the value matches the output of echo ${DISPLAY} when executed locally). After setting the display variable, launch Gazebo by typing:

gazebo

If Gazebo opens as expected, proceed to close it first and then rerun the simulation.