0

I have running some UUV simulator on Gazebo 9 and ROS melodic and Ubuntu 18.04 in a PC. So i like to connect the rasppbery Pi 4 with the PC (running the Gazebo UUV Simulator) and develop a node in the Rasppbery Pi that give me for example the Camera stream data on the Gazebo UUV simulator. So my question is how to communicate the PI with the PC(running the Gazebo UUV Simulator) and can get the Camera topic or any other sensor topic from the Gazebo UUV Simulator in the Pi?

Any Help Thanks

Bob9710
  • 205
  • 3
  • 15

1 Answers1

0

Yes, you can communicate across devices with ROS, but there are a few things that need to be done first.

  1. You need to make sure your ROS_MASTER_URI is setup correctly. This is an environmental variable that tells ROS where to look for the roscore. By default it is set to localhost:11311. So on the Pi you'll need to do: export ROS_MASTER_URI=http://<master_ip>:<master_port>.
  2. Next you need to make sure ROS can actually resolve names and connect. Make sure the computer has IP/Hostname info for the pi and vise-versa. For Ubuntu 18.04 do this by setting the IP/hostname for both machines in /etc/hosts. Also make sure the hostnames match up with /etc/hostname

After that you can just start up a ROS node/core on the host machine and the Pi will be able to see and interact with the topics like normal.

BTables
  • 4,413
  • 2
  • 11
  • 30
  • so in my cast ROS master is the PC running Gazebo? and the host is the Pi correct? And the ROS node for the topic will be in the Pi? – Bob9710 Sep 03 '21 at 15:39
  • The ros master can run where ever you like, but I recommend on the PC. The "host" machine is whatever is running the roscore(the PC). The rosnode for a topic can be where ever you want as well. Both the PC and Pi will be able to see all of the same topic info. i.e. if the PC publishes a message, the Pi will see it, and vise-versa. – BTables Sep 03 '21 at 15:44
  • So in my case master is the PC? – Bob9710 Sep 05 '21 at 07:10
  • The ros master is wherever the `roscore` is running. In the example I provided, and what I recommend, it is running on the PC. – BTables Sep 05 '21 at 17:48