Robotics StackExchange | Archived questions

ROS Docker node can't publish to ROS master

Hello Guys, I am currently trying to control a robot using a ROS node in a Wsl Docker container. The workflow set-up is a local network consisting of a ROS master pc, the robot and my container. I had to manually set my host's ip address to conform to that of the network. The ROS master pc and the Wsl container are both running Ros melodic on Ubuntu 18.04. I am able to subscribe to the ROS master pc when it publishes over a topic but it doesn't work the other way from the container to the master PC (the ROS master PC doesn't echo the message of the topic, but after stopping the publisher and subscriber, I see the rostopic from the "rostopic list" command). I have followed all information online and have configured the ROSMASTERURI to that of the ROS master pc and changed my ROS_IP to the manually set one in the docker container. I also run the container with a --net=host argument.

On running roswtf i get this error

ros@docker-desktop:~$ roswtf

the rosdep view is empty: call 'sudo rosdep init' and 'rosdep update'

No package or stack in the current directory

Static checks summary:

Found 1 warning(s). Warnings are things that may be just fine, but are sometimes at fault

WARNING ROSIP may be incorrect: ROSIP [172.16.0.3] does not appear to be an IP address of a local network interface (one of ['', '', '']).

Found 1 error(s).

ERROR ROS Dep database not updated: Please update rosdep database with 'rosdep update'.

Beginning tests of your ROS graph. These may take a while... analyzing graph... ... done analyzing graph running graph rules... ERROR: connection refused to [http://172.16.0.1:45623/] ERROR: connection refused to [http://172.16.0.3:42657/] ... done running graph rules

Online checks summary:

Found 1 warning(s). Warnings are things that may be just fine, but are sometimes at fault

WARNING The following node subscriptions are unconnected: * /rostopic46351685100348640: * /teststring2 * /rostopic65011685105570182: * /dusmmy * /rostopic1121685102927315: * /test_string

Found 3 error(s).

ERROR Could not contact the following nodes: * /rostopic46351685100348640 * /rostopic1121685102927315

ERROR The following nodes should be connected but aren't: * /rostopic1121685102927315->/rosout (/rosout)

ERROR Errors connecting to the following services: * service [/rostopic1121685102927315/setloggerlevel] appears to be malfunctioning: Unable to communicate with service [/rostopic1121685102927315/setloggerlevel], address [rosrpc://172.16.0.3:45357] * service [/rostopic46351685100348640/getloggers] appears to be malfunctioning: Unable to communicate with service [/rostopic46351685100348640/getloggers], address [rosrpc://172.16.0.1:32985] * service [/rostopic46351685100348640/setloggerlevel] appears to be malfunctioning: Unable to communicate with service [/rostopic46351685100348640/setloggerlevel], address [rosrpc://172.16.0.1:32985] * service [/rostopic1121685102927315/getloggers] appears to be malfunctioning: Unable to communicate with service [/rostopic1121685102927315/getloggers], address [rosrpc://172.16.0.3:45357]

A common cause is that the machine cannot connect to itself. Please check for errors by running:

    ping 172.16.0.3

For more tips, please see

    http://wiki.ros.org/ROS/NetworkSetup

The traceback for the exception was written to the log fileenter code here

I tried pinging, and it works fine. I am able to communicate within the network so the ROS_IP i believe is fine. I dont know why I cant publish to the master, please someone help me out.

Asked by tunjii1000 on 2023-05-28 15:29:14 UTC

Comments

Answers