question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Reconnection to Rosbridge does not reliably re-advertise topics

See original GitHub issue

This comes from a report from a user of my extension, not sure what version they’re using but it’s fairly recent and on macOS.

My panel has a button that publishes a /bladescript/execute message. The panel is written as a React functional component like so:

function BladescriptPanel(
    { context }: { context: PanelExtensionContext }
): JSX.Element {
...
    // Set up rendering for the panel
    useLayoutEffect(() => {
        ...

        // Advertise that we publish scripts
        context.advertise?.("/bladescript/execute", "std_msgs/String");
    }, [context]);

    ...
}

Occasionally the user gets a complaint from Rosbridge when pressing the button that it was not expecting the publication of the /bladescript/execute message. My theory is that this has to do with when the connection is lost and then the connection gets re-established.

Am I misusing the API here?

image

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
achim-kcommented, Oct 10, 2022

In order for rosbridge clients to publish to ROS topics, the rosbridge server has to internally create a ROS publisher which is used to publish to the actual ROS topic. This is done when a client sends an advertise operation to the rosbridge server. Future messages sent from the rosbridge client (via the publish operation) will be published to the ROS topic using the previously created ROS publisher. Note that only a single ROS publisher is created per topic. E.g. when there are more then one rosbridge clients publishing to the same topic, the same ROS publisher is used on the server side.

After all clients that previously published to this topic disconnected (or called the unadvertise operation), the internal ROS publisher is unregistered after a certain timeout (unregister_timeout). This leads to the warning messages you mentioned above being logged, which is a consequence of https://github.com/ros/ros_comm/issues/111. So in order to mitigate this, your best option is to avoid unregistering of internal ROS publishers which can be done by setting the unregister_timeout to a high enough value.

0reactions
achim-kcommented, Oct 17, 2022

It is not a big problem, but these messages cause unnecessary changes to the ros graph so it would be good if we could avoid them.

In #4653, I parameterized the _setupPublishers method. This avoids the unnecessary websocket messages and also doesn’t require adding a debounce.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Problem of md5sum warning when web is refreshed #138
When web client using roslibjs is refreshed, md5sum warning is occurred. ... Reconnection to Rosbridge does not reliably re-advertise topics ...
Read more >
Rosbridge - isConnected() ? - ROS Answers
Hi, I'm working with Rosbridge at the moment, and trying to determine from the ROS side (server) whether the websocket connection is ok....
Read more >
roslibpy - Read the Docs
Python ROS Bridge library allows to use Python and IronPython to interact with ROS, the open-source robotic middleware.
Read more >
Establishing remote networks for ROS applications via Port ...
PF does not require a bridge or a middle point, instead it creates direct ROS-to-ROS channel as if the connection was local, alibi...
Read more >
ROS web tutorial part 1 - rosbridge server and roslibjs
Rosbridge suite is a set of packages that allows to exchange information between ROS and any other application capable of parsing JSON.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found