Skip to content

Turtlesim-PID-Controller: A ROS 2 node designed to navigate a turtle in the turtlesim simulator using Proportional control. Aims to drive the turtle to specified coordinates with future plans for full PID integration.

License

Notifications You must be signed in to change notification settings

roboticvedant/ROS2_turtlesim_PID_demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ROS 2 Turtlesim PID Controller

This ROS 2 Python node controls a turtle in the turtlesim simulator to drive it to a desired position using a PID controller. Currently, PID constants are utilized for both distance and heading error.

Features

  • Retrieves the current pose of the turtle.
  • Computes the error in distance and heading to the desired position.
  • Uses a simple proportional controller to compute the required linear and angular velocities.
  • Publishes these velocities to command the turtle.

Prerequisites

  • ROS 2 (Humble,Foxy, Galactic, or later versions recommended).
  • turtlesim package.

Usage

  1. Ensure you have ROS 2 and turtlesim installed.

  2. Clone this repository:

git clone https://github.com/roboticvedant/ROS2_turtlesim_PID_demo.git
cd ROS2_turtlesim_PID_demo
  1. Source your ROS 2 installation:
source /opt/ros/[YOUR_ROS2_DISTRO]/setup.bash
  1. Build the service package first, source it and then build the main turtle_demo_controller package:
colcon build --packages-select turtlebot_serv
source install/setup.bash
colcon build --packages-select turtle_demo_controller
  1. Source the built package:
source install/setup.bash
  1. Run the turtlesim node:
ros2 run turtlesim turtlesim_node
  1. In a new terminal, run the controller:
ros2 run turtle_demo_controller turt_controller
  1. In a new terminal tab, run the service call to give custom goal:
ros2 service call /goal_pose turtlebot_serv/srv/GoalPose "{x: 9, y: 9}"

PID Control

This code uses Proportional Integral Derivative Controller to control the turtlebot.

Future Enhancements

  • Incorporate full PID control for both distance and heading error.
  • Add dynamic reconfiguration to adjust PID constants on-the-fly.

Contribute

Feel free to fork, open issues, and submit pull requests. Any contributions are welcome!

About

Turtlesim-PID-Controller: A ROS 2 node designed to navigate a turtle in the turtlesim simulator using Proportional control. Aims to drive the turtle to specified coordinates with future plans for full PID integration.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •