A simple way to run rosbot-xl simulation without using docker compose.
- Ubuntu 22.04 (it should also work in Ubuntu 20.04)
- Docker (Remember to set user permission to use
docker
and notsudo docker
) - nvidia-container-toolkit
- vcstool
Clone this repository
git clone git@github.com:CatInTheRain/rosbot_humble.git
if you have problems you have to set the ssh key associated with your github account. This is a possible way to set key.
Then go to the repository, clone all the packaets and build the docker
cd rosbot_humble/
./clone_repos.sh
./build_sim.sh
The script will download all the necessary files inside the docker container and after the image is completed two ROS2 workspaces are built. These thow workspaces are mounted inside the docker. If everything is okay you will see something like this
To test if everything is ok with rosbot XL and ROS2 run from local PC
[<your_name>@<PC_name> ~]$./go_sim.sh
You are now inside the Docker container
nuctella@<PC_name>:~/ros2_ws/ws$ colcon_cd core
nuctella@<PC_name>:~/my_ros2_ws/src/core$ cd startup/
nuctella@<PC_name>:~/my_ros2_ws/src/core/startup$ ./sim.sh
You will see something like this:
To exit you can click on the terminal with the panels and tap Ctrl + A + K. There are other usefull shortkeys in tmux:
- Alt + Key Arrows switch panels
- Ctrl + A + T new window
- Shift + Key Arrows switch windows
- Ctrl + O split horizontally
- Ctrl + E split split vertically
- Ctrl + A + D detach (to come back run
tmux a
con terminal)
Alternatively you can inspect the file my_ros2_ws/src/core/startup/session_custom_sim.sh
and run terminator
on the terminal. One red panel will open and you can split it with the previous shortkeys. On each panel you can run each command of the session_custom_sim.sh
:
ros2 launch rosbot_xl_gazebo simulation.launch.py mecanum:=${MECANUM:-True}
ros2 run rviz2 rviz2 -d /config/rosbot.rviz
ros2 launch slam_toolbox online_sync_launch.py slam_params_file:=/config/slam_toolbox_params.yaml use_sim_time:=True
bash -c "while true; do ros2 run nav2_map_server map_saver_cli --free 0.15 --fmt png -f /maps/map; sleep 5; done"
ros2 run rosbot_object_recognition obj_rec
ros2 run teleop_twist_keyboard teleop_twist_keyboard
Simulation runs by this launch file, that calls other launch files like matrioska.
Inspecting the session_custom_sim.sh
to understand all the SLAM simulation
Other usefull commands during simulation:
rqt_graph
ros2 run rqt_tf_tree rqt_tf_tree
ros2 run plotjuggler plotjuggler
There are three workspaces inside the docker container
/home/nuctella/ros2_ws/deps
dependencies of simulations/home/nuctella/ros2_ws/ws
packages for the simulation/home/nuctella/my_ros2_ws
your new packages that you want add
Every modification that you make in ros2_ws/ws
and in my_ros2_ws
it will remain also in your local PC, even if you will exit from the docker. These two folders are mounted in go_sim.sh
, in the root of the project.
If you exit from the container all things that you install will be lost. You can edit ONLY THE BOTTOM of the Dockerfile and then run build_sim.sh
to mantain the edit.
For example, if you want to work with gedit
you can add it here
# Install extra packages
258 RUN sudo apt-get update && sudo apt-get install -y \
259 terminator \
260 ranger \
261 ros-humble-plotjuggler-ros \
262 ros-humble-rqt-tf-tree \
263 gedit
Then, if you run in your local PC build_sim.sh
and then you enter in the container with ./go_sim.sh
, gedit should be installed forever.
We include the code to plot data for the review in /my_ros2_ws/testings/evaluation/plotter_mod.py
Feel free edit the packages /home/nuctella/my_ros2_ws
/home/nuctella/ros2_ws/ws
and to add your personal packages. I advice you to develop using Visual Studio Code and install the extensions for docker and docker containers, in this way you can develop directly inside the dockerfile.
If you have some doubts or question about ROS2 Humble follow this link.
There is also one useful package called ROS2_learning
, with a lot of basic examples, you can find here /home/nuctella/my_ros2_ws/src/ROS2_learning
, however on internet you can find a lot of usefull help for coding problems.
If you don't know how to develop using git you can follow this guide and the official guide or also this. Or you can use gitkraken.
- There are bugs regarding the RGBD and the orbbec_astra. If you have to work with RGB images work with
intel_realsense_d435.urdf.xacro
. You can try to solve by yourself debug, also inspecting this link and comparing with this link.
- This is interesting new repo about nav2