Skip to content

Malafosse/turtlebot3_skillset

Repository files navigation

Skill-based architecture for Turtlebot3-Burger

Dependencies

GitLab ONERA Robot Skills

  • [Compulsory] robot_language
  • [Recommended] Skillset GUI generator
  • [Optional] SkiNet Release

Tuto ONERA Robot Skills

Description

tb3_skillset is a ROS2 node written in C++ that manages the skills of a TurtleBot3 robot. The architetcure provides functionalities such as navigating to a specific pose and retrieving the initial pose of the robot. In a 3-layer architecture, the skillset model stands as the executive layer, as an intermediary between a decisional layer and the functionnal layer of the robot.

The skillset model is expressed in Robot Language (RL), a Domain Specific Language (DSL). You can find its definition in turtlebot.rl and the declaration of some message types it uses in turtlebot.json. From these two files, the skill-based architecture can be generated using the robot_language package. Formal verification can also be performed on the model using SkiNet. Finally, the Skillset GUI Generator allows the user to trigger events and skills at run time from a dedicated interface.

The robot_language package generates an abstract manager class that implements the rules specified in RL and the necessary ROS2 message interfaces. It is also possible to generate a python client library that can be used as a high level pilot for the skillset implementation. Alternatively, the user can use the GUI prvided by the Skillset GUI Generator library.

In addition to the generated code, "hooks" have been implemented in the tb3_skillset node. These hooks are responsible for establishing the platform-specific communication with the functionnal layer of the robot composed of the Nav2 Stack and the turtlebot's interface nodes. As the different elements of the architecture communicate through ROS2, the hooks have the role of creating the adequate ROS2 publishers, subscribers and clients and handling any event or fault state.

Features / skills

  • Explore: The robot navigates for a set duration while avoiding obstacles. It can be used for exploring an unknown environment for SLAM purposes.

  • Save Map: While in a SLAM configuration, the Save Map Skill acts as a client for the Map_Saver service provided by Nav2.

  • Get Home: The robot can compute its current pose. This initial pose is published to a ROS2 topic to locate the robot within the loaded map. If the Nav2 stack is initialized successfully, a success message is logged.

  • Go To Pose: By acting as a client for the Nav2 NavigateToPose action, the robot can navigate to a specific location given on a pre-existing map of its environment. The remaining distance to the goal is continuously updated during the navigation process. If the goal is reached successfully, a success message is logged.

  • Take Picture: If equiped with a camera, -- TurtleBot3 Waffle comes with a camera, Burger does not -- the robot is able to save te current image from the camera feed.

Installation

Please ensure that you have ROS2 installed on your system.

  1. Clone this repository into your ROS2 workspace's src directory.
  2. Navigate back to your ROS2 workspace root, then build the workspace with colcon build.
  3. Don't forget to source the workspace's setup script with source install/setup.bash.

[Optional] Model checking

Note

Local Verification of the model

Using the SMT solver z3.

python3 -m robot_language ~/path-to/turtlebot.rl -v 2

Visualize the Petri net

python3 -m skinet ~/path-to/turtlebot.rl -nd

Global Verification

python3 -m skinet ~/path-to/turtlebot.rl -ktz -a

Code generation

Note

In the /src directory:

[Compulsory] Abstract manager class and the ROS messages

python3 -m robot_language turtlebot.rl -d . -g turtlebot.json

[Optional] Python client library

python3 -m robot_language turtlebot.rl -d . -g turtlebot.json -c

[Recommended] Skillset GUI

python3 -m skillset_gui_generator turtlebot.rl -d . -g turtlebot.json

[Optionnal] If you ever need to regenerate a clean tb3_skillset node:

python3 -m robot_language turtlebot.rl -d . -g turtlebot.json -p tb3_skillset

Usage

Note

Run the tb3 skillset node:

ros2 run tb3_skillset tb3_skillset_node

[Recommended] Run the Skillset Manager GUI

ros2 run turtlebot_skillset_gui_widgets turtlebot_skillset_gui_widgets_node -m /skillset_manager

You may need to adjust /skillset_manager depending on the name of the skillset node

Preview of the tb3_skillset manager and its GUI controlling a simulated TurtleBot3 in a Gazebo environment.

Control a real TurtleBot3 or simulate one in Gazebo:

Crash course video Turtlebot3 - Nav2

TurtleBot3 Website

Nav2 Website alternatively, you can check out my notes.

export TURTLEBOT3_MODEL=burger
ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py
ros2 launch turtlebot3_navigation2 navigation2.launch.py use_sim_time:=True map:=maps/my_map.yaml