push broken system to let people eyeball the thread stuff

This commit is contained in:
Hartmut Seichter 2023-01-16 19:21:28 +01:00
parent 5a75999209
commit f3f995815b
8 changed files with 94 additions and 74 deletions

View file

@ -28,8 +28,8 @@ use vrpn::{
TypedBodylessHandler, Unbuffer,
};
#[derive(Resource, Debug)]
pub struct Tracker;
#[derive(Resource, Debug, Sync)]
pub struct Tracker { rx : Receiver<PoseReport> }
impl FromWorld for Tracker {
fn from_world(world: &mut World) -> Self {
@ -38,6 +38,8 @@ impl FromWorld for Tracker {
let (sender, receiver): (_, Receiver<PoseReport>) = channel();
let sender_th = sender.clone();
std::thread::spawn(move || {
// 212.201.64.122 | 127.0.0.1
@ -89,13 +91,17 @@ impl FromWorld for Tracker {
match result {
Ok(result) => { eprintln!("Pose from tracker {:?}",result.body);},
Ok(result) => {
eprintln!("Pose from tracker {:?}",result.body);
// sender_th.send(result.body).unwrap();
},
Err(_) => { /* silently fail */ }
}
}
});
Self {}
Self { rx = receiver.clone() }
}
}