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

Some message types fail to be forwarded by rosbridge_server to subscribed clients #699

Closed
noirb opened this issue Dec 30, 2021 · 6 comments
Labels

Comments

@noirb
Copy link

noirb commented Dec 30, 2021

Description
Some message types appear to be silently dropped by rosbridge_server (using websocket_launch). In particular, shape_msgs/msg/MeshTriangle (but there may be other similar messages which cause the same issue).

When a MeshTriangle message is published, it can be received by local nodes, but rosbridge client subscribers never receive the message. Additionally, if a message containing a list of MeshTriangle is published, this message may be received by rosbridge clients if the list is empty, but as soon as the list contains data for at least one MeshTriangle the whole message appears to be lost or discarded. (i.e. a shape_msgs/msg/Mesh message can be successfully received by a client if the triangles field is empty, but not if the field contains at least one entry)

  • Library Version: 1.1.1
  • ROS Version: ROS2 Galactic
  • Platform / OS: Ubuntu 20.04.3

For reference, the message definition of MeshTriangle is:

# Definition of a triangle's vertices.

uint32[3] vertex_indices

Steps To Reproduce: MeshTriangle not received by client

# launch rosbridge
ros2 launch rosbridge_server rosbridge_websocket_launch.xml

# publish a MeshTriangle
ros2 topic pub /test/triangle shape_msgs/msg/MeshTriangle "vertex_indices: [1, 2, 3]"

# echo the topic to verify the publisher is sending data
ros2 topic echo /test/triangle

Using the roslibjs simple example page (or any other working rosbridge client), add a subscriber to the triangle topic, load the page and open a browser console:

  var triangle_topic = new ROSLIB.Topic({
	ros: ros,
	name: '/test/triangle',
	messageType: 'shape_msgs/msg/MeshTriangle'
  });
  triangle_topic.subscribe(function(message) {
    console.log('New Triangle: ', message);
  });

Expected Behavior
MeshTriangle messages are received on the Javascript side.

Actual Behavior
No messages are received on the Javascript side. Additionally, no errors appear to be logged by rosbridge_server.

image

Steps To Reproduce: Mesh not received by client only if a MeshTriangle is present

# launch rosbridge
ros2 launch rosbridge_server rosbridge_websocket_launch.xml

# publish a Mesh containing only one vertex and no triangles
ros2 topic pub /test/mesh shape_msgs/msg/Mesh "{triangles: [], vertices: [{x: 1, y: 2, z: 3}]}"

# echo the topic to verify the publisher is sending data
ros2 topic echo /test/mesh

Using the roslibjs simple example page (or any other working rosbridge client), add a subscriber to the mesh topic, load the page and open a browser console:

  var mesh_topic = new ROSLIB.Topic({
	ros: ros,
	name: '/test/mesh',
	messageType: 'shape_msgs/msg/Mesh'
  });
  mesh_topic.subscribe(function(message) {
    console.log('New Mesh: ', message);
  });

Verify the message is received on the javascript side: New Mesh: Object { triangles: [], vertices: (1) […] }

Now, change the publisher to include one MeshTriangle in the Mesh.triangles field:

ros2 topic pub /test/mesh shape_msgs/msg/Mesh "{triangles: [vertex_indices: [1, 2, 3]], vertices: [{x: 1, y: 2, z: 3}]}"

Expected Behavior
Mesh messages are received in both cases.

Actual Behavior
Mesh messages are only received if they contain no MeshTriangle data (but additional vertex data is fine).

image

@noirb noirb added the bug label Dec 30, 2021
@jtbandes jtbandes added the ros2 ros2 label Jan 3, 2022
@jtbandes
Copy link
Member

jtbandes commented Jan 3, 2022

Thanks for the report.

@kenji-miyake do you think this issue would be related to / fixed by #692?

@kenji-miyake
Copy link
Contributor

kenji-miyake commented Jan 6, 2022

@jtbandes I'm sorry for my late reply. Actually, it seems a bit different because it uses uint32, not uint8? 🤔
I think I can take a look a bit more in detail this weekend.

@GertVen
Copy link

GertVen commented Jan 7, 2022

I'm getting the same problem with regards to images. I can stream almost anything through the web bridge (test, strings, pointclouds), but the content of image topics seems to be lost somewhere. The data does seem to be echoed correctly using "ros2 topic echo". The subscription to the webbridge is successful, and it even appears to be sending data, I regularly get the message "Sending two parts, [fragment size:" message, but no data is received at the other side of the bridge.

Setup:
-> OS: Ubuntu 20.04 (Using Docker)
-> ROS: ROS2 Foxy
-> ROS Web Bridge: cloned from ROS2 branch

EDIT:
-> The same seems to be happening in ROS2 Galactic

@GertVen
Copy link

GertVen commented Jan 10, 2022

I managed to solve my problem. It turns out ROSBridge was passing the data through, but fragmented. As such ROSLib picked up the data type was "fragment" instead of anything useful, and as such discarded the message. I fixed my problem by changing the fragment size in the launch file from 10000000 to 99999999. That solved my problem.

Noirb's issue still stands

@kenji-miyake
Copy link
Contributor

Regarding MeshTriangle, I believe fixed in #692.

@noirb
Copy link
Author

noirb commented Jan 31, 2022

@kenji-miyake : Sorry it took me a while to try your fix, but I'm happy to say it looks like it solved my issue :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants