[ROS in 5 mins] 010 – What is ROS_MASTER_URI?

[ROS-in-5-mins]-010---What-is-ROS_MASTER_URI-

Written by The Construct

11/06/2018

 

In this video, we will see what the ROS_MASTER_URI is in just 5 minutes. We’ll see what it represents and how it’s used in the entire ROS system.

If you are a ROS beginner and want to learn ROS basics fast, we recommend you take any of the following courses on Robot Ignite Academy:

Let’s go!


Links mentioned in the video:

– ROS Development Studio (RDS), used for the demonstration: ROS Development Stdio
– Robot Ignite Academy, the place to learn to program robots using only a web browser: Robot Ignite Academy
– The openni_launch example from ROS Wiki: http://wiki.ros.org/openni_launch


Below are the Steps to create the project as shown in the video

Step 1

  • Head to ROS Development Studio and create a new project.
  • Provide a suitable project name and some useful description. (We have named the project )
  • Load/Open the project (this will take few seconds).
  • Open Tools > Shell and run following commands

$ echo $ROS_MASTER_URI

Note the result of the above command, it should have the following format http://<ip>:<port>. The following image shows a representational value


The specific values shown in the image are \<ip>=10.8.0.1 and \<port>=11311.

Step 2

  • The ip we just saw is also referred as hostname and it denotes the address of the computer running the roscore program.
  • To understand better, lets run a ros application

$ roslaunch openni_launch openni.launch

When the above command executes, it will launch the openni project. First of all ros master will be run (as shown) and once the ros master is ready other nodes are loaded. Note that there is only one ros master, however any number of nodes can exist.

Step 3

Next we can see how to change the ROS_MASTER_URI. The simplest way to change ROS_MASTER_URI is by editing the .bashrc file. This file is a system file and thus hidden by default, we will modify its content using the vi editor. Use the following command to start editing the .bashrc file (located in home directory)

$ vim ~/.bashrc

The following line is responsible for assigning the ros master ip

export ROS_MASTER_URI=http://10.8.0.1:11311

We can modify this line to use any other ip address. For reflecting the changed ip we will need to load this bash file. Use the following command to do so

$ source ~/.bashrc

Once we have sourced the bashrc file, we will see the changed ros master uri when launching ros project.

 


If you want to learn about other ROS topics, please let us know on the comments area and we will do a video about it.

Thank you!

Masterclass 2023 batch2 blog banner

Check Out These Related Posts

0 Comments

Submit a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Pin It on Pinterest

Share This