Path Follower¶
Overview¶
The role of the path follower is to generate the correct airspeed, course, and altitude commands for the autopilot such that the aircraft follows the paths published by path_manager
.
More information on the path_follower
can be found in Small Unmanned Aircraft: Theory and Practice by Dr. Randal Beard and Dr. Tim McLain.
Path Follower Base¶
The path follower base contains all the ROS2 interfaces required for the path follower. A list of these interfaces is below.
The path_follower_base::follow
method is a virtual method that should be implemented by a derived class.
The path_follower_base
publishes the controller commands calculated by the implementation of path_follower_base::follow
.
List of ROS2 Interfaces¶
ROS2 Interface | Topic or Service | Explanation | Message or Service Type |
---|---|---|---|
vehicle_state_sub_ |
/estimated_state |
Subscribes to the estimated aircraft state | rosplane_msgs::msg::State |
current_path_sub_ |
/current_path |
Subscribes to the current path messages published by path_manager |
rosplane_msgs::msg::CurrentPath |
controller_commands_pub_ |
/controller_commands |
Publishes control commands to the autopilot | rosplane_msgs::msg::ControllerCommand |
update_timer_ |
-- | ROS2 timer that controls how frequently controller_commands_pub_ publishes |
-- |
Interface with the Autopilot¶
The path_follower
node interfaces with the MAV autopilot by publishing to the /controller_commands
topic.
The /controller_commands
topic contains the following information calculated by the path_follower
:
Member | Description | Type / units | Required |
---|---|---|---|
header |
Standard message header that contains a valid timestamp | std_msgs::msg::Header |
Yes |
va_c |
Commanded airspeed | double , m/s |
Yes |
h_c |
Commanded altitude | double , m |
Yes |
chi_c |
Commanded course | double , rad |
Yes |
phi_ff |
Feedforward command (for orbits) | double , rad |
No |
Path Follower Example¶
The path_follower_example
class contains the implementation of the path_follower_base::follow
method.
This method contains the control command computations for straight line and orbit-type paths as outlined in Small Unmanned Aircraft: Theory and Practice.
Parameters¶
See the Parameter Management page for more details on how parameter management works.
List of Parameters¶
Parameter | Explanation | Type / Units | Range |
---|---|---|---|
chi_infty |
At infinity, the angle at which the aircraft will approach the desired line | double (rad) | \frac{\pi}{2} \geq \chi^{\infty} > 0.0 |
k_path |
Constant that determines how quickly commanded course transitions from \chi^{\infty} to 0 during line following | double | > 0.0 |
k_orbit |
Constant that determines how quickly commanded course transitions from \lambda \frac{\pi}{2} to 0 during an orbit | double | > 0.0 |
Since there are two different types of lines generated by the path_manager
(straight lines and orbits), the path_follower
uses different parameters to calculate the control output for each path type.
For line following, path_follower
uses
chi_infty
andk_path
to compute the control commands.
As described in Small Unmanned Aircraft: Theory and Practice, these two parameters define a vector field for the commanded course.
The chi_infty
parameter describes the angle at which the aircratft will approach a target line if the aircraft is infinitely far from the target line.
For example, if chi_infty
is set to \frac{\pi}{2}, then the aircraft will approach the target line at an angle perpindicular to the line when the aircraft is far away.
The k_path
parameter defines how quickly the vectors at chi_infty
"smooth" into the target line.
When k_path
is large, the transition will be abrupt, and when k_path
is small, the transition will be smoother.
During orbit following, path_follower
uses
k_orbit
to compute the control commands.
If the aircraft is very far away from the orbit, it will align itself so it flies directly at the center of the orbit.
The k_orbit
parameter is similar to the k_path
parameter in that it determines how quickly the commanded angle of the aircraft will change from directly toward the center to the orbit direction.
Note
When tuning, make sure you are changing the correct gains for the type of line (straight or orbit) the aircraft is tracking.
chi_infty
and k_path
will not affect the orbit performance!
Modifying the Path Follower¶
Changes to any of the ROS2 interface should be done in the path_follower_base
.
Changes to how path_follower
computes control commands to follow paths given by the path_manager
should be done in the path_manager_example
.