-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Road map, especially for pointcloud2? #163
Comments
Hi, late but maybe expected answer :
|
For other's stumbling over this: It seems to be that only the infrastructure to work conveniently with point clouds is missing, but you can absolutely create a PointCloud2 message manually: let cloud_publisher = rosrust::publish("/cloud", 100).unwrap();
let mut cloud = rosrust_msg::sensor_msgs::PointCloud2::default();
cloud.header.seq = 0;
cloud.header.frame_id = "map".to_string();
cloud.header.stamp = rosrust::now();
cloud.height = 1;
cloud.width = 10;
cloud.fields = vec![
rosrust_msg::sensor_msgs::PointField {
name: 'x'.to_string(),
offset: 0,
datatype: rosrust_msg::sensor_msgs::PointField::FLOAT32,
count: 1
},
rosrust_msg::sensor_msgs::PointField {
name: 'y'.to_string(),
offset: 4,
datatype: rosrust_msg::sensor_msgs::PointField::FLOAT32,
count: 1
},
rosrust_msg::sensor_msgs::PointField {
name: 'z'.to_string(),
offset: 8,
datatype: rosrust_msg::sensor_msgs::PointField::FLOAT32,
count: 1
},
];
cloud.is_bigendian = false; // seems to be ignored by rviz, so probably has to be host order
cloud.point_step = 3*4; // size of a point in bytes
cloud.row_step = cloud.point_step * cloud.width; // length of a row in bytes (not really used as our cloud here is 1D)
cloud.is_dense = true; // no invalid points
cloud.data = Vec::with_capacity((cloud.width * cloud.point_step) as usize);
// generate some points
for i in 0..10 {
let x: f32 = 1_f32;
let y: f32 = i as f32;
let z: f32 = i as f32/10.0;
// ideally, we would use to_le_bytes() or to_be_bytes() here, but the is_bigendian flag doesn't seem to be supported by rviz
cloud.data.extend_from_slice(&x.to_ne_bytes());
cloud.data.extend_from_slice(&y.to_ne_bytes());
cloud.data.extend_from_slice(&z.to_ne_bytes());
}
cloud_publisher.send(cloud).unwrap(); This works, at least with rviz. No guarantees that this is the most performant code ;) |
@iliis Hey I'm new to rosrust. I just read your message and I'd like to implement pointcloud2 and maybe upstream it if I get something working. When you say that it works with rviz you mean that you are able to send a pointcloud message that gets serialized into bytes and sent over the wire to later be retrieved by another node that will deserialize it into a struct (rust, cpp or py) ? If this is the case then I don't see what's missing. |
@noufelez Yes, exactly, although I haven't tested it extensively. |
Thanks for your quick response! I see. I'll try to get something working in the near future. I'll update this thread when I do so to notify people that may need it. |
You could also use https://crates.io/crates/ros_pointcloud2. Full disclosure: it is my first crate, I just started Rust and rosrust is my first real application for it. I did not see this issue before, else I probably could have waited for @noufelez but I needed it really soon for a lot of point cloud work. |
Hi,
Very excited by this project, especially for a simple ROS client I'd like to use it for in development/debugging scenarios only to interface with existing C++ ROS services. But is there a list of supported ros modules and msgs?
For instance:
rosbridge
, as I would be using Rust to create a rest server runningrosbridge_suite
to convert json messages it receives into ROS msgs to send onward to my C++ ROS services that expect variousgeometry_msgs
as well as more basicstd_msgs
including arrays.Is support for ROS2 on the horizon? Or would that break some backs to get implemented anytime soon?Just found it: https://github.com/ros2-rust/ros2_rustThe text was updated successfully, but these errors were encountered: