Skip to content

Commit f9164e2

Browse files
committed
Some WIP state
1 parent 347b9ca commit f9164e2

File tree

5 files changed

+247
-111
lines changed

5 files changed

+247
-111
lines changed

Cargo.lock

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/control/src/calibration_controller.rs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use std::{time::Duration, vec};
22

33
use color_eyre::Result;
4+
use itertools::Itertools;
45
use serde::{Deserialize, Serialize};
56

67
use calibration::{
@@ -283,7 +284,7 @@ fn collect_filtered_values(
283284

284285
// TODO Add fancier logic to either set this via parameters OR detect the location, walk, etc
285286
fn generate_look_at_list() -> Vec<(Point2<Ground>, CameraPosition)> {
286-
let look_at_points: Vec<Point2<Ground>> = vec![
287+
let look_at_points: Vec<_> = vec![
287288
point![1.0, -0.2],
288289
point![1.0, -0.1],
289290
point![2.0, -0.1],
@@ -301,8 +302,25 @@ fn generate_look_at_list() -> Vec<(Point2<Ground>, CameraPosition)> {
301302
point![1.0, 0.2],
302303
];
303304

305+
let mut interpolated = Vec::with_capacity(look_at_points.len() * 2);
306+
for (p, p1) in look_at_points.iter().tuple_windows() {
307+
let mid_point = (p.coords() + p1.coords()) / 2.0;
308+
interpolated.push(p.clone());
309+
interpolated.push(mid_point.as_point());
310+
}
311+
if let Some(last_point) = look_at_points.last() {
312+
interpolated.push(last_point.clone());
313+
}
314+
315+
assert!(
316+
interpolated.len() == look_at_points.len() * 2 - 1,
317+
"{},{}",
318+
interpolated.len(),
319+
look_at_points.len()
320+
);
321+
304322
[CameraPosition::Top, CameraPosition::Bottom]
305323
.iter()
306-
.flat_map(|&position| look_at_points.iter().map(move |&point| (point, position)))
324+
.flat_map(|&position| interpolated.iter().map(move |&point| (point, position)))
307325
.collect()
308326
}

crates/vision/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ image = { workspace = true }
2121
imageproc = { workspace = true }
2222
itertools = { workspace = true }
2323
linear_algebra = { workspace = true }
24+
lstsq = { workspace = true }
2425
nalgebra = { workspace = true }
2526
ordered-float = { workspace = true }
2627
projection = { workspace = true }

0 commit comments

Comments
 (0)