Some ROS nodes not communicating remotely through vpn
I have two remote systems connected through Hamachi vpn. System 1 is the master and System 2 is the slave. When I roslaunch
some nodes in master, I am able to see the topics through rostopic list
. I am able to rostopic echo
some topics. But there are some topics that I am not able to echo or subscribe to. When I echo these topics, I get no response. Following are my configurations:
System 1 (master)
ROS_MASTER_URI=http://rosubuntu-desktop:11311
ROS_HOSTNAME=rosubuntu-desktop
ROS_IP=25.55.160.138
System 2 (slave)
ROS_MASTER_URI=http://rosubuntu-desktop:11311
ROS_HOSTNAME=rosmaster
ROS_IP=25.84.50.3
All the ip addresses have been configured in /etc/hosts as well.
I have a rosserial node running on master with some other nodes(like imu_madgwick_filter and ekf_localization). Of all the nodes I am able to rosnode info
only the rosserial node and I am able to rostopic echo
only the topics published by rosserial. With all the other nodes, when I rosnode info, I get the following error:
ERROR: Communication with node[http://rosubuntu-desktop:45519/] failed!
This is my launch file:
<launch>
<!-- Start ROS communication between the robot's computer and Arduino base -->
<node pkg="rosserial_python" name="rosserial" type="serial_node.py" output="screen" respawn="false">
</node>
<!-- IMU relay from linorobot_msgs/Imu to sensor_msgs/Imu -->
<node pkg="imu_calib" type="apply_calib" name="apply_calib" output="screen" respawn="false">
<param name="calib_file" value="$(find imu_calib)/param/imu_calib.yaml" />
<param name="calibrate_gyros" value="true" />
</node>
<!-- Filter and fuse raw imu data -->
<node pkg="imu_filter_madgwick" type="imu_filter_node" name="imu_filter_madgwick" output="screen" respawn="false" >
<param name="fixed_frame" value="base_footprint" />
<param name="use_mag" value="false" />
<param name="publish_tf" value="false" />
<param name="use_magnetic_field_msg" value="true" />
<param name="world_frame" value="enu" />
<param name="orientation_stddev" value="0.05" />
</node>
<!-- Publish static transform from base_footprint to imu_link -->
<node pkg="tf2_ros" type="static_transform_publisher" name="base_footprint_to_imu_link" args="0 0 0 0 0 0 /base_footprint /imu_link"/>
<!-- Linear odom from imu -->
<node pkg="imu_calib" name="odom" type="odom.py" output="screen" respawn="false">
</node>
<!-- Odom-IMU Extended Kalman Filter-->
<node pkg="robot_localization" type="ekf_localization_node" name="ekf_localization">
<rosparam command="load" file="$(find imu_calib)/param/ekf_localization.yaml" />
</node>
</launch>
So my question is why is it that one node can successfully communicate across networks but other nodes cannot? How can I solve this?
UPDATE
The problem was solved by changing the host names as follows:
In Master, ROS hostname should always be resolved as the desktop name pointing to localhost.
export ROS_MASTER_URI=http://localhost:11311
or
export ROS_MASTER_URI-http://rosubuntu-desktop:11311 #rosubuntu-desktop 127.0.1.1 in hosts
In slave hosts should contain the VPN IP of the master in its name
PS: OpenVPN worked better tha Hamachi