How to properly set up a remote roscore with multiple remote nodes?
I am very new to ros. My friend and I have a scenario where only one of us has the hardware, but we'd both like to try to get live stream data without having to replay the data. Ideally we want to use ros2, but since the networking TSG on that is not out with no ETA, we are sticking with ros1 for the time being (might do some ros2->ros1 translation in the long run) So we are trying to get a remote roscore running and connect our nodes to this. So far, I have been able to get this semi-working, but am noticing some odd behavior:
We have a remote server running our roscore. Let's pretend it's public IP is 1.2.3.4 with a local ip of 10.0.0.1 the ROS settings on the server are as follows:
ROS_MASTER_URI=http://10.0.0.1:12345
ROS_IP=10.0.0.1
Remote node setup:
ROS_MASTER_URI=http://1.2.3.4:12345
ROS_IP=0.0.0.0
With this setup I am able to run turtlesim and control it on my local computer, with roscore running on the server with an interesting side effect: They only work if the publisher is created before the subscriber (in this case, turtle_teleop_key needs to be running before turtlesim_node). Does anyone have a reason for this side effect?
Secondly: When I introduce another local computer, I am able to get the sim running the same as above (publisher must register before subscriber) purely on the local computer, however the two local computers can never talk to each other no matter which way I connect the nodes (which is our required scenario).
None of this behavior makes sense to me unless roscore is not handling all the communication and is instead communicating to nodes to open connections with other nodes. If roscore handles the communication itself - it doesn't make sense to me that I'd be able to get the connection working at all even with both publisher and subscriber on one local computer (with roscore as remote). tcpdump sort of confirms this because when I am running the two nodes on one local computer I do not seem to be seeing packets from remote server at the rate I'd expect (seems to be more of a ping or something).
If roscore is communicating to the nodes to open connections with each other, it might make more sense that there's some port forwarding issues or something like that.
Anyways, I have seen a ton of posts on this, but the way I got to a semi-working example was by combining multiple answers from multiple posts - so it'd be nice to get a full answer
I have seen that some people say they need to edit /etc/hosts -> Is this actually required? I have seen several posts say that ROS_IP should be your local IP (like 192.168.0.2 or something), others said it ...