This project provides a ROS-based implementation of a PI controller to control the movement of a robot along predefined paths such as elliptical and spiral trajectories. The robot's position and orientation are tracked, and the controller adjusts its movements to follow the desired path accurately.
The PI controller is designed to ensure the robot can follow various paths using feedback from its current state. The project simulates the robot’s movements in the Gazebo simulator, and the results are visualized in PlotJuggler.
Here is a demonstration of the robot following the path:
video.mp4
- src/controller.py: Implements the PI controller, computing velocity commands based on the robot's position and orientation.
- src/pose_monitor.py: Monitors the robot's pose and publishes the robot's path and orientation data. It also retrieves ground truth information from the Gazebo simulation.
- CMakeLists.txt: Configuration file for building the ROS package.
- package.xml: ROS package metadata and dependencies.
The PI controller adjusts the robot's velocity and heading to minimize the error between the desired and actual paths. It consists of two main components:
- Proportional Term (Kp): Corrects the error based on the distance to the target.
- Integral Term (Ki): Corrects accumulated errors to improve long-term accuracy.
- Elliptical Path:
Kp = 0.8
,Ki = 0.1
,Tp = 0.4
- Spiral Path:
Kp = 0.7
,Ki = 0.1
,Tp = 0.3
The robot's movements are simulated in Gazebo, with trajectory data visualized using PlotJuggler. The blue line represents the robot's actual path, while the red line represents the desired trajectory.
The project relies on the following ROS packages:
rospy
std_msgs
All dependencies are specified in the package.xml
file.
- Clone the repository:
git clone https://github.com/mirzaim/Path-Tracking-PID.git
- Navigate to the workspace and build the package:
cd ~/catkin_ws catkin_make
- Source the workspace:
source devel/setup.bash
- Launch the controller and monitor:
rosrun path_tracking controller.py rosrun path_tracking pose_monitor.py
Use PlotJuggler to visualize the robot’s path.