Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pure pursuit: update library #24444

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

chfriedrich98
Copy link
Contributor

@chfriedrich98 chfriedrich98 commented Mar 4, 2025

Solved Problem

This PR introduces the following updates to the pure pursuit library

Transforming from class to namespace

The pure pursuit algorithm does not require to save any values between calculations, therefor it makes more sense to implement it as a function rather than a class.
In addition to the returned targetBearing additional values of interest can be accesses throught the new pure_pursuit_status struct that is passed as a reference to calcTargetBearing.

Logging

The pure_pursuit_status struct can be published and used to log relevant values, which makes tuning of the pure pursuit algorithm easier.

Pure pursuit edge case

The pure pursuit library can now handle the following edge case:
If the acceptance radius of a waypoint is bigger than the lookahead radius of the pure pursuit controller the following edge case happens:
rover_graphics-pure_pursuit_edge_case drawio

The linesegment is outside of the lookahead which makes the rover default to calculating the bearing towards the closest point on the extended line segment (red dot). However, in this edge case this leads the rover to take a suboptimal path (red). The rover will now instead directly target the previous waypoint if the closest point on the path is not on the actual line segment leading to the more direct path (yellow).
In the same fashion, if the closest point on the path is ahead of the line segment the rover will target the current waypoint instead.

Simplifying calculation of target waypoint in manual position mode of rover modules

The calculation of the "unreachable" waypoint used for course control in manual position mode of the rover modules no longer depends on results from the pure pursuit algorithm which led to a circular dependency.

Naming consistency

Heading $\rightarrow$ Bearing this is the correct term, since there are vehicles that don't necessarly have aligned heading/bearing (i.e. mecanum rovers).

Migrating params from .yaml to .c file

Eliminates the need for the set_property(GLOBAL APPEND PROPERTY PX4_MODULE_CONFIG_FILES ${CMAKE_CURRENT_SOURCE_DIR}/module.yaml) hack and does not add the parameters if the library is not built (this was the case so far).

Test coverage

  • SITL tested

@chfriedrich98 chfriedrich98 added the Rover 🚙 Rovers and other UGV label Mar 4, 2025
@chfriedrich98 chfriedrich98 self-assigned this Mar 4, 2025
@chfriedrich98 chfriedrich98 force-pushed the pr-pure_pursuit_update branch 3 times, most recently from 568c9bd to 3a7874c Compare March 5, 2025 09:32
@chfriedrich98 chfriedrich98 force-pushed the pr-pure_pursuit_update branch from 3a7874c to 17c3063 Compare March 5, 2025 09:49
@chfriedrich98 chfriedrich98 marked this pull request as ready for review March 5, 2025 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Rover 🚙 Rovers and other UGV
Projects
Status: 👀 In Review
Development

Successfully merging this pull request may close these issues.

1 participant