personalrobotics / ada_feeding

Robot-assisted feeding demos and projects for the ADA robot
4 stars 4 forks source link

Write a `nano_bridge` #193

Closed amalnanavati closed 2 months ago

amalnanavati commented 2 months ago

Description

In continued service of #73 .

We have been aware of an issue where if there are too many subscribers to the compressed RGB and depth images on nano, then nano stops publishing on or more of the compressed image topics. With out earlier networking setup, this got triggered if there was more than one subscriber on lovelace for each of the RGB and depth image topics. With our new networked setup, it gets triggered even if there is just one subscriber on lovelace for each of the RGB and depth image topics. This is a problem because the minimal set of subscribers lovelace needs is one to the compressed depth image and one to the compressed RGB image.

This PR addresses that by adding a nano_bridge that essentially combines the RGB and depth topics into a single topic on the nano side, and then separates them into two topics again on the lovelace side. This means that we only have one large subscription going over WiFi -- the combined RGB + depth subscription -- which should alleviate the aforementioned issue.

Potential Future Improvements

  1. To further remove the camera_info subscription from WiFi, we could add a dummy camera info node to the nano_bridge packet, potentially drawing from this dummy RealSense node.
  2. If even this doesn't work and we have to fully get rid of ROS over WiFi, the sender should essentially open a UDP socket that it streams the data over, and the receiver should receive that and convert it back into ROS topics. That way, we'd have ROS running locally on both lovelace and nano, but not connecting them.

Testing procedure

Explanation of the above rates

On nano, /nano_bridge/data publishes at a rate of ~24 hz, which is perfect given that each image topic publishes at a rate of ~12 hz. However, on lovelace, /nano_bridge/data is received at a rate of ~14 hz, which must be due to router bandwidth. As a result, each of the images is received at a rate of ~7 hz.

Although unfortunate, that rate can be worked with. Whereas earlier, one of the topics would have 14 hz and the other would have 0, now both have 7, which is a much better outcome.

Before opening a pull request

Before Merging