RobotWebTools / rosbridge_suite

Server Implementations of the rosbridge v2 Protocol
https://robotwebtools.github.io
BSD 3-Clause "New" or "Revised" License
915 stars 518 forks source link

Rosbridge blocks subscriptions to a topic if it subscribes before the subscription is available. #769

Open johncarl81 opened 2 years ago

johncarl81 commented 2 years ago

Description

When I start rosbridge and subscribe to a topic before the topic is available I receive the following error:

[rosbridge_websocket]: New publisher discovered on topic '/mavros/local_position/pose', offering incompatible QoS. No messages will be received from it. Last incompatible policy: RELIABILITY

and subsequent attempts to connect via rosbridge to the given topic don't return anything.

Steps To Reproduce

  1. Startup ros

    ros2 daemon start
  2. Startup rosbridge:

    ros2 launch rosbridge_server rosbridge_websocket_launch.xml &
  3. Subscribe to a stream that hasn't been started yet via ros (in this case a mavros stream): (not sure of the exact syntax here): subscribe to /mavros/global_position/global

  4. Start said stream

  5. Received error:

    [rosbridge_websocket]: New publisher discovered on topic '/mavros/local_position/pose', offering incompatible QoS. No messages will be received from it. Last incompatible policy: RELIABILITY

Expected Behavior

I'd expect the subscription to be either configurable or more graceful in subscribing to this sort of stream.

Actual Behavior

In essence, rosbridge blocks itself from ever subscribing to a stream if rosbridge attempts to subscribe to it before it's available. This block is in place for as long as rosbridge is continuously running.

More Info

Here's topic info for when rosbridge subscribes to the stream first: Note the Reliability: BEST_EFFORT under rosbridge_websocket

ros2 topic info /mavros/global_position/global --verbose
Type: sensor_msgs/msg/NavSatFix

Publisher count: 1

Node name: global_position
Node namespace: /mavros
Topic type: sensor_msgs/msg/NavSatFix
Endpoint type: PUBLISHER
GID: b1.c4.10.01.32.d2.84.30.93.77.00.75.00.01.67.03.00.00.00.00.00.00.00.00
QoS profile:
Reliability: BEST_EFFORT
Durability: VOLATILE
Lifespan: 9223372036854775807 nanoseconds
Deadline: 9223372036854775807 nanoseconds
Liveliness: AUTOMATIC
Liveliness lease duration: 9223372036854775807 nanoseconds

Subscription count: 3

Node name: rosbridge_websocket
Node namespace: /
Topic type: sensor_msgs/msg/NavSatFix
Endpoint type: SUBSCRIPTION
GID: 59.28.10.01.81.5a.c3.9d.d1.8f.86.4a.00.00.18.04.00.00.00.00.00.00.00.00
QoS profile:
Reliability: BEST_EFFORT
Durability: VOLATILE
Lifespan: 9223372036854775807 nanoseconds
Deadline: 9223372036854775807 nanoseconds
Liveliness: AUTOMATIC
Liveliness lease duration: 9223372036854775807 nanoseconds

Node name: setpoint_position
Node namespace: /mavros
Topic type: sensor_msgs/msg/NavSatFix
Endpoint type: SUBSCRIPTION
GID: b1.c4.10.01.32.d2.84.30.93.77.00.75.00.03.4d.04.00.00.00.00.00.00.00.00
QoS profile:
Reliability: BEST_EFFORT
Durability: VOLATILE
Lifespan: 9223372036854775807 nanoseconds
Deadline: 9223372036854775807 nanoseconds
Liveliness: AUTOMATIC
Liveliness lease duration: 9223372036854775807 nanoseconds

Node name: uav_remote_service
Node namespace: /
Topic type: sensor_msgs/msg/NavSatFix
Endpoint type: SUBSCRIPTION
GID: f6.00.10.01.75.04.cb.e9.95.a3.b3.32.00.00.20.04.00.00.00.00.00.00.00.00
QoS profile:
Reliability: BEST_EFFORT
Durability: VOLATILE
Lifespan: 9223372036854775807 nanoseconds
Deadline: 9223372036854775807 nanoseconds
Liveliness: AUTOMATIC
Liveliness lease duration: 9223372036854775807 nanoseconds

