Can't send a captured image from raspi4 to other machine.

asked 2020-12-16 02:48:00 -0500

Hi, I tried sending a captured image from raspi4 to other machine, using a uvc-camera.

The way to publish an image is following (used this ros2-node: https://index.ros.org/r/v4l2_camera/):

$ # run on raspberry-pi4
$ ROS_DOMAIN_ID=1
$ ros2 run v4l2_camera v4l2_camera_node

However couldn't send an image.

$ # run on other machine
$ ROS_DOMAIN_ID=1
$ ros2 topic list  # confirm all topics
/camera_info
/image_raw
/image_raw/compressed
/image_raw/compressedDepth
/image_raw/theora
/parameter_events
/rosout
$ ros2 topic echo /image_raw  # nothing happens if execute

-----

Though, could send a text in the same way.

$ ros2 topic pub /chatter std_msgs/String "data: Hello, World!!"  # run on raspberry-pi4

 

$ ros2 topic echo /chatter  # run on other machine
data: Hello, World
---
data: Hello, World
---
...

What do you think is the cause?

edit retag flag offensive close merge delete

Comments

Looks like your ros2 topic echo /image_raw is not returning any message. Could you make sure your sensor_msgs/Image messages are properly being published to the /image_raw topic? It should at least show the intensity values if not images.

srujan gravatar image srujan  ( 2020-12-16 20:22:59 -0500 )edit

Thank you for your answer!

At least I can see /image_raw on the Raspberry Pi side with a command ros2 topic echo or ros2 topic hz.

$ ros2 topic hz /image_raw # raspberry pi side
average rate: 15.105
   min: 0.063s max: 0.068s std dev: 0.00203s window: 17
average rate: 15.072
   min: 0.063s max: 0.068s std dev: 0.00196s window: 33
average rate: 14.763

However, for some reason, a command ros2 topic echo /image_raw cannot be confirmed on the other machine side. A environmental value ROS_DOMAIN_ID is the same as a one on the Raspberry pi side.

$ ros2 topic hz /image_raw  # nothing happens if execute (other machine side)
ksato-dev gravatar image ksato-dev  ( 2020-12-18 10:14:24 -0500 )edit

And I can get information on some topics with ros2 topic list -t, somehow.

$ ros2 topic list -t  # other machine side
/camera_info [sensor_msgs/msg/CameraInfo]
/image_raw [sensor_msgs/msg/Image]
/image_raw/compressed [sensor_msgs/msg/CompressedImage]
/image_raw/compressedDepth [sensor_msgs/msg/CompressedImage]
/image_raw/theora [theora_image_transport/msg/Packet]
/parameter_events [rcl_interfaces/msg/ParameterEvent]
/rosout [rcl_interfaces/msg/Log]

Also, for some reason, after asking a question, I checked a compressed image topic /image_raw/compressed on the other machine side. Moreover I was also able to visualize it.

$ ros2 topic hz /image_raw/compressed  # other machine side
average rate: 6.347
   min: 0.063s max: 0.395s std dev: 0.10380s window: 8
average rate: 4.242

I don't know that cannot received a raw image topic /image_raw. What is this ...


Information: Raspberry Pi and other machine are communicating via WiFi.

ksato-dev gravatar image ksato-dev  ( 2020-12-18 10:15:07 -0500 )edit
1

There are currently some problems when sending very large pieces of information over the network, particularly over WiFi. That's likely the reason you can see the compressed one but not the raw one; the compressed one is small enough that it isn't flooding the network. There is some tuning you can do to help improve this; see https://index.ros.org/doc/ros2/Troubl... . However, my suggestion is to just not try to send very large data over a WiFi network. I'd suggest either hooking up your Raspberry Pi via ethernet, or doing some additional processing on the Pi and sending the results of the processing to your other computer.

clalancette gravatar image clalancette  ( 2020-12-18 13:46:14 -0500 )edit

Oh, an uncompressed image was too big! I got it!

Also, thank you for a nice suggestion.

I see. I will not send a raw image as much as possible, next time.

I didn't know an improvement by DDS tuning, want to try later.

In the end, thank you everyone for answering my poor English.

ksato-dev gravatar image ksato-dev  ( 2020-12-19 06:42:59 -0500 )edit