ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

ROS communication between both machines slow in router with out internet connection

asked 2022-05-19 03:05:00 -0600

BaBui gravatar image

updated 2022-05-27 03:28:16 -0600

Hi, I’m running

  1. Ros Kinetic under Ubuntu 16.04. The IP address are: 192.168.1.101 (master) on RPi4 - Robot
  2. Ros noetic, ubuntu 20.04, slave on my labtop 192.168.1.102 ,

Both are connected to the same router. I run turtlebot3_slam on the slave-labtop to read lidar data from master-rpi4. All computation task do on labtop. With internet connect to router, The ROS communication between both machines works great , I could run turtlebot3 navigation and slam on slave-labtop with lidar data from master-rpi4.

With no internet connection, the ping command responses slow from both sides and I could not run navigation or slam because slow responde data from lidar. Has anyone encountered this problem?

  • Edited: For example: rostopic echo /scan
    With internet: It took 1s to show /scan data.
    Without internet: It take 20 s to setup connect and get /scan info.

After lidar /scan data show, ping rate is similar. I thought the problem here, It took alot of time to set direct connecttion between publisher (Rpi4) and subscriber (labtop) when without internet. .

Thanh you aarsh_t ,I have tried to diffirent wifi router, set rosmaster on Labtop, same problem happen.

I have tried google search but could not find solution. I tried use multimaster but It does not improve Ros communication on router without internet. http://wiki.ros.org/multimaster_fkie/...

Some topic i have found: http://wiki.ros.org/ROS/Tutorials/Mul... https://answers.ros.org/question/3791... https://answers.ros.org/question/2187...

edit retag flag offensive close merge delete

Comments

1

On the second question you posted, Redhwan posted an answer to address your question. I suggest trying that and commenting on that answer if something goes wrong.

Joe28965 gravatar image Joe28965  ( 2022-05-20 05:14:49 -0600 )edit
1

It's possible this has to do with DNS timeouts.

Make sure you can either resolve all hostnames to their IP addresses without relying on your router, or don't use hostnames at all (by setting ROS_IP and ROS_MASTER_URI to IPs, instead of hostnames).

I'd recommend to use Wireshark to check what's going on in case of the slowdowns you observe.

I tried use multimaster but I does not improve Ros communication on router without internet

I'd also recommend to stay away from more complicated setups -- which multimaster_fkie definitely is -- until you've figured out the cause of your problem, as adding more complexity typically does not help solving a problem like this.

gvdhoorn gravatar image gvdhoorn  ( 2022-05-23 02:30:28 -0600 )edit

With no internet connection, the ping command responses slow from both sides

I do not think this can be the case. Try using different router or try connecting both via LAN for testing. I think upto 30-40ms of lag should be okay on wifi.

Try to setup the current time and update the RPi on robot.

Have you given thought that it might be due to the different versions of the ROS? I had somewhat similar issue and it got solved when I used similar version of ROS on both rosmaster and rosnode on PC.

One more thing I can think of is, Use your PC as rosmaster instead RPi, ssh to the Rpi and run nodes over there.

aarsh_t gravatar image aarsh_t  ( 2022-05-23 03:18:57 -0600 )edit
3

Just to set this straight, as I keep seeing the terminology used here on ROS Answers:

[..] of ROS on both master and slave.

ROS is a peer-to-peer framework. By definition all nodes are equal.

There are no slaves, nor masters.

The ROS master only functions as DNS server. It is not directly involved in communication between nodes.

gvdhoorn gravatar image gvdhoorn  ( 2022-05-23 03:20:59 -0600 )edit

Haha yes, I should stop using it.

aarsh_t gravatar image aarsh_t  ( 2022-05-23 03:24:15 -0600 )edit

Thanh you aarsh_t and gvdhoorn ,I have tried to diffirent wifi router, set rosmaster on Labtop, same problem happen.

I did not suggest any of these things.

gvdhoorn gravatar image gvdhoorn  ( 2022-05-24 01:50:55 -0600 )edit
1

What is the ping rate with and without the internet connection? try to ping RPi from laptop terminal using ping IP_OF_RPi

aarsh_t gravatar image aarsh_t  ( 2022-05-27 02:26:12 -0600 )edit

Dear, aarsh_t , For example: rostopic echo /scan
With internet: It took 1s to get info. Without internet: It take 20 s to setup connect and get /scan info. After lidar /scan data show, ping rate is similar . I thought the problem here, It took alot of time to set direct connecttion between publisher (Rpi4) and subscriber (labtop) when without internet.