And here's a topic info for when rosbridge subscribes to the stream first: Note the Reliability: RELIABLE under rosbridge_websocket

ros2 topic info /mavros/global_position/global --verbose
Type: sensor_msgs/msg/NavSatFix

Publisher count: 1

Node name: global_position
Node namespace: /mavros
Topic type: sensor_msgs/msg/NavSatFix
Endpoint type: PUBLISHER
GID: 99.ff.10.01.de.e2.09.af.e5.5d.35.82.00.01.67.03.00.00.00.00.00.00.00.00
QoS profile:
Reliability: BEST_EFFORT
Durability: VOLATILE
Lifespan: 9223372036854775807 nanoseconds
Deadline: 9223372036854775807 nanoseconds
Liveliness: AUTOMATIC
Liveliness lease duration: 9223372036854775807 nanoseconds

Subscription count: 3

Node name: rosbridge_websocket
Node namespace: /
Topic type: sensor_msgs/msg/NavSatFix
Endpoint type: SUBSCRIPTION
GID: 59.28.10.01.81.5a.c3.9d.d1.8f.86.4a.00.00.1c.04.00.00.00.00.00.00.00.00
QoS profile:
Reliability: RELIABLE
Durability: VOLATILE
Lifespan: 9223372036854775807 nanoseconds
Deadline: 9223372036854775807 nanoseconds
Liveliness: AUTOMATIC
Liveliness lease duration: 9223372036854775807 nanoseconds

Node name: NODE_NAME_UNKNOWN
Node namespace: NODE_NAMESPACE_UNKNOWN
Topic type: sensor_msgs/msg/NavSatFix
Endpoint type: SUBSCRIPTION
GID: 99.ff.10.01.de.e2.09.af.e5.5d.35.82.00.03.4d.04.00.00.00.00.00.00.00.00
QoS profile:
Reliability: BEST_EFFORT
Durability: VOLATILE
Lifespan: 9223372036854775807 nanoseconds
Deadline: 9223372036854775807 nanoseconds
Liveliness: AUTOMATIC
Liveliness lease duration: 9223372036854775807 nanoseconds

Node name: uav_remote_service
Node namespace: /
Topic type: sensor_msgs/msg/NavSatFix
Endpoint type: SUBSCRIPTION
GID: a5.ad.10.01.36.be.63.db.48.df.c5.8d.00.00.20.04.00.00.00.00.00.00.00.00
QoS profile:
Reliability: BEST_EFFORT
Durability: VOLATILE
Lifespan: 9223372036854775807 nanoseconds
Deadline: 9223372036854775807 nanoseconds
Liveliness: AUTOMATIC
Liveliness lease duration: 9223372036854775807 nanoseconds
johncarl81 commented 2 years ago

I believe the source of this is this PR: https://github.com/RobotWebTools/rosbridge_suite/pull/690 Specifically this line: https://github.com/RobotWebTools/rosbridge_suite/blob/b4b996b77d0b63548a2cd4a435604472c7d8932c/rosbridge_library/src/rosbridge_library/internal/subscribers.py#L114 Where we assume the default reliability policy is RELIABLE

github-actions[bot] commented 1 year ago

This issue has been marked as stale because there has been no activity in the past 12 months. Please add a comment to keep it open.

johncarl81 commented 1 year ago

Bump

johncarl81 commented 1 year ago

Bump?

wvergouwenavular commented 1 year ago

@johncarl81 I am facing the same issue, any clues as to how to solve this?

johncarl81 commented 1 year ago

Hi @wvergouwenavular, have you tried out the linked PR which changes the reliability policy to BEST_EFFORT? I have not, but I'm curious if this solves the problem.

wvergouwenavular commented 11 months ago

Hi @johncarl81 I have not yet tried it, since it requires building rosbridge from source...