ros-perception / point_cloud_transport

Point Cloud Compression for ROS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Parameters set via the command line are set, but ignored by the republisher

Kapim opened this issue · comments

I run the republisher like this:

ros2 run point_cloud_transport republish --in_transport raw --out_transport draco --ros-args --remap in:=/point_cloud -p out.draco.force_quantization:=true

If I get the value of the parameter out.draco.force_quantization (using ros2 param get), it says it's True, but the bandwidth of the output is around 4.5MB/s. After I manually set the parameter to true (with ros2 param set), the bandwidth drops to approx 900KB/s, which is an expected value.

Which ROS version are you using ? I think this is fixed on Rolling, not sure about Iron and humble

Anyhow I made this PR #68 updating documentation for Rolling

Sorry, I forgot to mention I am using the Humble.

I think the issue here is that you pass -p after --remap so your -p is ignored. You want to do this after --ros-args. Please try this in humble

ros2 run point_cloud_transport republish --in_transport raw --out_transport draco --ros-args -r in:=/point_cloud -p out.draco.force_quantization:=true

Here I use -r to remap rather than --remap which it's valid syntax.

You could also do this which is equivalent

ros2 run point_cloud_transport republish --in_transport raw --out_transport draco --ros-args -p out.draco.force_quantization:=true --remap in:=/point_cloud

Btw the --in_transport and --out_transport syntax is going away soon in place of the correct --ros-args -p syntax. So keep an eye out for the next release please 🙂
after the next release (or if you are building from source), the command will become (and this will be reflected in the README)

ros2 run point_cloud_transport republish --ros-args -p in_transport:=raw -p out_transport:=draco -p out.draco.force_quantization:=true -r in:=/point_cloud

I'm having the same problem in another robot with humble. @john-maidbot solution doesn't work for me.
I need do param set to force the quantization:

Any idea why is this happening and how to solve it?

Terminal 1:

ros2 run point_cloud_transport republish \
--in_transport raw --out_transport draco \
--ros-args \
-r in:=/robot/top_laser/point_cloud \
-p out.draco.force_quantization:=true

Terminal 2:

ros2 topic bw /robot/top_laser/point_cloud 
Subscribed to [/robot/top_laser/point_cloud]
4.76 MB/s from 10 messages
	Message size mean: 0.46 MB min: 0.46 MB max: 0.46 MB
4.68 MB/s from 20 messages
	Message size mean: 0.46 MB min: 0.46 MB max: 0.46 MB
4.66 MB/s from 30 messages
	Message size mean: 0.46 MB min: 0.46 MB max: 0.46 MB
ros2 topic bw /out/draco 
Subscribed to [/out/draco]
3.94 MB/s from 10 messages
	Message size mean: 0.38 MB min: 0.38 MB max: 0.38 MB
3.85 MB/s from 20 messages
	Message size mean: 0.38 MB min: 0.38 MB max: 0.38 MB
3.82 MB/s from 30 messages
	Message size mean: 0.38 MB min: 0.38 MB max: 0.38 MB
ros2 param dump /point_cloud_republisher 
/point_cloud_republisher:
  ros__parameters:
    in_transport: raw
    out:
      draco:
        attribute_mapping:
          attribute_type:
            x: POSITION
            y: POSITION
            z: POSITION
          quantization_bits:
            rgb: 16
            x: 16
            y: 16
            z: 16
          rgba_tweak:
            rgb: true
            rgba: false
        decode_speed: 7
        deduplicate: true
        encode_method: 0
        encode_speed: 7
        expert_attribute_types: false
        expert_quantization: false
        force_quantization: true
        quantization_COLOR: 14
        quantization_GENERIC: 14
        quantization_NORMAL: 14
        quantization_POSITION: 14
        quantization_TEX_COORD: 14
    out_transport: draco
    qos_overrides:
      /parameter_events:
        publisher:
          depth: 1000
          durability: volatile
          history: keep_last
          reliability: reliable
    use_sim_time: false
ros2 param set /point_cloud_republisher out.draco.force_quantization true
ros2 topic bw /out/draco 
Subscribed to [/out/draco]
800.61 KB/s from 9 messages
	Message size mean: 87.41 KB min: 87.11 KB max: 87.59 KB
787.47 KB/s from 18 messages
	Message size mean: 86.74 KB min: 75.26 KB max: 87.68 KB
758.15 KB/s from 26 messages
	Message size mean: 86.97 KB min: 75.26 KB max: 87.76 KB

I think the issue here is that you pass -p after --remap so your -p is ignored. You want to do this after --ros-args. Please try this in humble

ros2 run point_cloud_transport republish --in_transport raw --out_transport draco --ros-args -r in:=/point_cloud -p out.draco.force_quantization:=true

Here I use -r to remap rather than --remap which it's valid syntax.

You could also do this which is equivalent

ros2 run point_cloud_transport republish --in_transport raw --out_transport draco --ros-args -p out.draco.force_quantization:=true --remap in:=/point_cloud

Hello, I apologize for the delayed reply and for the confusion. My original comment was w.r.t. the cli syntax issue, but after taking a closer look, I think there is a bug.

A few things:

  1. This command
ros2 run point_cloud_transport republish --in_transport raw --out_transport draco --ros-args -p out.draco.force_quantization:=true --remap in:=/point_cloud

is deprecated. so if you are using the latest release or building from source for humble, please be sure to use the new command.

ros2 run point_cloud_transport republish --ros-args -p in_transport:=raw -p out_transport:=draco -p out.draco.force_quantization:=true -r in:=/point_cloud

But even then it will not work yet because of 2 👇

  1. In both cases, out.draco.force_quantization is getting set to true as far as the ros2 node parameter settings are concerned (i.e. if you check using the ros2 param cli, it will show up correctly) BUT the bug lies in the fact that the draco plugin's parameters are not getting read in at startup 😅 So no matter what you set the parameters to at startup, the draco plugin is not loading them at startup. It only recognizes parameter changes that happen AFTER startup via the parameter callback.

i.e. if you look here, you can see we only declare the parameters but only retrieve their values upon a parameter update callback: https://github.com/ros-perception/point_cloud_transport_plugins/blob/da4d119acec859e18ea13ae8f694cd11fdaba633/draco_point_cloud_transport/src/draco_publisher.cpp#L76

Once we fix this bug (should be sometime this week 🤞 ), the command I provided should work. At the moment though, I am afraid that you will have to set the parameters AFTER starting the node. Sorry for the inconvenience.

@ggari-robotnik the latest release should address this bug

@john-maidbot Thanks for the update. This update will be included on humble?

Hi @ggari-robotnik, yes it will be available on Humble in the next release.