Repository navigation
Conversation
…nts) and incorporate that into MCL.
…on established, TelemetryControlTask control flow matches the algorithms
…de multiplexing. The entire test suite should be good to go with these new algorithm changes now.
nicoleluo7
approved these changes
Nov 13, 2026
nicoleluo7
left a comment
Contributor
There was a problem hiding this comment.
LGTM - sail trim on the Teensy and new control modes make sense, and the tests adequately cover the mode switch and the wind-angle changes. approving now, agreeing that RC app mode change and the physical anemometer check are still left as follow-ups.
EmithU
reviewed
Nov 14, 2026
EmithU
left a comment
Member
There was a problem hiding this comment.
I'll work on fixing the app/Pico side of things, this is non-trivial because there's only 1 bit for storing control mode right now, we'll need to update it to 2. Should be pretty quick. This looks good though 👍
ericcai32
reviewed
Nov 14, 2026
angiez23
approved these changes
Nov 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The deterministic algo is now on the Teensy!
This PR brings initial deterministic algorithm tasks over from
sailbottoboat-- this time in theteensy/codebase rather than as ROS nodes. Currently, the deterministic algorithm for trimming the sails is fully implemented, while the algorithm for setting the rudder is not.Core Functionality
The biggest architecture change to this codebase was the new
sailing/directory, created to store the new deterministic algorithm tasks. It contains:sail_trim_algo-- a task which corresponds to the oldtrim_sailnode fromsailbot.steering_algo-- a task which corresponds toAlbo, or more generally, the state machine that we used to simply label as the "sailing algorithm".Note that
steering_algois currently only a filler/fake -- an actual deterministic steering algorithm has not been written or ported over yet. This simplified version acts as (helpful) boilerplate: something that can hopefully be used by thesailbenchteam as they figure out testing.Other Notable Changes
In order to work the above algorithm tasks into the existing Teensy codebase, some global modifications had to be made. The most important such changes include:
ControlMode(incontants.hpp) and the parallelcontrol::modein the SFR: more explicit bookkeeping to represent current control mode state (Radio or RC or deterministic algorithm). This replaces the implicit multiplexer we had before, which was tied only to theradio_flagSFR field.0represents being in RC mode, (unlike before),1represents being in ROS/RL algo mode, and2represents being in deterministic algo mode.ServoControlTaskandLedControlTaskwere updated accordingly in how they handled each control mode.AnemometerMonitor: the angle-reading convention was finally modernized so that a value of 0 represents being head-to-wind, and a value of 180 represents being dead downwind.TelemetryControlTask: restructured slightly to match the control flow of the deterministic algorithm tasks.MainControlLoop-- algorithm tasks entered and execution order optimized.Finally, tests were added to enforce all of the above functionality:
sail_trim-- added to the suite to verify the new sail trimming logic of the corresponding algorithm task.anemometer,led,servo_control-- verify the convention updates described above.Remaining Work
The new control mode conventions on the Teensy must be reflected elsewhere in the CUSail stack. Most notably, for the RC app:
1: before, that (or more generallyradio_flag != 0) meant to initiate radio mode; now,radio_flag = 0(or more generallyradio_flag != {1, 2}) means to initiate radio mode. This needs to be reflected in the packet sent by the RC app.Also, we need to test the anemometer physically to double check what side of the boat receives which angle (e.g. does a reading of 90 degrees mean wind on the port or starboard side of the boat).