Skip to content

henki-robotics/turtlebot4_uef

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 

Repository files navigation

turtlebot4_uef

This repository contains a custom Docker container architecture implementation along with the required steps to start developing custom ROS 2 packages and code using both the real and simulated versions of Turtlebot4 robot, in a fully containerized manner.

Installation

  1. Clone this repository to your machine:

    git clone https://github.com/henki-robotics/turtlebot4_uef
    
  2. Use the resources in this repository to develop and run navigation experiments with the Nav2 framework and the Turtlebot4 robot.

Examples

We will be required to use multiple terminals for these experiments. Make sure to keep track of the terminals you are using and what commands are launched in each of them.

Example 1: Run navigation with the Turtlebot4 Simulation

Before running the navigation example with the Turtlebot4 Simulation make sure that in our docker-compose.yaml file, under services/nav_turtlebot4/environment, the line - ROS_DISCOVERY_SERVER=<TURTLEBOT_RASPBERRY_IP_ADDRESS>:11811 is commented out.

Running the example:

Terminal 1:

cd docker/
docker compose up --build

Terminal 2:

docker exec -it sim_turtlebot4 bash
ros2 launch turtlebot4_ignition_bringup turtlebot4_ignition.launch.py

Terminal 3:

docker exec -it nav_turtlebot4 bash
ros2 launch turtlebot4_viz view_robot.launch.py use_sim_time:=true

Terminal 4:

docker exec -it nav_turtlebot4 bash
ros2 launch turtlebot4_navigation slam.launch.py use_sim_time:=true

Drive the robot around to map the area.

Terminal 5:

docker exec -it nav_turtlebot4 bash
ros2 service call /slam_toolbox/save_map slam_toolbox/srv/SaveMap "name:
  data: '/home/user/ros2_ws/src/maps/tb4_map_sim'"

Stop the run in the terminal 4

In terminal 4, run:

ros2 launch turtlebot4_navigation localization.launch.py map:=/home/user/ros2_ws/src/maps/tb4_map_sim.yaml use_sim_time:=true

Give a pose estimate for the robot in Rviz.

In terminal 5, run:

ros2 launch turtlebot4_navigation nav2.launch.py use_sim_time:=true

Terminal 6: Run the demo script, that can be used to send navigation goals to a robot from Python:

ros2 run nav2_demo nav2_demo_node

Example 2: Run the previous example on the real Turtlebot4

Before running the navigation example on the real Turtlebot4, make sure to kill the previous "docker compose up" session by going to the terminal where you ran the command and doing "CTRL+C". We are doing this because we want to re-launch our "navigation" Docker container with a slightly modified configuration.

  1. We need to know the Wi-fi IP address of the Raspberry PI computer running on our Turtlebot4.

    • Once the Wi-fi setup is done correctly, the IP will appear at the top-left of the LCD screen on the Turtlebot. You can test that you can access the Raspberry via the Wi-fi with ssh ubuntu@<raspberry_wifi_ip_address>, and using the password turtlebot4 when prompted.
  2. We need to set the Turtlebot4 Raspberry Wi-fi IP address correctly in our docker-compose.yaml file. Specifically, we need to go and modify the configs of the nav_turtlebot4 container.

    • Under services/nav_turtlebot4/environment we must make sure that the line - ROS_DISCOVERY_SERVER=<TURTLEBOT_RASPBERRY_IP_ADDRESS>:11811 is uncommented and that we are writing the actual IP address of the Raspberry Pi on our Turtlebot4 before the :11811 port.

Running the example:

Terminal 1

docker compose up --build

Terminal 2

docker exec -it nav_turtlebot4 bash

In the same terminal, run ros2 topic list twice to confirm topics from Turtlebot4 are visible (for example /tb4/scan). On the first run, the topics won't be visible due to how the discovery server works. Needs to be run twice.

In the same terminal then do:

ros2 launch turtlebot4_viz view_robot.launch.py namespace:=/tb4

Nothing will be yet visible in Rviz, before the next step.

Terminal 3

docker exec -it nav_turtlebot4 bash
ros2 launch turtlebot4_navigation slam.launch.py namespace:=/tb4

Drive the robot around to map the area where you want to navigate.

Terminal 4

