Skip to content

refactor(rover): add course control and update the rover docs - #29923

Open
Frigiii wants to merge 10 commits into
mainfrom
frigi/feat/refractor_rover_module
Open

Frigiii wants to merge 10 commits into
mainfrom
frigi/feat/refractor_rover_module

Conversation

@Frigiii

@Frigiii Frigiii commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Solved Problem

In rover_ackermann, rover_differential and rover_mecanum, Guided Course sent its course setpoint straight to the position controller, which mixed path following with course and speed control. A course could only be held together with a speed setpoint, and mecanum had no drift compensation because the drift angle estimator read any sideways motion as drift.

Solution

  • A course controller sits between the position controller and the attitude and speed controllers. The position controllers only publish a course setpoint (course and speed), Guided Course publishes it directly.
  • With a NaN speed the speed controller is deactivated and the heading is turned so that thrust commanded elsewhere drives along the course; mecanum aligns its x/y thrust direction with the course.
  • The last valid course is held until NaNs are received. The position and course controllers are reset on every mode change.
  • The drift angle estimator moves into its own library and takes an optional expected direction of travel, so mecanum estimates and compensates drift relative to its thrust direction.
  • The rover docs show the course controller in the control structure and on the tuning pages, and RO_SPEED_RED is described by the heading error it actually uses. The rover tuning diagrams are SVGs instead of 2 to 3 MB PNGs, with wrong labels fixed.

Changelog Entry

For release notes:

Feature: rover course controller between position and attitude control, course hold also without a speed setpoint (thrust only)
Documentation: rover control structure and tuning pages show the course controller, rover tuning diagrams as SVG

Alternatives

  • NaN speed mapped to a zero speed setpoint: stops the vehicle instead of letting another source command the thrust.
  • Mecanum with NaN speed falling back to the speed limit: drives without a commanded speed.

Test coverage

SIH SITL on ackermann and differential: mission with stop at the end, Guided Course from rest, with speed and course changes, position mode course hold, steering release and recapture, and reverse. All checks passed except one mission upload acknowledgement on differential that the script missed. Mecanum and the NaN speed path were not tested in SITL.

@github-actions github-actions Bot added kind:refactor Code cleanup or redesign without intended behavior change. vehicle:rover Rover-specific behavior. scope:control Rate, attitude, position, allocation, or actuator control. kind:test Adds or improves tests. labels Nov 20, 2026
Ubuntu added 2 commits November 20, 2026 17:32
The course setpoint of Guided Course went straight to the position
controller, which mixed path following with course and speed control.
A separate course controller between the position controller and the
attitude and speed controllers lets any source command a course, also
without a speed setpoint: with a NaN speed the speed controller is
deactivated and the heading is turned so that the thrust commanded
elsewhere drives along the course (mecanum aligns its x/y thrust
direction with it). The last valid course is held until NaNs are
received, and the controllers are reset on every mode change.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Ubuntu <michael-fritsche@MichaelFritscheG14.galaxus.box>
…ted direction

The drift angle estimator only measured the ground velocity against the
heading, so an omnidirectional vehicle pushing sideways read its intended
motion as drift and mecanum had no drift compensation. Taking an optional
expected direction of travel in body frame lets mecanum estimate the drift
relative to its thrust direction and compensate it in thrust-only course
hold. As a library of its own it is no longer tied to rover_control.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Ubuntu <michael-fritsche@MichaelFritscheG14.galaxus.box>
@Frigiii
Frigiii force-pushed the frigi/feat/refractor_rover_module branch from 4512b93 to 071afab Compare November 20, 2026 16:33
@Frigiii Frigiii changed the title refactor(rover): split position control into position and course control refactor(rover): add course control between position and attitude control Nov 20, 2026
Ubuntu added 5 commits November 20, 2026 18:32
The rover tuning diagrams were 2 to 3 MB PNGs each. The SVG exports of
the same draw.io diagrams total about 1 MB and stay sharp at any zoom.
They keep the content of the PNGs: all boxes blue, and the differential
slow down diagram with its conditions and arrival speed formulas.

ackermann_cornering_comparison.png stays, it is a screenshot. The
translated pages keep linking the PNGs until they are regenerated.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Ubuntu <michael-fritsche@MichaelFritscheG14.galaxus.box>
The throttle setpoint was renamed to the thrust setpoint, the east axis
of the pure pursuit diagram was labelled S, the cornering diagram read
"Idea Path", and the differential state machine switches on the heading
error, not a bearing error. The maximum steer angle is an angle, not a
length.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Ubuntu <michael-fritsche@MichaelFritscheG14.galaxus.box>
The position controller now publishes a course setpoint and speed, and
the course controller turns them into speed and attitude setpoints. The
control structure diagrams, the tuning pages, Guided Course and the
setpoint hierarchy for offboard and external modes did not show this
step yet, and the SurfaceVehicleCourseSetpoint page still described the
old consumers and NaN handling.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Ubuntu <michael-fritsche@MichaelFritscheG14.galaxus.box>
The speed reduction uses the error between the heading setpoint of the
course controller and the heading, but the parameter and the tuning page
described it as the error between course and bearing setpoint.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Ubuntu <michael-fritsche@MichaelFritscheG14.galaxus.box>
The slow down diagram shows the arrival speed formula, but the text did
not say which parameters v_max and v_gain are, or how the change of
direction at the waypoint is normalized.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Ubuntu <michael-fritsche@MichaelFritscheG14.galaxus.box>
@Frigiii Frigiii changed the title refactor(rover): add course control between position and attitude control refactor(rover): add course control and update the rover docs Nov 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

No broken links found in changed files.

@Frigiii
Frigiii marked this pull request as ready for review November 23, 2026 07:52
With a NaN speed the course controller deactivates the speed controller,
and the actuator controllers keep the last thrust they received. A
publisher that sends no thrust of its own leaves the rover driving at the
speed controller's last thrust without speed control.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Michael Fritsche <frimi999@gmail.com>
The course controllers each converted the course setpoint to a heading
setpoint on their own, and ackermann and differential rovers ignored the
drift angle in reverse because it was only estimated driving forwards.

calcHeadingSetpoint() is the inverse of the drift angle estimate, with the
expected direction of travel as an optional parameter, so one tested
function serves forwards, reverse and the mecanum thrust direction.
Ackermann and differential rovers now pass pi in reverse to both the
estimator and the helper, so the drift angle is estimated and compensated
in either direction of travel.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Michael Fritsche <frimi999@gmail.com>
@Frigiii

Frigiii commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

@hamishwillee : I took the opportunity and changed all rover related png's to svg's. This causes CI to fail. I remember you mentioning that this is allright and will require some cleanup from your side?

… angle

The drift angle was filtered as an angle relative to the direction of
travel, so after a course change the vehicle kept the correction measured
on the previous course, although the current that causes it is fixed in
NED. Estimate the current as a vector in NED instead, from the ground
velocity minus the commanded speed along the expected direction of
travel, and solve the wind and current triangle for each course setpoint.

Without a speed setpoint (thrust-only course hold, rover_mecanum) the
measured speed along the expected direction stands in for the commanded
one, so only the current across the direction of travel is estimated.

Ported from 87aacfc9c8, which did not cherry-pick onto the course
control split.

Assisted-by: Claude:claude-opus-5-5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind:refactor Code cleanup or redesign without intended behavior change. kind:test Adds or improves tests. scope:control Rate, attitude, position, allocation, or actuator control. vehicle:rover Rover-specific behavior.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant