This repository implements a Teach and Repeat (T&R) navigation system for mobile robots, allowing them to autonomously follow previously demonstrated paths.
- ROS 2 Humble;
- Ubuntu 22.04;
- Colcon Common Extensions;
- Turtlebot3 simulation;
There are two methods to follow the demonstrated path:
- Dot-to-dot (nodes/repeat_path_coords.py): The robot follows a Pure Pursuit-like approach where it intercepts a look-ahead point. Once it reaches this point, a new point further along the path is set as the next target.
- Bezier curve based (nodes/repeat_bezier_path.py): The robot simulates multiple potential paths ahead using Bézier curves and selects the optimal path based on predefined criteria.
To set up the Teach and Repeat system, follow these steps:
Clone this repository along with its submodules:
git clone --recurse-submodules https://github.com/jardeldyonisio/teach_and_repeat.git
Make the installation script executable and run it with superuser privileges:
chmod +x install.sh
sudo ./install.sh
Initialize rosdep
in your workspace:
rosdep init
Update rosdep
to fetch the latest package information:
rosdep update
Install the required ROS package dependencies:
rosdep install --from-paths src -y --ignore-src
After setting up the environment, follow these steps to run the system:
To demonstrate a path, follow these steps:
Launch the navigation system:
ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py
You must use 'Pose2DEstimation' to define the initial position.
Open another terminal and start the teleoperation node:
ros2 run teleop_twist_keyboard teleop_twist_keyboard
Control the robot using the following keys:
I
to move forwardK
to move backwardJ
to turn leftL
to turn rightQ
to increase speedZ
to decrease speedSpace
to stop
Start the path demonstration:
ros2 launch lognav_navigation teach_path_coords
To end the demonstration the user have to press CTRL + C.
To follow a path, first ensure that the coordinates from the path demonstration are stored in the teach_and_repeat/data/teleop_data.txt
file. This file is also the default file read during the path following process. Make sure you start from the same point where the demonstration began.
If the navigation system is not already running, launch it:
ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py
Then, run the path following node:
ros2 run teach_and_repeat repeat_bezier_path
After starting the repeat node, set a pose using '2DPoseEstimate'. The robot will immediately begin following the path.
Check out the teach and repeat system in action:
- Following a virtual path (Repeting process): Watch the demo on YouTube
- Teach and Repeat using Odometry and Map (Simulation): Watch the demo on YouTube
- Obstacle Detection (Simulation): Watch the obstacle detection demo on YouTube
- Teach and Repeat using Odometry Only (Simulation): Watch the demo on YouTube
Feel free to open issues or submit pull requests to improve this project.
For more details, refer to our publication Teach and Repeat for Path Planning Using Bézier Curves.
@INPROCEEDINGS{Dyonisio2024,
author={J. Dos Santos Dyonisio and others},
title={Teach and Repeat for Path Planning Using Bézier Curves},
booktitle={2024 Brazilian Symposium on Robotics (SBR) and 2024 Workshop on Robotics in Education (WRE)},
year={2024},
pages={79-84},
doi={10.1109/SBR/WRE63066.2024.10837801}
}
- Create a
.yaml
file to configure:- The robot model;
- Future behavior parameters.
- Use multiple Bézier curves (e.g., B-splines) to represent the path.
- Update the teach node to:
- Accept a string input to name the path;
- Require a key press to start collecting poses.
- Display poses during the teaching process.
- Show the circular threshold around the closest Bézier reference point.
- Automatically calculate
start_num_knots
based on the path.