fkie / multimaster_fkie

ROS stack with FKIE packages for multi-robot (discovering, synchronizing and management GUI)
BSD 3-Clause "New" or "Revised" License
267 stars 107 forks source link

Only one of the masters detects the other #194

Closed mericgeren closed 1 year ago

mericgeren commented 1 year ago

Hello,

I have 2 computers in the same local network which i am trying to connect them via fkie multimaster:

Laptop


export ROS_MASTER_URI=http://192.168.88.ab:11311

export ROS_IP=192.XXX.XXX.ab
127.0.0.1              localhost

127.0.0.1              laptop-linux

192.XXX.XXX.ab         laptop-linux

192.XXX.XXX.dc         pc-linux

PC


export ROS_MASTER_URI=http://192.XXX.XXX.dc:11311

export ROS_IP=192.XXX.XXX.dc
127.0.0.1              localhost

127.0.0.1              pc-linux

192.XXX.XXX.ab         laptop-linux

192.XXX.XXX.ae         laptop-windows    

192.XXX.XXX.dc         pc-linux

I can ping from both computer to each other. When, i ping i get such an output in laptop-linux:

PING 192.XXX.XXX.dc (192.XXX.XXX.dc) 56(84) bytes of data.
From 192.XXX.XXX.ae icmp_seq=1 Redirect Network(New nexthop: dc.XXX.XXX.192)
64 bytes from 192.XXX.XXX.dc: icmp_seq=1 ttl=64 time=1.35 ms
64 bytes from 192.XXX.XXX.dc: icmp_seq=1 ttl=63 time=1.35 ms (DUP!)
64 bytes from 192.XXX.XXX.dc: icmp_seq=1 ttl=64 time=1.48 ms (DUP!)
64 bytes from 192.XXX.XXX.dc: icmp_seq=1 ttl=63 time=1.48 ms (DUP!)

--- 192.XXX.XXX.dc ping statistics ---

1 packets transmitted, 1 received, +3 duplicates, +1 errors, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 1.352/1.418/1.484/0.066 ms

this is the output at the pc-linux:

PING 192.XXX.XXX.ab (192.XXX.XXX.ab) 56(84) bytes of data.
From 192.XXX.XXX.ae icmp_seq=1 Redirect Network(New nexthop: 192.XXX.XXX.ab)
64 bytes from 192.XXX.XXX.ab: icmp_seq=1 ttl=63 time=1.75 ms
64 bytes from 192.XXX.XXX.ab: icmp_seq=1 ttl=64 time=1.78 ms (DUP!)
64 bytes from 192.XXX.XXX.ab: icmp_seq=1 ttl=63 time=2.07 ms (DUP!)
64 bytes from 192.XXX.XXX.ab: icmp_seq=1 ttl=64 time=2.10 ms (DUP!)

--- 192.XXX.XXX.ab ping statistics ---

1 packets transmitted, 1 received, +3 duplicates, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 1.753/1.928/2.103/0.167 ms

Then i do a roslaunch on a custom launch file on both computers. This is the custom launch in laptop-linux:

<launch>

        <node name="master_discovery" pkg="fkie_master_discovery" type="master_discovery">

                <rosparam param="robot_hosts">[192.XXX.XXX.dc]</rosparam>      
                <rosparam param="listen_mcast">false</rosparam>
                <rosparam param="send_mcast">false</rosparam>

        </node>

        <node name="master_sync" pkg="fkie_master_sync" type="master_sync">

        </node>

</launch>

This is the launch file in the pc-linux:

<launch>

        <node name="master_discovery" pkg="fkie_master_discovery" type="master_discovery">

                <rosparam param="robot_hosts">[192.XXX.XXX.ae]</rosparam>      
                <rosparam param="listen_mcast">false</rosparam>
                <rosparam param="send_mcast">false</rosparam>

        </node>

        <node name="master_sync" pkg="fkie_master_sync" type="master_sync">

        </node>

</launch>

Then, when i enter rosservice call /master_discovery/list at pc-linux i see the following output:

masters:

-

    name: "192.XXX.XXX.dc"
    uri: "http://192.XXX.XXX.dc:11311/"
    last_change:
       secs: 1685523372
       nsecs: 169858455
    last_change_local:
       secs: 1685523372
       nsecs: 169858455
    online: True
    discoverer_name: "/master_discovery"
    monitoruri: "http://localhost:11611"

