I would like to know how to set up connection between ROS in Docker with ROS on host PC correctly.
Following some answers like these  I can understand that connecting container to host network and exporting proper environmental variables should be enough.
However, when I try pub/echo between container and host PC, I get no response
Here is how I start everything:
On host PC I have the following in my .bashrc:
Then I start
roscore in the first terminal. In the second terminal I run:
docker run --net=host --name ros-test -it --rm osrf/ros:noetic-desktop
And in the resulting second terminal I export the same environmental variables as shown above. Then I inspect available topics with
rostopic list and can see default topics when roscore in running:
Then in the third terminal from host PC I try simple publish command:
rostopic pub -r 1 /test std_msgs/String "halo"
Then try to receive messages in the container which is the second terminal:
rostopic echo /test
I expect to receive messages, but there is nothing coming. When I do
rostopic hz /test, it says "no new messages"
When I check
rostopic info /test from fourth terminal I get the folllowing:
- /rostopic_178825_1670943581897 (http://risc-SYS-5049A-TR:33815/)
- /rostopic_111_1670945011845 (http://docker-desktop:57739/)
With publisher being my third terminal and subscriber being my second terminal which is container
Is there something wrong with how I am doing things? Please advise or help
Post score: 1