Skip to content

LOC - Localizer Board (HYPE-90) - #75

Draft
misha7b wants to merge 113 commits into
mainfrom
localizer_board_code
Draft

LOC - Localizer Board (HYPE-90)#75
misha7b wants to merge 113 commits into
mainfrom
localizer_board_code

Conversation

@misha7b

@misha7b misha7b commented Feb 9, 2025

Copy link
Copy Markdown
Contributor

No description provided.

@davidbeechey davidbeechey left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 :)

Comment thread lib/localisation/src/control/localizer.rs Outdated
@misha7b
misha7b force-pushed the localizer_board_code branch from 764037a to 9e26cca Compare March 20, 2025 18:43
Comment thread boards/stm32f767zi/src/bin/loc.rs Outdated
Comment thread boards/stm32f767zi/src/bin/loc.rs Outdated
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;
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread boards/stm32f767zi/src/bin/loc.rs Outdated
JoelHorrocks added a commit to Hyp-ed/hyped-2026 that referenced this pull request Nov 13, 2025
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.

3 participants