Skip to content

193 Add multi-waypoint path API via shared memory#194

Open
gdoffe wants to merge 10 commits into
masterfrom
193-allow-to-pass-a-list-of-points-through-canpb
Open

193 Add multi-waypoint path API via shared memory#194
gdoffe wants to merge 10 commits into
masterfrom
193-allow-to-pass-a-list-of-points-through-canpb

Conversation

@gdoffe

@gdoffe gdoffe commented Feb 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Add a multi-waypoint path API that sends all waypoints to the firmware at once via shared memory (planner -> copilot -> CAN).

Changes

  • copilot: align controller enum with firmware - Sync ControllerEnum with current PB_Controller.proto (QUADPID_TRACKER, TRACKER_SPEED_TUNING)
  • planner: use TRACKER_SPEED_TUNING for PID test strategies - The firmware merged the two separate speed test chains into a single TRACKER_SPEED_TUNING chain
  • copilot: add path API for multi-waypoint navigation - Add CAN UUIDs (path_reset, path_add_point, path_start, path_complete) and new_path_event_loop() in the copilot
  • planner: add path API - Add path_reset(), path_add_point(), path_start() methods and _sending_path guard
  • copilot: pass set_controller through shared memory - Move set_controller from SIO to shared memory to guarantee CAN message ordering
  • copilot: pass pose_start through shared memory - Complete the migration for ordering guarantee
  • copilot: fix shared memory race conditions - Consume data after reading to prevent resending stale values

Design

The existing set_target_pose flow (SIO -> avoidance -> firmware) is unchanged. The new path API is an alternative for actions that need to send multiple waypoints at once.

The shared memory migration for set_controller and pose_start improves reliability by guaranteeing CAN message ordering through a single sequential event loop in the copilot.

@gdoffe gdoffe linked an issue Feb 4, 2026 that may be closed by this pull request
@gdoffe gdoffe self-assigned this Feb 4, 2026
@gdoffe gdoffe force-pushed the 193-allow-to-pass-a-list-of-points-through-canpb branch 2 times, most recently from c199ca9 to 389e334 Compare February 4, 2026 14:57
@gdoffe gdoffe force-pushed the 193-allow-to-pass-a-list-of-points-through-canpb branch from 7136002 to 9d5cdb3 Compare March 13, 2026 14:10
@gdoffe gdoffe force-pushed the 193-allow-to-pass-a-list-of-points-through-canpb branch 3 times, most recently from 2447b7b to 31c97d5 Compare April 14, 2026 13:44
gdoffe added 3 commits April 14, 2026 15:52
The ControllerEnum was outdated with old values (ANGULAR_SPEED_TEST,
LINEAR_SPEED_TEST, LINEAR_POSE_DISABLED) that no longer match the
firmware's PB_Controller.proto. Update to match the current protobuf
definition: QUADPID_TRACKER, TRACKER_SPEED_TUNING, ADAPTIVE_PURE_PURSUIT.

Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
The firmware merged the two separate speed test chains
(ANGULAR_SPEED_TEST, LINEAR_SPEED_TEST) into a single unified
TRACKER_SPEED_TUNING chain that handles both axes. Update the
default_controller property to use the new enum value for both
PID speed test strategies.
Replace single-pose sending with a path API that sends all waypoints
to the firmware at once (reset, add points, start). The copilot's
new_path_event_loop() reads the path from shared memory (written by
the planner) and sends CAN messages to the firmware.

Add CAN UUIDs for the path protocol (path_reset, path_add_point,
path_start, path_complete).

Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
@gdoffe gdoffe force-pushed the 193-allow-to-pass-a-list-of-points-through-canpb branch from 31c97d5 to 8f53ff8 Compare April 14, 2026 13:53
@gdoffe gdoffe changed the title 193 Path API and motion control improvements 193 Add multi-waypoint path API via shared memory Apr 14, 2026
gdoffe added 5 commits April 14, 2026 16:14
Add path_reset(), path_add_point() and path_start() methods to build
a multi-waypoint path. The path is written to shared memory and
post_update() signals the copilot to read it and send CAN messages
to the firmware. A _sending_path flag prevents spurious pose_reached
signals while the path is being configured.
The set_controller command was sent via SIO (planner → server → copilot)
while path data was sent via shared memory (planner → copilot). Since
these are two independent async channels, the firmware could receive
path_start before set_controller, causing the first waypoint to be
skipped: the old controller chain would set pose_reached=reached on the
first engine cycle before the new controller was installed.

Move set_controller to shared memory, using the same AvoidancePath lock
as path data. Both commands are processed by a single sequential event
loop in the copilot, which guarantees that set_controller CAN messages
are always sent before path_start. Using separate locks would create two
independent event loops with no ordering guarantee between them.

The SIO emit is kept for server/dashboard state tracking but CAN
ordering now relies solely on shared memory.

Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
Complete the migration of planner-to-copilot communication from SIO to
shared memory. The previous commit moved set_controller; this one adds
pose_start using the same AvoidancePath lock, guaranteeing CAN message
ordering (set_controller → pose_start → path_start) on the firmware.

The SIO handlers for pose_start and set_controller no longer send CAN
messages and only serve as info relays for the server/dashboard.

Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
The copilot event loop could wake up multiple times for a single path
sequence because set_controller, set_pose_start and path_start each
called post_update independently. This caused the path to be sent
multiple times or with partial data (1 waypoint instead of 4).

Consume shared memory data after reading (reset controller_id to -1,
clear path after sending) so stale values are not re-sent on subsequent
wake-ups. Add a notify parameter to set_controller and set_pose_start
so they can suppress post_update when called as part of a path sequence,
letting only path_start trigger the single notification.

Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
Replace deprecated pattern of inheriting from both str and Enum
with the modern StrEnum class available in Python 3.11+. Fixes
ruff UP042 lint error.
@gdoffe gdoffe force-pushed the 193-allow-to-pass-a-list-of-points-through-canpb branch from eaabaa5 to dea6710 Compare April 14, 2026 14:19
Update mcu-firmware submodule to include the lift emergency stop
fixes, anti-blocking detection, and path multi-waypoint CAN support.
@gdoffe gdoffe force-pushed the 193-allow-to-pass-a-list-of-points-through-canpb branch 6 times, most recently from 12c7ec3 to 8b85b7a Compare April 14, 2026 14:55
qmllint could not resolve custom QML components like DoubleSpinBox
because they were only found implicitly by the QML engine at runtime.

Add a qmldir file declaring all custom components in the monitor
module, and add explicit import "." in ConfigWindow.qml, Wizard.qml
and main.qml so qmllint resolves types from the same directory.

Also pin PySide6 to 6.10.0 in CI to match the project dependency
and avoid qmlformat differences between versions.
@gdoffe gdoffe force-pushed the 193-allow-to-pass-a-list-of-points-through-canpb branch from 8b85b7a to 8fb9f16 Compare April 14, 2026 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow to pass a list of points through canpb

1 participant