Skip to content

Commit

Permalink
simplifies the viz
Browse files Browse the repository at this point in the history
  • Loading branch information
gbin committed Dec 5, 2024
1 parent 6dd476c commit cb3f2ac
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 22 deletions.
2 changes: 1 addition & 1 deletion examples/cu_pointclouds/ptclouds.ron
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
),
(
id: "rerun",
type: "RerunViz",
type: "RerunPlyViz",
),
],
cnx: [
Expand Down
31 changes: 10 additions & 21 deletions examples/cu_pointclouds/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,36 +84,29 @@ const SLAB_SIZE: Option<usize> = Some(100 * 1024 * 1024);
#[copper_runtime(config = "ptclouds.ron")]
struct PtCloudsApplication {}

struct RerunViz {
struct RerunPlyViz {
rec: Option<rerun::RecordingStream>,
}

impl Freezable for RerunViz {}
impl Freezable for RerunPlyViz {}

impl<'cl> CuSinkTask<'cl> for RerunViz {
impl<'cl> CuSinkTask<'cl> for RerunPlyViz {
type Input = input_msg!('cl, LidarCuMsgPayload);

fn new(_config: Option<&ComponentConfig>) -> Result<Self, CuError>
where
Self: Sized,
{
Ok(Self { rec: None })
}

fn start(&mut self, _clock: &RobotClock) -> Result<(), CuError> {
self.rec = Some(
rerun::RecordingStreamBuilder::new("Ply Visualizer")
.spawn()
.unwrap(),
);
Ok(())
Ok(Self {
rec: Some(
rerun::RecordingStreamBuilder::new("Ply Visualizer")
.spawn()
.unwrap(),
),
})
}

fn process(&mut self, _clock: &RobotClock, input: Self::Input) -> _CuResult<()> {
println!(
"Received a point cloud with {} points",
input.payload().unwrap().len()
);
let points: Vec<Position3D> = input
.payload()
.unwrap()
Expand All @@ -129,10 +122,6 @@ impl<'cl> CuSinkTask<'cl> for RerunViz {

Ok(())
}
fn stop(&mut self, _clock: &RobotClock) -> Result<(), CuError> {
self.rec = None;
Ok(())
}
}
fn main() {
let tmp_dir = tempfile::TempDir::new().expect("could not create a tmp dir");
Expand Down

0 comments on commit cb3f2ac

Please sign in to comment.