GHI #112, #119 - Fix API data pipeline & add altitude tape [FV/typescript-rewrite] - #116
GHI #112, #119 - Fix API data pipeline & add altitude tape [FV/typescript-rewrite]#116ETSells wants to merge 6 commits into
Conversation
|
Parent has been moved out of draft state and is ready for review. One minor tweak was needed here, but this is also still ready |
f1f8190 to
621937c
Compare
|
@favillat Re-requesting review now that the base branch is ready to go. |
|
@NArmistead @MasterUser43 As this is top priority, I'm tagging both of you on the review as well. Please take a look and let me know if there's anything you don't feel you have sufficient expertise in. |
…ult system units to feet/g-force for flight.
621937c to
0f55948
Compare
favillat
left a comment
There was a problem hiding this comment.
lgtm, just a few minor considerations and a couple questions.
| METERS_TO_FEET = 3.280839895, | ||
| GRAVITY_MPS = 9.80665 | ||
| } | ||
| export default ConversionFactors; |
There was a problem hiding this comment.
It might be worth converting this to const instead of an enum
export const ConversionFactors = {
METERS_TO_FEET: 3.xx,
GRAVITY_MPS: 9.xx,
} as const;
| */ | ||
| interface UnitsHandler { | ||
| /* Shared members for unitsHandler. Not typed for inheritance reasons. */ | ||
| systemUnits: any |
There was a problem hiding this comment.
I'm curious as to what inheritance reasons? we could try doing a generic type to make it generally safer.
| break; /* SI/input units */ | ||
|
|
||
| default: | ||
| console.error("Invalid altitude units.") /* intentional fallthrough to G */ |
There was a problem hiding this comment.
I'm assuming this was meant to be "Invalid acceleration units", further down there are a few more instances of this aswell
| * @returns A string with the output value and its associated units | ||
| */ | ||
| getDisplayString(input: number): string { | ||
| if(this.systemUnits == AccelerationUnits.G_FORCE) |
There was a problem hiding this comment.
Nitpicky but it might be better to do strict equality checks here (===), they're faster and cleaner
| } | ||
|
|
||
| /* Extra step for altitude: reference mode */ | ||
| if(this.referenceElevation >= 0 && this.mode == AltitudeMode.QFE) { |
There was a problem hiding this comment.
same strict equality check comment as before, just makes this more predictable and doesn't hurt
| if (this.referenceElevation < 0) { | ||
| break; /* use QNH if no reference elevation defined. assumes we'd never launch from below sea level */ | ||
| } | ||
| input -= this.referenceElevation; /* negative altitudes allowed */ |
There was a problem hiding this comment.
This having no break here would mean any time we use QFE, we would default and log "Invalid altitude reference mode.". Instead why not skip the fall-thru all together and just let typescript types deal with issues? it might make future debugging a bit easier.
NArmistead
left a comment
There was a problem hiding this comment.
I'm not going to claim to understand everything that's going on but lgtm as far as I can tell
| * Firmware uses the NED (North-East-Down) convention of X: roll, | ||
| * Y: pitch, Z: yaw, so at the identity orientation the model's | ||
| * nose must point along Three's +X (see baseQuat below). A 90° | ||
| * rotation on the +X axis aligns the firmware's body frame with |
There was a problem hiding this comment.
ehh some of this comment is kinda redundant (i wrote it)
| * similarity transform (conjugation), since firmware's body-frame | ||
| * axes are not the same axes as Three's world frame axes. This is | ||
| * NOT the same as composing two rotations (simple multiplication) — | ||
| * conjugation is what's required when changing the basis a |
There was a problem hiding this comment.
aren't we using the inverse here not the conjugate?
There was a problem hiding this comment.
is this working correctly now? i haven't tested on hardware since i fixed(?) it
Issues: #112, #119 (relates to: #44, #101)
Parent: SunDevilRocketry/Flight-Computer-Firmware#301
Description
Adds an altitude tape widget to the right of the renderer, fixes the new data pipeline from the API, adds the remaining data readouts to the sensor readings widget, and fixes some responsiveness issues.
Due to a lack of response on the original and the need to build on existing changes, additional features have been added on top of this PR:
a. Ideally, we'll include settings page linkage once that exists, but for now this already helps unify our view/presenter framework a bit.
b. All unit converters implement an interface that defines the base functions, so polymorphism is possible.
c. The altitude converter also includes a ground reference "QFE" mode in addition to the usual sea-level reference "QNH" mode.
NOTE: Builds fail due to an issue that predates this PR and should be fixed by the owner of the target branch. No new errors are generated by this PR, and
npm run devstill works.Originator Checklist
Not all features introduced here have a relevant issue.
No unit test framework exists for this project, so unit tests have not been written.
Manually performed system & integration tests.