lucasw / transform_point_cloud

transform a pointcloud2 with tf2
BSD 3-Clause "New" or "Revised" License
32 stars 11 forks source link

transform_point_cloud rust version with roslibrust #7

Open lucasw opened 2 months ago

lucasw commented 2 months ago

Some transforming is done here https://github.com/lucasw/vimjay/blob/eliminate_build_warnings/src/bin/camera_fov_plane_intersection.rs - the for loop is probably fine (thanks to compile time optimizations) but ideally could make a matrix of all the points in nalgebra and transform them in one step.

Make the transform and PointCloud2 conversion functions available externally.

lucasw commented 2 months ago

This supports rosrust, needs roslibrust

https://docs.rs/ros_pointcloud2/latest/ros_pointcloud2/

https://github.com/stelzo/ros_pointcloud2

lucasw commented 2 months ago

Trying out adding roslibrust support:

ROS_PACKAGE_PATH=`rospack find geometry_msgs`:`rospack find tf2_msgs`:`rospack find sensor_msgs`:`rospack find std_msgs`:`rospack find actionlib_msgs` cargo build --release --features roslibrust_msg

(not sure why extra ros packages are needed but it wasn't building without them)

Now use this here and try to make a subscriber for PointCloud2 https://github.com/lucasw/ros_pointcloud2/tree/roslibrust

lucasw commented 2 months ago

Not including ros_pointcloud2, just trying to receive raw point clouds with roslibrust, it gets a few then does this a few times also:

serde_rosmsg Error: Reached end of memory buffer while reading data
serde_rosmsg Error: Attempted to read beyond the end of decoded value's length

This looks like it could be it, certainly nothing larger than 4096 bytes is getting through: https://github.com/Carter12s/roslibrust/blob/master/roslibrust/src/ros1/subscriber.rs#L120

Was it supposed to read multiple times and build up the whole message? Also haven't I had this working with much larger images- maybe only publishing worked, I didn't try to subscribe?

-> this should be fixed now https://github.com/Carter12s/roslibrust/pull/179

lucasw commented 2 months ago

Just continuing on with small size point clouds, and have a ros_pointcloud2 workaround: https://github.com/stelzo/ros_pointcloud2/pull/24#issuecomment-2259537811

Implement the tf lookup and transform of points next.

lucasw commented 2 months ago

Could make a point_cloud_to_rerun node (or do that in mcap_to_rerun https://github.com/lucasw/ros_one2z/blob/main/mcap_to_rerun/src/main.rs)