Comments (4)
Yes now I understand better, thanks. I agree that it would be nice to have. I just pushed a quick fix (d5f2ef0) that should enable your usecase. Let me know if it works.
from r2r.
Hi,
If you know what you need I am open to exposing more functionality. I am not 100% clear on your usecase though. What will you do with the data eventually? Since you are using r2r I assume that eventually you want to publish some data as ros messages? If so I think the untyped set of functions would work, populate a serde_json::Object
given the schema you have and publish the data that way. But the message type must exist and be built on the ros side for this to work, so you cannot for example create a bridge that supports an artibrary schema on the fly.
from r2r.
Thank you for your answer, let me add a quick clarification:
- I have a few mcap files (ros bags) stored on file system
- I want to make the data available for post processing (running ML models, etc.). Think about reshaping the messages in the rosbag to align multiple camera images to the same frequency/timestamps, experimenting with different model parameters, etc. on the collected data.
- I want to execute this post processing inside the ROS2 environment (libraries can be/will be preloaded/linked), but not as a node. To do this, I need the
from_serialized_bytes
function to be available. See the code below:
for message in mcap::MessageStream::new(&mapped)? {
let message = message?;
let schema_name = message
.channel
.schema
.as_ref()
.map(|schema| schema.name.as_str())
.unwrap_or_default();
if schema_name == "sensor_msgs/msg/Imu" {
// message.data is [u8]
let data = from_serialized_bytes::<sensor_msgs::msg::Imu>(&message.data)?;
}
}
Now my challenge is that the from_serialized_bytes
is not publicly available. Making it public will unlock this use case.
In addition to this, it would be great to access data from messages without hardcoding schema types, just by type names. As you mentioned, the messages must be defined at compilation time (which is ok). Imagine something like:
let native =
WrappedNativeMsgUntyped::new_from("sensor_msgs/msg/Imu").unwrap();
native.from_serialized_bytes(&message.data).unwrap();
It will help me to create tools like topic_tools
where I can cat
the contents of files, downsample, etc. without hardcode each and every type. If you can help point me to the right direction I can try to implement myself.
Hope this makes a bit more sense.
from r2r.
This was quick! Thank you, I will a give a try but based on the example it is exactly what I needed.
Thanks again!
from r2r.
Related Issues (20)
- action server topic not listed with `ros2 topic list` HOT 2
- Compile only necessary packages to speed up compilation HOT 5
- Failed docs.rs build HOT 3
- Support for deadline on subscribers HOT 2
- Bug: Incorrect message name conversion to snake case HOT 4
- Implementing Actions HOT 4
- [Discussion] support ROS_TIME from /clock source HOT 1
- Regression: Commit e33a57c causes "'rcl/rcl.h' file not found" HOT 9
- Handling raw messages with `rcl_take_serialized_message` HOT 1
- Get publisher infos by topic HOT 2
- How to create a new r2r::builtin_interfaces::msg::Time to represent the current timestamp? I can't seem to find fn HOT 2
- Occasional build failures HOT 2
- Version 0.8.3 won't build, Error E0446 HOT 2
- BUG: Cannot compile library HOT 2
- Use-after-free when failing to `rcl_return_loaned_message_from_subscription` HOT 4
- sensor_msgs cannot found HOT 2
- Question about the `spin_once` function HOT 5
- unsafe precondition(s) violated: ptr::copy_nonoverlapping with rust 1.78 HOT 1
- ROS2 Jazzy support HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from r2r.