This project implements a TurtleSim navigation system using ROS2 and PID controllers for smooth waypoint tracking.
mkdir -p ~/ros2_ws/src
cd ~/ros2_ws/src
git clone <repository-url>
If there are any issues for cloning the repository, you can download the zip file and extract the contents into the src folder.
cd ~/ros2_ws
colcon build
If there are any issues while building, clean and rebuild:
sudo rm -rf log install build
colcon build
ros2 run turtlesim turtlesim_node
Open another terminal to launch the node
source install/setup.bash
ros2 run task_1 task_1
Run the node and follow the instructions to enter waypoints for the turtle to follow.
ros2 run turtlesim turtlesim_node
Open a new Terminal and run the following commands
source install/setup.bash
ros2 run task_2 task_2
You should see the turtle navigating through a certain set of predefined waypoints to make a grid like pattern like this.
ros2 run turtlesim turtlesim_node
Open a new Terminal and run the following commands.
source install/setup.bash
ros2 run task_3 task_3
Open a new Terminal and run the following commands for launching a node that will allow you to give custom radius for the circle.
source install/setup.bash
ros2 run task_3 custom_radius_publisher
You can now change the radius of the controller using this node like this.
Launching the node task_3 will also start Publishing real pose of turtle as well as the noisy pose of the turtle every 5 sec on /rt_real_pose and /rt_noisy_pose you can check these pose by running following commands
ros2 topic echo /rt_real_pose # For real pose
ros2 topic echo /rt_noisy_pose # For noisy pose
Circle with custom radius:
Data published on /rt_real_pose and /rt_noisy_pose:
ros2 run turtlesim turtlesim_node
Open a new Terminal and run the following commands.
source install/setup.bash
ros2 run task_3 task_3
Open a new Terminal and run the following commands for launching a node that will allow you to give custom radius for the circle.
source install/setup.bash
ros2 run task_3 custom_radius_publisher
Make sure that the radius of the circle is greater than 35 units which will allow the Robber Turtle to gain some distance.
Open a new Terminal and run the following commands for launching a node that will chase the Robber Turtle(RT) from Goal:3.
source install/setup.bash
ros2 run task_4 police_turtle
The Police Turtle(PT) will start chasing RT on the basis of pose published every 5 secs on /rt_real_pose after 10 secs.
ros2 run turtlesim turtlesim_node
Open a new Terminal and run the following commands.
source install/setup.bash
ros2 run task_3 task_3
Open a new Terminal and run the following commands for launching a node that will allow you to give custom radius for the circle.
source install/setup.bash
ros2 run task_3 custom_radius_publisher
Make sure that the radius of the circle is greater than 35 units which will allow the Robber Turtle to gain some distance.
Open a new Terminal and run the following commands for launching a node that will chase the Robber Turtle(RT) from Goal:3.
source install/setup.bash
ros2 run task_5 task_5
The Nerfed Police Turtle(PT), with half of the speed of RT will start chasing RT after 10 secs.
ros2 run turtlesim turtlesim_node
Open a new Terminal and run the following commands.
source install/setup.bash
ros2 run task_3 task_3
Open a new Terminal and run the following commands for launching a node that will allow you to give custom radius for the circle.
source install/setup.bash
ros2 run task_3 custom_radius_publisher
Make sure that the radius of the circle is greater than 35 units which will allow the Robber Turtle to gain some distance.
Open a new Terminal and run the following commands for launching a node that will chase the Robber Turtle(RT) from Goal:3.
source install/setup.bash
ros2 run task_6 task_6
The Police Turtle(PT), will start chasing RT on basis of the gausian noise pose published every 5 secs on /rt_noisy_pose after 10 secs.
- Ensure ROS2 is properly sourced before running any commands.
- Modify PID gains in the script for different performance tuning.