From d193c3d75c26633605fa5d28fc1530cd2ecd60a7 Mon Sep 17 00:00:00 2001 From: Lucas Walter Date: Sun, 15 Sep 2024 11:15:15 -0700 Subject: [PATCH] use flatten() to get non-none tf_static message thanks to clippy --- mcap_tools/src/mcap_play.rs | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/mcap_tools/src/mcap_play.rs b/mcap_tools/src/mcap_play.rs index 96f9bd9..74ff316 100644 --- a/mcap_tools/src/mcap_play.rs +++ b/mcap_tools/src/mcap_play.rs @@ -107,27 +107,25 @@ async fn mcap_playback_init( // topic? The easiest thing would be to save tf_static to a separate mcap in the // first place, more advanced would be for mcap_record to put all the statics // in a separate chunk but then 'mcap convert' wouldn't do that. - for message_raw in mcap::MessageStream::new(mapped)? { - if let Ok(message) = message_raw { - if message.channel.topic != "/tf_static" { - continue; - } - let msg_with_header = misc::get_message_data_with_header(message.data); - match serde_rosmsg::from_slice::(&msg_with_header) { - Ok(tf_msg) => { - log::info!( - "{mcap_name} adding {} transforms to tf_static, total {}\r", - tf_msg.transforms.len(), - tf_msg.transforms.len() + tf_static_aggregated.transforms.len(), - ); - for transform in tf_msg.transforms { - tf_static_aggregated.transforms.push(transform); - } - } - Err(err) => { - log::error!("{mcap_name} {err:?}"); + for message in (mcap::MessageStream::new(mapped)?).flatten() { + if message.channel.topic != "/tf_static" { + continue; + } + let msg_with_header = misc::get_message_data_with_header(message.data); + match serde_rosmsg::from_slice::(&msg_with_header) { + Ok(tf_msg) => { + log::info!( + "{mcap_name} adding {} transforms to tf_static, total {}\r", + tf_msg.transforms.len(), + tf_msg.transforms.len() + tf_static_aggregated.transforms.len(), + ); + for transform in tf_msg.transforms { + tf_static_aggregated.transforms.push(transform); } } + Err(err) => { + log::error!("{mcap_name} {err:?}"); + } } } }