Repository navigation
Measure heading and course right-handed, positive to the right as seen from the ground station - #362
Draft
1-Bort-1 wants to merge 2 commits into
Conversation
BREAKING: the heading and the course are zero towards zenith and positive to the right as seen from the ground station, with no wind direction in them, as calc_heading and calc_course of KiteUtils after v0.14.2 define them. calc_heading(s) and calc_course(s) pass azimuth_east and drop the keywords upwind_dir_ and neg_azimuth, which no longer mean anything. The models fly as before: the gravity correction of the KPS3 steering (Eq. 30 of Fechner et al. 2015) carries the sign of the paper's heading, and the settings heading and heading_rate of KPS4 are solved against calc_heading, so they now mean the new convention. A positive steering input still turns the kite to the left as seen from the ground station, which is now a negative heading rate. Tests, the heading and steering examples and the parking controller example are re-derived for the new sign; the parking controller's calc_steering self-test passes the heading rate it expects again. The unused psi field of KPS4 is removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4 tasks
1-Bort-1
commented
Nov 14, 2026
1-Bort-1
left a comment
Member
Author
There was a problem hiding this comment.
Independent review (advisory)
Verdict: APPROVE WITH COMMENTS · 2 inline, 0 off the diff
Good
calc_heading(s)/calc_course(s)(src/KiteModels.jl:485-499) now passcalc_azimuth_eastwith no wind keyword, matching the KiteUtils#194 signature in the issue.upwind_dir_andneg_azimuthare removed, not kept as no-ops, and the BREAKING changelog entry names both.- KPS3 gravity correction (src/KPS3.jl:341): negating
c2_corwhile the storedpsichanges sign leaves the physics unchanged, as the issue requires. test-kps3.jl:89 flipspsito -0.2 and keeps the reference forces, which shows this. - Orientation reference values were mirrored to 360° minus the old values (319.1→40.9, 229.1→130.9, 234.7→125.3). Tolerances were not loosened, and the wind-rotation cases still read 0, which is the issue's "nose to zenith reads 0 at every wind direction" check.
- The heading-steering tests give the sign a physical meaning. Heading +90° now asserts a negative azimuth: flying right as seen from the ground station is south for an anticlockwise azimuth. Steering +20% now asserts a heading below -20° with
respos=false, which fits steering turning the kite the same physical way as before. - Parking controller
navigate:sin(phi - phi_set)mirrors the bearing to right-positive.phiandphi_setstay in the same wind frame, soparking_wind_dir.jlstill gets a consistentchi_set. - test-orientation.jl:43 delegates the 4-argument helper to the 5-argument one. This removes a duplicate and fixes the old bug where
deg2rad(-90)was passed as the wind speed. set_initial_heading!andheading_slope!solve againstcalc_heading(s), soset.headingandset.heading_ratetake the new convention with no code change. The settings docstring (src/KiteModels.jl:992) states that convention.
Not good
examples/test_heading.jl:96— This@test_brokenwas given a guessed new reference of 45°. test-orientation.jl:156 computes 40.89° for the identical orientation and position and passes, so the issue's "re-derive, not loosen" is not met here: the case stays permanently broken against a value known to be wrong instead of becoming a passing@testat 40.8933946491309.test/test-orientation.jl:99— Each zero-heading case now accepts 0 or 360, copied inline in five places (also lines 209, 244 and 256). The singleheading > 359wrap that existed before was multiplied rather than kept as one helper. §7 says the same setup repeated across tests becomes one helper.isapprox(heading, 0, …) || isapprox(heading, 360, …)is repeated five times in test-orientation.jl and once in examples/test_heading.jl. One wrapped-angle helper, orrespos=falseinobtain_results, would state the property once, and a||inside@testhides the evaluated value when the test fails.- test-heading-steering.jl:41: the testset is renamed to "heading 90°" only, but line 51 also asserts the -90° mirror. The name no longer covers everything the test protects.
- test-kps3.jl:467 still says "the heading is calculated with the new wind". The test is still valid because the KPS3 kite frame comes from the apparent wind, but in a PR that removes the wind from the heading the comment now reads as the old convention.
- examples_3d/parking_controller.jl:188:
ndi_gainis now negative (-2.08), andauto_parking_4p.jllogs and plots it asNDI_GAIN. The changelog does not mention this sign change visible in the example plots. - The card lists the
cleanupitems (deletedpsifield, duplicate test case, unused helper, self-test fix) but does not say what was searched for before writing, as §2 asks.
claude, rubric CLEAN_CODE.md. A different lab from the implementer
on purpose: a reviewer sharing its blind spots would not flag its mistakes.
The pitch-and-azimuth case of the heading example now asserts the 40.89° that the orientation test computes for the same kite, instead of a broken guess. Zero headings are compared with wrap2pi rather than an inline 0-or-360 check. Test name and comment follow the new convention; the changelog says the parking example's NDI gain is now negative. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Local full suite: PASS (6 min, Julia 1.13.3, one cell of the matrix) |
8 of 9 tasks
This branch has not been deployed
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.
Depends-On: OpenSourceAWE/KiteUtils.jl release after v0.14.2
KiteUtils' next release changes the heading and course convention (OpenSourceAWE/KiteUtils.jl#194). Both angles become zero with the nose, or the velocity, pointing to zenith and positive to the right as seen from the ground station. They also no longer depend on the wind direction. Today they are positive to the left. This branch moves KiteModels to that convention everywhere it produces or reads a heading, while the kite models fly exactly as before.
A user sees the sign of every heading, course and heading rate flip: the getters, the system state, and every log written from now on. The initial
headingsandheading_ratesinsettings.yamlare read in the new convention. A file written for the old one turns the kite the other way until the sign is flipped. Positive steering still turns the kite the same way, to the left as seen from the ground station, which is now a negative heading rate. The changelog says this under BREAKING.Decisions I made:
Fixed along the way:
psi, which is now deleted.Before writing anything new I searched the repository and KiteUtils for an existing heading wrap, the convention's getters and every caller of the heading keywords; the zero-heading checks reuse KiteUtils' angle wrap instead of a new helper, and nothing else needed a new function.
For the reviewer: this is stacked on #354 (move to KiteUtils 0.14), which merges first. It holds until KiteUtils releases the change in OpenSourceAWE/KiteUtils.jl#195, which is open and green. KitePodModels, WinchModels and KiteViewers also need releases that allow KiteUtils 0.14, which #354 waits on too. Left before merge: once that release is out, this branch moves the KiteUtils bound to it, re-resolves both default manifests and reruns the affected tests. The code and tests are ready for review now.
Verification
All runs used the KiteUtils #194 branch, with KitePodModels, WinchModels and KiteViewers from their branches that allow 0.14. Every other package was pinned to the tracked manifest.
test/test-heading-steering.jlon the unchanged code givesMethodError: no method matching calc_heading(::SVector{4, Float64}, ::Float64, ::Float64; upwind_dir::Float64, respos::Bool)(51 passed, 15 errored).test-orientation(88),test-heading-steering(67),test-initial-rates(43),test-kps3(166),examples/test_heading.jl(7, none broken),test-kps4,test-update-sys-stateandtest-azimuthall pass. Sign-dependent reference values were mirrored from the old ones, not loosened: every orientation case reads 360° minus its old value, and a nose to zenith reads 0 at every wind direction tested.examples/steering_test_1p.jl: turn-rate law factor 19.2857 → 19.2855 °/m, delay 0.12 s both.steering_test_4p.jl: c1 = 0.1489 and c2 = 4.795, delay 0.26 s, before and after.Opened by
1-Bort-1, an AI agent working for @1-Bart-1.Closes #361 · task
KiteModels.jl-361Refs OpenSourceAWE/KiteUtils.jl#194