ros-perception / perception_pcl

PCL (Point Cloud Library) ROS interface stack
http://wiki.ros.org/perception_pcl
421 stars 332 forks source link

porting pointcoud_to_pcd to ros2 #444

Closed Ar-Ray-code closed 5 months ago

Ar-Ray-code commented 6 months ago

I needed the ROS 2 version of pointcoud_to_pcd, so I will port it and submit a PR. Please review.

Depends

Usage

ros2 run pcl_ros pointcloud_to_pcd --ros-args -r input:=/cloud_in -p prefix:=abc_ -p fixed_frame:=base_link

How to check exported pcd file

pcl_viewer <path to .pcd file>

image

Thank you.

SteveMacenski commented 6 months ago

Were there tests associated with this as well?

Otherwise, give this a week and if no other maintainers chime in, ping me again and I'll merge it

Ar-Ray-code commented 5 months ago

builds for humble (not for foxy) features tested

  • prefix
  • compresed
  • binary
  • prefix
  • fixed_frame

ros2 run pcl_ros pointcloud_to_pcd --ros-args -r input:=os_node/points -p prefix:=abc_ -p binary:=true -p compressed:=true -p fixed_frame:=base_link

Everything works except fixed_frame feature because my (ouster) lidar frame is on tf_static i get the following error.

[WARN] [1712221819.952296406] [transform_listener_impl_556e0f932ee0]: New publisher discovered on topic '/tf_static', offering incompatible QoS. No messages will be sent to it. Last incompatible policy: DURABILITY_QOS_POLICY
[ERROR] [1712221820.239036841] [pointcloud_to_pcd]: Transform error: "os_sensor" passed to lookupTransform argument source_frame does not exist. 

Thank you for your testing.

fixed_frame is an option that can be used when the sensor is connected to another tf. For example, the following command broadcasts a relative position with x=2, yaw=90deg.

ros2 run tf2_ros static_transform_publisher 2 0 0 0 0 0.707 0.707 base_link velodyne

I would consider implementing the following: if tf cannot be obtained, a warning is displayed and the fixed_frame option is ignored. <- done

Ar-Ray-code commented 5 months ago

I also added the rgb option because when I tested with velodyne we could not save in RGB. (Default is false)

SteveMacenski commented 5 months ago

@remco-r let me know if that resolves your concern

remco-r commented 5 months ago

@SteveMacenski