Connecting to ROS from outside host


#1

Dear devs/community,

We’re trying to establish a connection between the ROS core inside of the NRP container and another machine on the same network as the NRP host. The concrete setup is that we have two machines: an NRP host machine running the NRP docker containers and a separate machine that’s running a ROS node. The second machine will have to interact with ROS (ROS core) in the NRP host machine.
When we run the NRP script out-of-the-box, it’ll create a local network ‘nrpnet’. Meaning, that the ROS ports will be inaccessible from outside that network. So far we’ve modified the NRP script to simply run the NRP containers on the host network (–net=host), and it works. But we’re not sure whether that’s a sustainable solution.
Specific port mapping is also not an option, because ROS uses dynamic port allocation.

Specifically we have two questions:

  1. Are there better ways to establish the connection between the NRP host and the ROS node than setting --net=host?
  2. If not, could this somehow be integrated into the NRP script? Possibly with a flag or similar?

Thanks a lot for your help,
Jens

PS. This is close to the question asked by Jacques (Connect docker container with ROS on host). Only, we’re trying to connect to ROS from another machine.


#2

Dear Jens,

Yes, your issue is probably common. The reason for the bridge network was to keep indeed all ports private and not mess up with ports on the host. Now, if net=host works for you, why not add it as an option indeed for those who need all ports to be visible on the host.

You would do us a great favour if you could provide the change in a link to your modified script. Else, please post a feature request at https://neurorobotics.net/submitbug.html, but this will take more time.

Best regards
Axel


#3

Hi Axel,
Thanks for your reply. I’ll be happy to add a suggestion on how to solve this, but would it not be simpler to do this in a docker-compose script?
In there, we can define subnetworks, execute required commands, reset/remove images etc. Adding features to the nrp_installer.sh script will take me a significant amount of time to avoid regressions.
I’ll be happy to provide a rudimentary docker-compose script to begin with.
Cheers,
Jens