Path Tracking PID offers a tuneable PID control loop decouling steerting and forward velocity. The forward velocity is generated in an open loop fashion by using target velocities and accelerations.
One of the tracking options uses a carrot of length l in front of the robot to determine the steering action based on the lateral error between the current Global Point (GP) and the Control point (CP):
If a smooth path is provided, the controller has the option to track the path with the base_link directly instead of lagging behind a carrot. In this case a Projected Global Point (PGP) is computed as well which is tracked by the CP. In this mode, the yaw error can also be used as control input.
The PID contains two closed loops: Lateral and angular loops, and an open loop: Longitudinal. For non-holonomic robots, the lateral and angular loops can be combine to compute steering actions.
Model Predictive Control
As an optional feature, we use a Model Predictive Control (MPC) concept to regulate the forward velocity. The user can specify a maximum desired error bound to track the path. Using the model of the robot plus the controller settings, a predicted path is calculated and if the error bound is violated, the forward velocity of the robot is decreased until the predicted path lies within acceptable bounds.
The tricycle model is supported as well.
It is assumed the front wheel is steered and driven. The steered wheel link (SL) can be asymmetrically placed with respect to the BL. Limitations of steering and actuation are also taken into account.
When used as a plugin, Path Tracking PID uses the costmap (and the robot footprint from the costmap) for anti-collision. No evasive maneuvers will be preformed (sticking to the path is key). However when obstacles are detected in close proximity to the robot or in the direct line of direction of the robot, the forward velocity will be decreased. This results in safer velocities around obstacles. If an obstacle cannot be avoided or is too close to the robot, a standstill will occur and the navigation is cancelled.
The maximum velocity of the robot will be scale linear with the costmap values around or in path of the robot. One can use the inflation layers (or even social layers) to construct these gradients in the costmap.
Keywords: tracking, pid, local_planner, trajectory, model predictive control
Author: Cesar Lopez, [email protected].
Maintainer: Cesar Lopez, [email protected].
Affiliation: Nobleo Projects
The path_tracking_pid package has been tested under ROS Melodic and Ubuntu 18.04.
Building from Source
- Robot Operating System (ROS) (middleware for robotics),
To build from source, clone the latest version from this repository into your catkin workspace and compile the package using
cd catkin_workspace/src git clone https://bitbucket.org/nobleo/path_tracking_pid.git cd ../ catkin_make
Run the unit tests with
catkin run_tests path_tracking_pid
The path_tracking_pid is a plugin for move_base_flex.
To run move_base_flex with path_tracking_pid plugin:
roslaunch path_tracking_pid path_tracking_pid_mbf.launch
base_link) Name of the base link frame.
false) True for an holonomic robot. --> Unmaintained, expect bugs
false) Whether to take the pose angles from the path directly or to estimate them form consecutive path poses.
false) True for using tricycle model instead of differential drive.
steer) Name of the steered wheel frame.
false) True for using MPC to regulate x velocity.
Configuring in RQT
Tracking_pid parameters are all available through (rqt_)dynamic_reconfigure. The main parameters are:
0.5) Following distance from robot's rotational point to trajectory.
false) Whether to track the path using the base_link instead of the control point ahead. A smooth path is needed.
Proportional, Integral and Derivative actions for the two closed loops: Lateral and angular loops.
1.0) Proportional action gain for lateral loop.
0.0) Integral action gain for lateral loop.
0.3) Derivative action gain for lateral loop.
1.0) Proportional action gain for angular loop.
0.0) Integral action gain for angular loop.
0.3) Derivative action gain for angular loop.
Each loop can be enabled/disabled separetly.
true) Enable feedback lateral loop.
false) Enable feedback angular loop.
Moreover, feedforward using trajectory velocity can be enabled/disabled.
true) Enable velocity feedforward for lateral loop.
false) Enable velocity feedforward for angular loop.
Target velocities and accelerations for generating the open loop forward velocity:
2.0) Nominal target forward velocity.
0.0) Target forward velocity at the end of the path.
2.0) Desired acceleration at the beginning of the path.
2.0) Desired decceleration at the end of the path.
Constraints on the generated velocities:
0.025) Minimum velocity of the vehicle, used to reach the very end of the path.
1.0) Maximum allowed x velocity error.
2.0) Maximum allowed yaw velocity
2.0) Maximum allowed yaw acceleration
0.0) Minimum turning radius of the vehicle.
Constraints on the steered wheel for the tricycle model:
3.1416) Maximum steering angle for tricycle model.
3.0) Maximum steering x velocity for tricycle model.
2.0) Maximum steering x acceleration for tricycle model.
0.5) Maximum steering yaw velocity for tricycle model.
0.5) Maximum steering yaw acceleration for tricycle model.
1.0) Offset in length to project rectangle collision along path.
1.0) Spatial resolution to project rectangle collision along path.
Debug topic enable:
false) Enable debug topic.
Parameters to configure MPC behavior:
0.5) MPC maximum allowed lateral error.
0.5) MPC minimum absolute forward velocity.
0.05) MPC simulation sample time MPC maximum allowed iterations forward in time.
200) Prediction iterations. Total simulation time will be then mpc_max_fwd_iterations*mpc_simulation_sample_time.
5) MPC maximum allowed velocity optimization iterations.
launch/path_tracking_pid_mbf.launch: Runs move_base_flex with path_tracking_pid plugin
test/test_path_tracking_pid.launch: If all is well, a red square moves along a toothed path that covers a square. The square should be followed by the base_link frame.
For use in move_base_flex. See launch/path_tracking_pid_mbf.launch to see an example.
path([nav_msgs/Path]) The path to follow.
odom([nav_msgs/Odometry]) Robot odometry.
/tf([tf2_msgs/TFMessage]) The position of the robot wrt. the frame in which the map is received.
vel_max([std_msgs/Float64]) Dynamic maximum velocity. To be used for example when maximum power demands are reached. Higher level software could also use the reconfigure interface for this and set new speed values, but when required in a feedback-loop, this streaming topic is preferred.
cmd_vel([geometry_msgs/Twist]) The Twist the robot should realize to track the desired path.
feedback([path_tracking_pid/PidFeedback]) Estimated duration remaining and progress towards final goal.
visualization_marker([visualization_msgs/Marker]) A Marker indicating the current control goal of the towards.
collision_footprint_marker([visualization_msgs/Marker]) A Marker indicating the footprint(s) along the path that are used for ahead collision detection.
debug([path_tracking_pid/PidDebug]) Intermediate values of the PID controller. Topic is silent by default, can be enabled via dynamic_reconfigure.
Bugs & Feature Requests
Please report bugs and request features using the Issue Tracker.