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

can't comunicate between a publisher and a subscriber on the same machine but with another machine ros master uri

asked 2020-11-07 06:24:30 -0600

med97 gravatar image

so i have a raspberry pi and a pc both runing ros ,the publisher and the subscriber are both located in the raspberry pi when i rosrun the both nodes with the rasberry pi being the master everthing works the two nodes can communicate but when i change the master uri on the raspberry pi with the ip of the other pc and launch the two nodes the subscriber code can't subscribe it returns nothing

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2020-11-07 11:36:16 -0600

updated 2020-11-07 15:34:59 -0600

This is a verycommon issue, which is why I've created a gist script to set it up correctly, together with some troubleshooting steps: https://gist.github.com/chfritz/8c2ad....

edit flag offensive delete link more

Comments

thank you sir it worked , the problem was that i did not set the ROS_HOSTNAME and ROS_IP for both pi and pc

med97 gravatar image med97  ( 2020-11-07 13:08:38 -0600 )edit

Glad it helped! Please don't forget to upvote the answer.

chfritz gravatar image chfritz  ( 2020-11-07 13:22:02 -0600 )edit

@chfritz: thank you for answering the question, but could you please not post link-only answers? If/when your gist changes or disappears (and this does happen more frequently than you might think), this answer will lose all its value.

It would be great if you could include the relevant parts from your gist here in your answer, and then also explain what users are seeing, such that it becomes less of a magic incantation they'll just copy-paste.

gvdhoorn gravatar image gvdhoorn  ( 2020-11-08 00:48:49 -0600 )edit

Hi Gijs, I know what you are getting at, but at the same time we do this sort of thing all the time when we point people at a package or some other ros tool that solves their problem. Granted, packages are perhaps better maintained than gists (perhaps!), but certainly in both cases the benefit is that the outside resource can continue to improve. Maybe the best option would be to move the snippet of my gist over to the ros wiki somewhere? Do you think that would be better?

chfritz gravatar image chfritz  ( 2020-11-08 10:33:49 -0600 )edit
0

answered 2020-11-07 10:37:30 -0600

duck-development gravatar image

updated 2020-11-07 10:39:44 -0600

it the target machine reachable from the PI, can the pi ping the machine. is on the other machine the ros core running? is the firewall open? are all IPs in the same netmask? is there a nat router between the the pi and the other machine. Is an the machine and the pi the same ros neotic? did you try to run roswtf

edit flag offensive delete link more

Comments

yes noetic on both and yes the target machine ip is reachable ,if the publisher node is in the PI and the subscriber node is in the ubuntu pc and with the pc being the master i can communicate between the two nodes ,but if i put the two nodes inside the PI and and with the pc also being the master the two nodes cannot comunicate

med97 gravatar image med97  ( 2020-11-07 12:35:55 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2020-11-07 06:24:30 -0600

Seen: 285 times

Last updated: Nov 07 '20