LOC - Localizer Board (HYPE-90) - #75
Draft
misha7b wants to merge 113 commits into
Draft
Conversation
…eter-preprocessor
davidbeechey
requested changes
Mar 6, 2025
davidbeechey
left a comment
Collaborator
There was a problem hiding this comment.
Looking good, sorry for the delay in accelerometer. Optical flow is merged now so that can be added to your sensor reading logic and passed to your localiser :)
misha7b
force-pushed
the
localizer_board_code
branch
from
March 20, 2025 18:43
764037a to
9e26cca
Compare
davidbeechey
requested changes
Mar 26, 2025
Comment on lines
+71
to
+111
| loop { | ||
| // Wait for new Keyence stripe count. | ||
| let stripe_count1 = receiver1.get().await; | ||
| let stripe_count2 = receiver2.get().await; | ||
|
|
||
| let flow = optical_flow.get_motion().await.unwrap(); | ||
| let optical_data: Vec<f64, 2> = Vec::from_slice(&[flow.x as f64, flow.y as f64]).unwrap(); | ||
|
|
||
| defmt::info!( | ||
| "New Keyence stripe counts: sensor1 = {}, sensor2 = {}", | ||
| stripe_count1, | ||
| stripe_count2 | ||
| ); | ||
|
|
||
| // Create the sensor data. (no accelerometer data) | ||
| let keyence_data: Vec<u32, 2> = Vec::from_slice(&[stripe_count1, stripe_count2]).unwrap(); | ||
| let accelerometer_data: RawAccelerometerData<NUM_ACCELEROMETERS, NUM_AXIS> = | ||
| RawAccelerometerData::from_slice(&[ | ||
| Vec::from_slice(&[0.0, 0.0, 9.81]).unwrap(), | ||
| Vec::from_slice(&[0.0, 0.0, 9.81]).unwrap(), | ||
| Vec::from_slice(&[0.0, 0.0, 9.81]).unwrap(), | ||
| Vec::from_slice(&[0.0, 0.0, 9.81]).unwrap(), | ||
| ]) | ||
| .unwrap(); | ||
|
|
||
| match localizer.iteration(optical_data, keyence_data, accelerometer_data) { | ||
| Ok(()) => { | ||
| defmt::info!( | ||
| "Iteration OK: displacement = {} m, velocity = {} m/s, acceleration = {} m/s**2", | ||
| localizer.displacement, | ||
| localizer.velocity, | ||
| localizer.acceleration | ||
| ); | ||
| } | ||
| Err(e) => { | ||
| defmt::error!("Iteration error: {:?}", e); | ||
| } | ||
| } | ||
|
|
||
| Timer::after(Duration::from_millis(100)).await; | ||
| } |
Collaborator
There was a problem hiding this comment.
I think the way this loop is written at the moment all of the sensors will need to have their value read before the localiser is updated. Is probs better to check if any value has been updated instead so that it's updating as often as possible
JoelHorrocks
added a commit
to Hyp-ed/hyped-2026
that referenced
this pull request
Nov 13, 2025
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.
No description provided.