DevContainer setup for ROS2 course
Install the following:
- Docker Engine
- VS Code
- VS Code extension: Dev Containers
Follow the listed steps to finish setup:
- Create a json file in the
.devcontainer
dir nameddevcontainer.json
and copy the content ofdevcontainer - linux.json
into it.
Install the following:
- Docker Engine
- VS Code
- VS Code extension: Dev Containers
- XLaunch or other Xserver
Follow the listed steps to finish setup:
- Create a json file in the
.devcontainer
dir nameddevcontainer.json
and copy the content ofdevcontainer - windows.json
into it. - Start a Xserver with 0.0 as DISPLAY port
- Open this repository in VS Code.
crtl + shift + P
to open command prompt- Enter
Dev Containers: Rebuild and Reopen in Container
VS Code will start the Dev Container building the Dockerfile found in the /docker
dir. This is a basic ROS2 Jazzy Container with the following ROS related binaries installed:
ros-jazzy-plotjuggler-ros
, a topic plotter package.ros-jazzy-moveit
, binary install of the base MoveIt2 packagesros-jazzy-ros-gz
, binary install of gz-sim11 Gazebo Harmonic ROS2'~nros-jazzy-rqt*'
, RQT for ROS2 Jazzy
The ~/ros2_ws/src
directory in the container is bound to the src
directory in this repository. Which means source installs are persistent and saved when stopping and/or rebuilding the DevContainer.
The opposite is true for binary installs, these are not persistent. Unless added to the Dockerfile.
ROS2 packages should be installed/cloned into the ~/ros2_ws/src
folder.
To install the dependencies for these packages use:
cd ~/ros2_ws
sudo apt update
rosdep update
rosdep install --from-paths src --ignore-src -y -r
This should install all package dependencies referenced in the package.xml
files.
To build the workspace use:
cd ~/ros2_ws
colcon build --symlink-install
source install/setup.bash
After installing the rosdeps and building and sourcing the workspace (see Installing in Container), use: ros2 launch bffp_gazebo factory_moveit_full.launch.py
to launch the demo. This launches a Gazebo simulation and a HC10DTP with full MoveIt2 support. Rviz2 is also launched to visualize ROS2 topics.
TODO
Documentation : https://docs.pal-robotics.com/sdk-dev/navigation
1️⃣ Start Gazebo simulation of Tiago robot:
ros2 launch tiago_gazebo tiago_gazebo.launch.py is_public_sim:=True world_name:=house_pick_and_place
2️⃣ In a new terminal, start cartographer to run SLAM:
ros2 launch tiago_2dnav tiago_nav_bringup.launch.py slam:=True is_public_sim:=True
3️⃣ In a new terminal, start teleoperation from the keyboard:
ros2 run teleop_twist_keyboard teleop_twist_keyboard --ros-args -r /cmd_vel:=/key_vel
Then move the robot to accumulate map data.
Close teleoperation with Ctrl+C and save map to file our_map
using:
ros2 run nav2_map_server map_saver_cli -f ~/ros2_ws/src/pal_maps/maps/our_map/map
Close the SLAM terminal with Ctrl+C.
If you have not used --symlink-install
, workspace building and sourcing are needed so that the new map is installed.
4️⃣ Start 2D navigation by loading your our_map
map, using:
ros2 launch tiago_2dnav tiago_nav_bringup.launch.py is_public_sim:=True world_name:=our_map
/cmd_vel
: make sure they don't publish at the same time, your robot would receive contradictory commands.
5️⃣ In RViz use the arrows to control navigation:
- Estimate 2D pose to initialize random particles to an approximate position around the actual robot position
- Send a 2D nav goal to any point of the map: your robot must navigate there
6️⃣ Command navigation from Python code using the
navigate_to_pose
action service (see workshops instructions) 7️⃣ 4-waypoints robot patrol: Inspire from thegoto
code to add a new patrol node, endlessly patroling between 4 map poses.
Documentation: https://docs.pal-robotics.com/sdk-dev/manipulation 8️⃣ Command MoveIt using color handles from the GUI in RViz:
ros2 launch tiago_moveit_config moveit_rviz.launch.py
9️⃣ Command MoveIt from Python file ros2_ws/src/tiago_pick_and_place/tiago_pick_and_place/pick.py
:
# Warning: before executing, first edit the pick.py file to uncomment the code that you want
ros2 launch tiago_pick_and_place plan.launch.py use_sim_time:=True