Skip to content
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

bandwidth is the same #10

Closed
AreteQin opened this issue Jan 10, 2024 · 6 comments
Closed

bandwidth is the same #10

AreteQin opened this issue Jan 10, 2024 · 6 comments

Comments

@AreteQin
Copy link

Hi

Thank you so much for your tutorial.

I used the following commands to run the publisher and subscriber:

ros2 run image_transport_tutorials publisher_from_video 0
ros2 run image_transport_tutorials my_subscriber
ros2 run image_transport_tutorials my_subscriber --ros-args --remap __name:=compressed_listener -p _image_transport:=compressed

I can successfully get the video. However, there is no difference in bandwidth. The bandwidth is always around 25 MB/s.

Is there anything else I should do to get the compressed video? Or there is anything wrong I did/

Thanks in advance for any help!

@ahcorde
Copy link
Contributor

ahcorde commented Jan 26, 2024

The command that you are using looks wrong

you need to remap the topic name not the name of the node.

ros2 run image_transport_tutorials my_subscriber --ros-args -p image_transport:=compressed -r /image/compressed:=/camera/image/compressed

or try image_view

ros2 run image_view image_view --ros-args -p image_transport:=compressed -r /image/compressed:=/camera/image/compressed

@AreteQin
Copy link
Author

Hi
Thanks for your reply.
I tried your command. But the bandwidth is still the same.
Screenshot from 2024-01-27 12-27-43

As you can see the first and second periods are the same.

@mikeferguson
Copy link
Member

The tutorial doesn't actually support the "image_transport" parameter - since we never define a TransportHints - see #13 for a change that actually does this.

The easiest way to confirm the transport is correct is to do a "node info" and see what topic is subscribed - with the changes in my PR, you get the compressed topic, instead of the regular "camera/image" topic (which is uncompressed):

ros2 node info /compressed_listener
/compressed_listener
  Subscribers:
    /camera/image/compressed: sensor_msgs/msg/CompressedImage
    /parameter_events: rcl_interfaces/msg/ParameterEvent
  Publishers:
    /parameter_events: rcl_interfaces/msg/ParameterEvent
    /rosout: rcl_interfaces/msg/Log
  Service Servers:
    /compressed_listener/describe_parameters: rcl_interfaces/srv/DescribeParameters
    /compressed_listener/get_parameter_types: rcl_interfaces/srv/GetParameterTypes
    /compressed_listener/get_parameters: rcl_interfaces/srv/GetParameters
    /compressed_listener/get_type_description: type_description_interfaces/srv/GetTypeDescription
    /compressed_listener/list_parameters: rcl_interfaces/srv/ListParameters
    /compressed_listener/set_parameters: rcl_interfaces/srv/SetParameters
    /compressed_listener/set_parameters_atomically: rcl_interfaces/srv/SetParametersAtomically
  Service Clients:

  Action Servers:

  Action Clients:

You can also confirm bandwidth difference using the "topic bw" command, so the topics themselves are correct, the issue is that without TransportHints, we aren't subscribing to the correct topic:

fergs@ubuntu22:~/rolling$ ros2 topic bw /camera/image
Subscribed to [/camera/image]
2.71 MB/s from 5 messages
	Message size mean: 0.51 MB min: 0.51 MB max: 0.51 MB

fergs@ubuntu22:~/rolling$ ros2 topic bw /camera/image/compressed
Subscribed to [/camera/image/compressed]
566.70 KB/s from 5 messages
	Message size mean: 110.13 KB min: 110.13 KB max: 110.13 KB

@AreteQin
Copy link
Author

AreteQin commented Feb 3, 2024

Hi

Thanks for your explaination. Do you mean that I do not need to set image_transport parameter?

I tried "topic bw" and I got the following:

ros2 topic bw /camera/image/compressed
2024-02-02 18:54:51.167 [SUBSCRIBER Error] Deserialization of data failed -> Function deserialize_change
Subscribed to [/camera/image/compressed]
1.00 MB/s from 5 messages
	Message size mean: 0.18 MB min: 0.17 MB max: 0.18 MB
943.19 KB/s from 10 messages
	Message size mean: 177.54 KB min: 174.36 KB max: 179.00 KB
926.65 KB/s from 15 messages
	Message size mean: 178.06 KB min: 174.36 KB max: 179.48 KB
916.28 KB/s from 20 messages
	Message size mean: 177.87 KB min: 172.72 KB max: 179.48 KB

ros2 topic bw /camera/image
2024-02-02 18:54:37.104 [SUBSCRIBER Error] Deserialization of data failed -> Function deserialize_change
Subscribed to [/camera/image]
26.48 MB/s from 4 messages
	Message size mean: 2.76 MB min: 2.76 MB max: 2.76 MB
11.70 MB/s from 6 messages
	Message size mean: 2.76 MB min: 2.76 MB max: 2.76 MB
11.44 MB/s from 10 messages
	Message size mean: 2.76 MB min: 2.76 MB max: 2.76 MB
9.71 MB/s from 12 messages
	Message size mean: 2.76 MB min: 2.76 MB max: 2.76 MB
9.39 MB/s from 15 messages
	Message size mean: 2.76 MB min: 2.76 MB max: 2.76 MB

I believe that it means my publisher is working well. I also checked using "ros2 run rqt_image_view rqt_image_view", and I can successfully get original and compressed images.

Then I tried the following comand to subscribe the video:

ros2 run image_transport_tutorials my_subscriber

And I can get the original images.

But if I use this command

ros2 run image_transport_tutorials my_subscriber --ros-args -r /camera/image:=/camera/image/compressed

I cannot receive any image.

@mikeferguson
Copy link
Member

Remapping /camera/image to the compressed topic isn't going to work (the encoding is different) - the image_transport parameter is the right thing to do - but we need to merge #13 and then things will work (as the code exists right now, it doesn't actually support compressed transport to be selected).

@AreteQin
Copy link
Author

AreteQin commented Feb 3, 2024

Thank you!

@AreteQin AreteQin closed this as completed Feb 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants