hello-robot / stretch_web_teleop

Remote web teleoperation for the Stretch mobile manipulators from Hello Robot Inc.
Other
13 stars 0 forks source link

Add auto-reconnect to ROS for the robot browser #76

Closed hello-amal closed 1 month ago

hello-amal commented 1 month ago

Description

This PR depends on our fork of roslibjs#1. Although, for backwards compatibility, I have ported that code locally as well.

This PR addresses the following related bugs:

  1. If the robot browser launches before rosbridge is running, it will never join the robot room, which means the operator will never be allowed to join the operator room.
  2. If the robot browser launches too quickly after rosbridge, sometimes it invokes the /get_joint_states service before the service is actually ready, which results in it hanging. After that point, no other service invokation or topic publication from the web app will be received by rosbridge, and the only way to resolve it is to run pm2 restart start_robot_browser

This PR addresses them, respectively, by:

  1. Adding an auto-reconnect every 1 second if the ROS connection gets closed or encounters an error.
  2. This was resolved with two changes:
    1. Having rosbridge launch services in a separate thread, so that even if one service invocation hangs, it doesn't harm other rosbridge communications.
    2. Waiting until several key topics have at least one publisher, before the robot browser proceeds.

Testing procedure

Before opening a pull request

From the top-level of this repository, run:

To merge