Model the motion from initial pose ( ) to goal pose (
) in the following 3 parts as shown in figure and use PID controllers separately on the 3 parts:
turtlesim_pid3.mp4
Clone this repository in catkin source directory
cd ~/catkin_ws/src
git clone https://github.com/ABD-01/ros_pid.git
Build the package in catkin workspace
cd ~/catkin_ws && catkin_make
To start ROS Master
roscore
To start a turtlesim simulator
rosrun turtlesim turtlesim_node
Run the PID simulator with command line arguments for final pose.
rosrun ros_pid turtlesim_pid.py [-h] -x X -y Y -t THETA
Input final pose
optional arguments:
-h, --help show this help message and exit
-x X, --x X Final x position
-y Y, --y Y Final y position
-t THETA, --theta THETA
Final angle (in degrees)
For eg:
rosrun ros_pid turtlesim_pid.py -x 1 -y 1 -t 120
Start the rqt graph for visualization
rqt_plot /plot/error/data[0] /plot/error/data[1]
Custom coefficient values and loop rate can be passed while creating the PID class instance.
pid = PID(
final_pose,
Krot1=K(4, 0, 2),
Ktrans=K(0.5, 0.001, 0.02),
Krot2=K(1, 0.0, 0.01),
loop_rate=10
)
Same as above but to be done in single step rather than 3 individual steps.
Used Hermite curve to generate a trajectory for the turtle given the initial and final conditions.
Run the PID simulator with command line arguments for final pose.
rosrun ros_pid turtlesim_cubic.py [-h] -x X -y Y -t THETA
Input final pose
optional arguments:
-h, --help show this help message and exit
-x X, --x X Final x position
-y Y, --y Y Final y position
-t THETA, --theta THETA
Final angle (in degrees)
For eg:
rosrun ros_pid turtlesim_cubic.py -x 1 -y 1 -t 120