Custom homography per laser
This commit is contained in:
parent
7ae6768edb
commit
5e14833e6e
2 changed files with 12 additions and 5 deletions
|
@ -176,7 +176,10 @@ fn get_dac_configs() -> DacConfigMap{
|
|||
let mut dac_configs: DacConfigMap = HashMap::new();
|
||||
dac_configs.insert(
|
||||
DacId::Helios { id: 926298163 },
|
||||
DacConfig{homography: python_cv_h_into_mat3(TMP_PYTHON_LASER_H)}
|
||||
DacConfig{
|
||||
name: "Helios#1".into(),
|
||||
homography: python_cv_h_into_mat3(TMP_PYTHON_LASER_H)
|
||||
}
|
||||
);
|
||||
dac_configs
|
||||
}
|
||||
|
@ -243,7 +246,6 @@ fn model(app: &App) -> Model {
|
|||
if detected.insert(dac.id()) {
|
||||
|
||||
// DacId::EtherDream { mac_address: () }
|
||||
dbg!(&detected);
|
||||
println!("{:#?}", dac);
|
||||
if dac_tx.send(dac).is_err() {
|
||||
break;
|
||||
|
@ -301,7 +303,7 @@ fn laser_frame_producer(model: &mut LaserModel, frame: &mut laser::Frame){
|
|||
let space = &model.current_lines.space;
|
||||
let pointno = points.len();
|
||||
|
||||
dbg!(model.config.homography);
|
||||
dbg!(&model.config.name);
|
||||
|
||||
let mut new_points = Vec::new();
|
||||
for point in points.into_iter() {
|
||||
|
@ -362,7 +364,11 @@ fn update(_app: &App, model: &mut Model, update: Update) {
|
|||
println!("Detected DAC {:?}!", dac.id());
|
||||
let config = match model.per_laser_config.contains_key(&dac.id()) {
|
||||
true => &model.per_laser_config[&dac.id()],
|
||||
false => &DacConfig::default(),
|
||||
false => {
|
||||
println!("Found unknown DAC, try to register it in get_dac_configs()");
|
||||
dbg!(&dac.id());
|
||||
&DacConfig::default()
|
||||
},
|
||||
};
|
||||
let stream = model
|
||||
.laser_api
|
||||
|
|
|
@ -72,6 +72,7 @@ pub struct LaserTimer {
|
|||
pub struct DacConfig{
|
||||
// #[serde(with = "DacIdSerializable")]
|
||||
// id: DacId,
|
||||
pub name: String,
|
||||
pub homography: Mat3
|
||||
}
|
||||
|
||||
|
@ -80,6 +81,6 @@ const LASER_H: Mat3 = python_cv_h_into_mat3(TMP_PYTHON_LASER_H);
|
|||
|
||||
impl Default for DacConfig{
|
||||
fn default() -> DacConfig{
|
||||
DacConfig { homography: Mat3::IDENTITY }
|
||||
DacConfig { name: "Unknown".into(), homography: Mat3::IDENTITY }
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue