-
Notifications
You must be signed in to change notification settings - Fork 1
LOC - Localizer Board (HYPE-90) #75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…eter-preprocessor
davidbeechey
left a comment
There was a problem hiding this comment.
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 :)
764037a to
9e26cca
Compare
boards/stm32f767zi/src/bin/loc.rs
Outdated
| 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; | ||
| } |
There was a problem hiding this comment.
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
No description provided.