Developer Setup for ROS2
For Windows users: Install WSL2
For using a ROS2 stack on a Windows PC and connect it to MORAI Sim, WSL2 (Windows Subsystem for Linux) needs to be installed as well as some tools within WSL.
Follow instructions on the official site here or simply use the command below to get started with installation. (Installation of Ubuntu-22.4.6 LTS is recommended)
wsl --install -d Ubuntu-22.04
Access WSL via the command
wslin your powershell
Install ROS2 Humble and other tools
In wsl, install ROS2 Humble by following instructions on the official documentation
Source the newly installed ROS2 environment via
source /opt/ros/humble/setup.bashInstall build‐tool and dependencies: e.g.,
colcon,rosdep, etc.sudo apt install python3-colcon-common-extensions python3-rosdep python3-argcomplete build-essential
Install the ROS2
image_transportplugin (may be necessary for transporting camera data)sudo apt install ros-humble-image-transport ros-humble-compressed-image-transport(ROS distro version needs to match what you have installed)
Install
rqt(for visualization of subscribed data stream)To install rqt an X server is required, e.g. VcXsrv (recommended)
When rqt is installed correctly, the command
rqtshould just open a GUI window and no error message should appear in the powershell
Install
RViz2(for visualization of subscribed data stream)install rviz2
Build a ROS2 workspace
Setup a workspace to build custom packages in ROS2. For example:
mkdir -p ~/ros2_ws/srccd ~/ros2_ws
In your workspace src folder, clone MORAI’s ROS2 messages repo:
cd ~/ros2_ws/srcgit clone https://github.com/MORAI-Autonomous/MORAI-ROS2_morai_msgs.git
Then go back to the root of the workspace and update dependencies (This installs missing ROS dependencies that the package requests):
cd ~/ros2_wsrosdep install --from-paths src --ignore-src -r -y
Build the workspace using colcon build:
colcon build --symlink-install
After a successful build, source the overlay so your environment picks up the new messages:
source install/setup.bash