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

Localhost vs. 0.0.0.0

asked 2018-07-17 11:07:52 -0500

pitosalas gravatar image

updated 2018-07-22 19:01:29 -0500

I've had problems troubleshooting IP addresses with my setup and want to verify some questions, if you could help:

  1. Should I use localhost or 0.0.0.0 when referring to myself, or does it have to be a real URI?

  2. I have read that if you don't have a DNS name, you must use ROS_IP and not ROS_HOSTNAME, yet I see many examples where an ip address is used for ROS_HOSTNAME. For example, here: http://emanual.robotis.com/docs/en/pl... near the end you will see ROS_HOSTNAME=192.168.9.100

  3. Can I omit both ROS_IP and ROS_HOSTNAME usually - unless I have more than one network adapter. If I have more than one then by default ROS would use all of them. But by specifying ROS_IP or ROS_HOSTNAME I can limit ROS to a specific one.

Followup

  1. On the computer running ROSCORE, I understand that this is almost always sufficient.

export ROS_MASTER_URI=http://localhost:11311

Under what special circumstances does that computer need a specific IP address of ROS_MASTER? And does it ever need ROS_IP or ROS_HOSTNAME?

Thanks!

edit retag flag offensive close merge delete

Comments

Do you have links for these examples?

jayess gravatar image jayess  ( 2018-07-17 11:15:29 -0500 )edit

You can use either ROS_IP or ROS_HOSTNAME. If you have both set, ROS_HOSTNAME will take precedence. See https://wiki.ros.org/ROS/EnvironmentV...

jayess gravatar image jayess  ( 2018-07-17 11:18:16 -0500 )edit

Here's one example specifying an IP address with ROS_HOSTNAME: http://emanual.robotis.com/docs/en/pl... (you have to look for it near the end of that page.)

Also what about localhost vs. 0.0.0.0?

pitosalas gravatar image pitosalas  ( 2018-07-17 16:24:19 -0500 )edit

That tutorial that you linked to is incorrect. ROS_HOSTNAME is for hostnames such as localhost, not IP addresses as that's what ROS_IP is for.

jayess gravatar image jayess  ( 2018-07-17 16:47:43 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2018-07-17 16:53:26 -0500

jayess gravatar image

updated 2018-07-17 16:55:18 -0500

I'll answer your question to best of my ability.

  • 127.0.0.1 is the loopback address (also known as localhost).
  • 0.0.0.0 is a non-routable meta-address used to designate an invalid, unknown or non applicable target (a no particular address placeholder).

As for the bottom line, it's a matter of preference as to which to use. I prefer ROS_HOSTNAME because I can use it in launch files in the <machine> tag and it's easier to remember hostnames vs. IP addresses.

edit flag offensive delete link more

Comments

Thanks! Please check the followup question in the original post under "followup"? Thanks!!!

pitosalas gravatar image pitosalas  ( 2018-07-22 19:01:08 -0500 )edit

I'll take a look at it if you post it as a new question. You can provide a link back to this question keep the continuity

jayess gravatar image jayess  ( 2018-07-22 19:03:12 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2018-07-17 11:07:52 -0500

Seen: 1,825 times

Last updated: Jul 22 '18