Robotics StackExchange | Archived questions

Turtlebot, Raspberry and Wifi

Hello,

I have a turtlebot which will be running ROS and I also have a Raspberry which has also ROS running. The connection between both of them is with a static IP for the RPI and an ethernet cable. So far so good, I launched roscore in the turtlebot and some launch files in the RPI an it works like it should. The problem is that I would need to access some topics launched in the RPI from another laptop over wifi. So the problem is, if I set the ROSMASTERURI with the ethernet of the turtlebot in the RPI, how can I access ROS from the laptop over wifi if I don't use the wifi's IP address as ROSMASTERURI?

Maybe this helps a bit:

RPI: Static IP=192.168.7.1 On the turtlebot I have a new ethernet connection (192.168.7.2) and this way I can ssh to the turtlebot to launch my ROS nodes. Therefore, I set ROSMASTERURI=http://192.168.7.2 on both turtlebot and RPI. (Ethernet IP).

The issue is that I want to get the topics from another laptop over wifi, as the robot will be moving.....How should ROSMASTERURI be configured?

Thanks for any tips!

Asked by Ariel on 2015-07-21 03:52:52 UTC

Comments

Answers

You need to set the ROS_MASTER_URI to the IP of the PC running the (single) roscore. So if the roscore is running on the turtlebot it should be

ROS_MASTER_URI=http://192.168.7.2:11311

(and don't forget the Port!). And obviously, if the roscore is running on the RPI, set it to this IP.


Update

For general networking problems, there is a good guide line available on the ROS wiki. Check out especially the section on name resolution

Asked by mgruhler on 2015-07-21 04:30:28 UTC

Comments

Yes, that's what I did. But I have also the wifi's IP on the turtlebot which is 140.169.147.85 and that would be that one that I should set to ROS_MASTER_URI on the other laptop........I tried that and I get "unable to comunicate to master"

Asked by Ariel on 2015-07-21 04:43:41 UTC

No, because the roscore is still running on the turtlebot or the RPI, not on the Wifi. (is this a router or an ad-hoc connection to the wifi of the turtlebot?) If you connect to the wifi, can you ping the PC where the roscore is running? Otherwise you might have to add some routes/port-forwards

Asked by mgruhler on 2015-07-21 05:30:33 UTC

The wifi is a router (or access point....not sure.....it's a huge network). From the 'other' laptop I can ping the turtlebot (they are both connected to the wifi). Should I add a static route in the turtlebot, from the ethernet to the wifi? Is that even possible?

Asked by Ariel on 2015-07-21 06:41:53 UTC

So, from the Laptop from which you want to connect to the roscore you can ping the turtlebot over Wifi? So just set the ROS_MASTER_URI to the respective IP of the PC where the roscore is running. You might however have to set the ROS_IP as well. See updated answer.

Asked by mgruhler on 2015-07-21 06:53:42 UTC

Ok, the problem was the wifi. I switched to another one and ROS_MASTER_URI on the 'other' laptop with the turtlebot's wlan0 IP I can do rostopic list and works. But anyhow, how can I ping directly from the 'other' laptop to the RPI?

Asked by Ariel on 2015-07-21 07:34:29 UTC

Try this:

README on getting RVIS to work over multiple computers

A common task is to SSH into the robot's computer and run RVIZ to get the laser output and other visualization. Running RVIZ directly on the remote computer will not work due to the way RVIZ is implemented. The workaround is to run RVIZ locally. To do this we need to set the local computer to locate the remote MASTER NODE in order to display the right information.

Assume: IP: 192.168.1.0 // remote computer (robot) IP: 192.168.1.1 // local computer (host)

*** ssh into remote computer *** 1. ssh -X erratic@192.168.1.0

At the remote terminal: 2. export ROS_MASTER_URI=http://192.168.1.0:11311 //this ensures that we do not use localhost, but the real IP address as master node

  1. export ROS_IP=192.168.1.0 //this ensures that ROS knows that we cannot use hostname directly (due to DHCP firewall issues)

  2. roscore

At the local terminal: 1. export ROS_MASTER_URI=http://192.168.1.0:11311 //tells local computer to look for the remote here

  1. export ROS_IP=192.168.1.1 //this ensures that ROS knows that we cannot use hostname directly (due to DHCP firewall issues)

  2. rosrun rviz rviz // fires up rviz on local computer. It will attach to the master node of the remote computer

** to check, open a remote terminal ** 1. rxgraph

** Note, everytime a new terminal is open on the local/remote computer, we have to call the 2 exports commands. To make this permanent, edit the ~/.bashrc file: 1. sudo gedit ~/.bashrc //add the two export commands at the end of the file.

  1. source ~/.bashrc //and restart terminal

Asked by spottybadrabbit on 2015-11-20 15:39:31 UTC

Comments