BaBui gravatar image BaBui  ( 2022-05-27 03:25:18 -0600 )edit

2 Answers

Sort by » oldest newest most voted
1

answered 2022-06-25 12:05:24 -0600

BaBui gravatar image

updated 2022-06-25 12:09:38 -0600

[FINALLY FIXED IT]

Reason:

I don't know that I need synchronize time between master (rpi4 ) and slave ( My labtop) . When the router connect to internet, It automatic synchronize time. When disconnect, time between master and slave is different. And you need export enviroment parameter for ROS Communication:

Slave
export ROS_IP=$(hostname -I | awk '{print $1;}')
export ROS_HOSTNAME=$ROS_IP
export ROS_MASTER_URI=http://192.168.1.100:11311
Master
export ROS_IP=$(hostname -I | awk '{print $1;}')
export ROS_HOSTNAME=$ROS_IP

How to solve:Synchronize time use Chrony NTP Service [ Local Server ] and Client. Reference this youtube link: https://www.youtube.com/watch?v=jxHP0...

Server My labtop

sudo apt install chrony -y
sudo nano    /etc/chrony/chrony.conf

Add these like to the last line in chrony.conf. Allow client Ip to synchronize time

# Step the system clock instead of slewing it if the adjustment is larger than
# one second, but only in the first three clock updates.
makestep 1 3
local stratum 10
#manual
allow 192.168.1.0/24
smoothtime 400 0.01

Client : (Rpi4 board)

sudo apt install chrony -y 
sudo nano    /etc/chrony/chrony.conf

Disable update time from internet and add server Ip (My labtop) by adding # before them and add server 192.168.1.101 iburst prefer at last line:

#pool ntp.ubuntu.com        iburst maxsources 4
#pool 0.ubuntu.pool.ntp.org iburst maxsources 1
#pool 1.ubuntu.pool.ntp.org iburst maxsources 1
#pool 2.ubuntu.pool.ntp.org iburst maxsources 2
server 192.168.1.101 iburst prefer

Check your setup:

sudo nano systemctl restart chrony    
chronyc tracking   
Reference ID    : C0A80165 (192.168.1.101)
Stratum         : 11
If it show like this, it is ok .
edit flag offensive delete link more
1

answered 2022-05-24 02:32:22 -0600

Joe28965 gravatar image

Just to confirm a couple of things:

  1. You're running Ubuntu 16.04 with ROS Kinetic on your RPi4 (IP 192.168.1.101)
  2. You're running Ubuntu 20.04 with ROS Noetic on your laptop (IP 192.168.1.102)

Also what exactly have you added to your bashrc to try and set this up. An exact copy of the lines for both of them.

edit flag offensive delete link more

Comments

I ran export ROS_MASTER_URI=http://pibot.local:11311 on both rpi4 and labtop. It worked well if router connect to internet. Without internet, It became very slow, I took 60- 240 second to start roslaunch. This is bashrc file in may labtop : bashrc file

BaBui gravatar image BaBui  ( 2022-05-26 21:07:14 -0600 )edit
1

Ah, okay, so what gvdhoorn said is

by setting ROS_IP and ROS_MASTER_URI to IPs, instead of hostnames

So don't set it to export ROS_MASTER_URI=http://pibot.local:11311 but set it directly to export ROS_MASTER_URI=http://192.168.1.101:11311

Joe28965 gravatar image Joe28965  ( 2022-05-30 01:13:27 -0600 )edit

Ya, I tried set it derectly to IP , It improve speed a little but not too much.

BaBui gravatar image BaBui  ( 2022-05-30 02:54:21 -0600 )edit

Did you do it for everything? export ROS_IP=192.168.1.102export ROS_HOSTNAME=192.168.1.102export ROS_MASTER_URI=http://192.168.1.101:11311 and did you do the same on the raspberry pi?

Also, what's "a little"?

Joe28965 gravatar image Joe28965  ( 2022-05-30 02:58:52 -0600 )edit
  • currently you're not exporting any ROS_MASTER_URI in your bashrc, since you've commented out all of them.
Joe28965 gravatar image Joe28965  ( 2022-05-30 03:00:46 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2022-05-19 02:58:42 -0600

Seen: 953 times

Last updated: Jun 25 '22