-

    name: "192.XXX.XXX.ab"
    uri: "http://192.XXX.XXX.ab:11311"
    last change:
       secs: 1685523389
       nsecs: 283982753
    last_change_local:
       secs: 1685523389
       nsecs: 283982753
    online: True
    discoverer_name: "/master_discovery"
    monitoruri: "http://192.XXX.XXX.ab:11611"

As you can see from the output the master_discovery node on pc-linux can detect the master in laptop-linux. But, when i enter the same command in the laptop-linux, i get the following output:

masters: 
  - 
    name: "192.XXX.XXX.ab"
    uri: "http://192.XXX.XXX.ab:11311/"
    last_change: 
      secs: 1685523389
      nsecs: 283982753
    last_change_local: 
      secs: 1685523389
      nsecs: 283982753
    online: True
    discoverer_name: "/master_discovery"
    monitoruri: "http://localhost:11611"

Can you help me on this issue please?

Thanks in advance.

atiderko commented 1 year ago

If I understand the configuration correctly, the launch in the pc-linux should contain the IP address of laptop-linux: <rosparam param="robot_hosts">[192.XXX.XXX.ab]</rosparam>

mericgeren commented 1 year ago

I just tried that. But, when i try the setting with 192.XXX.XXX.ab, both pc-linux and laptop-linux couldn't see each other.

atiderko commented 1 year ago

That is strange! Are you sure, you changed 192.XXX.XXX.ae to 192.XXX.XXX.ab on pc-linux?

Can you post the log output of both master_discovery

mericgeren commented 1 year ago

This is the output of launch on laptop-linux:

started roslaunch server http://192.XXX.XXX.ab:33415/

SUMMARY
========

PARAMETERS
 * /master_discovery/listen_mcast: False
 * /master_discovery/robot_hosts: ['192.XXX.XXX.dc']
 * /master_discovery/send_mcast: False
 * /rosdistro: noetic
 * /rosversion: 1.16.0

NODES
  /
    master_discovery (fkie_master_discovery/master_discovery)
    master_sync (fkie_master_sync/master_sync)

ROS_MASTER_URI=http://192.XXX.XXX.ab:11311

process[master_discovery-1]: started with pid [2627]
process[master_sync-2]: started with pid [2628]
[WARN] [1685527211.398182]: Send multicast is disabled.
[WARN] [1685527211.399327]: Listen to multicast is disabled.
[WARN] [1685527211.466337]: Multicast disabled! This master is only by unicast reachable!

This is the output of the launch on pc-linux:

started roslaunch server http://192.XXX.XXX.dc:41693/

SUMMARY
========

PARAMETERS
 * /master_discovery/listen_mcast: False
 * /master_discovery/robot_hosts: ['192.XXX.XXX.ab']
 * /master_discovery/send_mcast: False
 * /rosdistro: melodic
 * /rosversion: 1.14.13

NODES
  /
    master_discovery (fkie_master_discovery/master_discovery)
    master_sync (fkie_master_sync/master_sync)

ROS_MASTER_URI=http://192.XXX.XXX.dc:11311

process[master_discovery-1]: started with pid [3347]
process[master_sync-2]: started with pid [3348]
[WARN] [1685523371. 007897]: Send multicast is disabled
[WARN] [1685523371. 009964]: Listen to multicast is disabled
[WARN] [1685523371. 021482]: master_discovery node appear not to running @192.168.88.37, only found on []. Wait for topic with type 'MasterState' @192.168.88.37.
[WARN] [1685523371. 038358]: Multicast disabled! This master is only unicast reachable!
atiderko commented 1 year ago

The launch server prevents the output of the master_discovery. Can you launch the the master_discovery manually and look if you see something wrong, like wrong discovered IP's... For debug output you have to start the node twice, without to stop the roscore.

rosrun fkie_master_discovery master_discovery _log_level:=DEBUG _robot_hosts:=['192.XXX.XXX.ab'] send_mcast:=False listen_mcast:=False

mericgeren commented 1 year ago

Thank you so much. I don't know how but in logs now i can see they added each other and when i write rosservice /master_discovery/list_masters i can see that there are 2 masters listed. Thank you so much for all the help you have offered and your time. I you don't mind i am closing this issue as completed.

atiderko commented 1 year ago

Glad I could help!

atiderko commented 1 year ago

can you try with send_mcast:=True listen_mcast:=True