docker exec -it nav_turtlebot4 bash
ros2 run nav2_map_server map_saver_cli -f "/home/user/ros2_ws/src/maps/tb4_map" --ros-args -p map_subscribe_transient_local:=true -r __ns:=/tb4

Stop the run in terminal 3

In terminal 3, run:

ros2 launch turtlebot4_navigation localization.launch.py map:=/home/user/ros2_ws/src/maps/tb4_map.yaml namespace:=/tb4

In terminal 4, run:

ros2 launch turtlebot4_navigation nav2.launch.py namespace:=/tb4 use_sim_time:=false

Give a pose estimate from Rviz. Give a Nav2 goal from Rviz

Optionally, in terminal 5

You can use the same script we used in the simulation example to send a custom navigation goal to the Nav2 library. Once everything is running as expected, you can:

  1. Go to the nav2_demo_node.py file. On lines 29 and 30 add the x and y coordinates of the custom navigation point that you want the robot to navigate to. You can find it using the "Publish point" tool in Rviz, and then hover on top of the map and read the real-world coordinate of your point from the bottom-left.
  2. Start a new terminal inside the nav_turtlebot4 container and run our custom navigation node with the right namespace argument:
    • docker exec -it nav_turtlebot4 bash
      ros2 run nav2_demo nav2_demo_node -r __ns:=/tb4
      

Tips:

General:

  • The ros2 topic list command needs to be usually ran twice, whenever we want to see the topics coming from the Create3 and Raspberry. The first run only returns a few topics.

To run Rviz without a map:

ros2 launch turtlebot4_viz view_model.launch.py use_sim_time:=$USE_SIM_TIME namespace:=$NAMESPACE

When running with the namespace argument, we need to change to the "Oakd" depth camera topic in Rviz to properly visualize the camera data.

Run Diagnostics

ros2 launch turtlebot4_viz view_diagnostics.launch.py

Checking the Turtlebot4 ROS logs on Raspberry

Firstly do:

ssh ubuntu@<raspberry_wifi_ip_address>

To check the logs coming live:

journalctl -u turtlebot4.service --follow

To check the full history of logs:

sudo journalctl -u turtlebot4.service --no-pager

Ping

To ping the create3 from the raspberry over usb0:

ping 192.168.186.2

Known issues

  • The cable powering the RP Lidar on the Turtlebot4 is not reliable. Sometimes the Lidar doesn't start up correctly. Touching and moving the cable a little fixes this issue from time to time.
  • The Turtlebot4 topics had to be namespaced to start with /tb4, since the Creat3 re-publisher node on the Turtlebot4 was crashing when using the discovery server. turtlebot/turtlebot4#468
    • It looks like this has been now fixed in the latest debian release. Updating the Create3 re-publisher should now fix the issue, and we could remove the namespacing potentially.
  • Sometimes, either Nav2 or AMCL won't launch correctly when running them with the Turtlebot4. They just keep waiting for map_server, controller_server, and other services. This looks like an issue with the DDS discovery server not correctly finding all the required nodes. Restarting the Turtlebot or restarting the navigation / localization packages sometimes helps with this issue.
    • Usually this happens if navigation or localization has been already once launched, stopped and then relaunched. Try to restart the Docker container, and the Turtlebot4 to have a clean run. This is still an ongoing and known issue with the discovery server. We tried using the "simple discovery mode" as well, but that yielded even worse results.
    • The same situation is showcased and tracked in this issue: turtlebot/turtlebot4#574
  • There was an issue when trying to use one particular Wi-fi network, that almost always when running Nav2, it would crash the whole 5Ghz connection. A full router restart was needed to recover.
    • This didn't happen when running the Turtlebot in a different place with a different router. Could be just related to a single router configuration.
  • The Turtlebot simulation requires to run the simulation with NVIDIA device support. This is enabled in docker-compose.yaml, for the sim_turtlebot4 container. Otherwise, the laserscan will be incorrect.
  • The Turtlebot4 now runs in a DISCOVERY_SERVER mode. There were issues in the simple discovery mode, that topics from the Create3 were not discoverable from the local PC. Also, the DISCOVERY_SERVER mode is easier on the network load, and provides the best result when running the TB4 with Nav2 and Localization.
  • When running the localization, the published map doesn't show UNKNOWN cells correctly in Rviz. This is related to the map configuration value mismatch between the slam-toolbox library which is used to build the map and AMCL

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •