Communication between docker and host
Hi Guys,
This is with respect to the q313094, I was able to get rid of the /use_sim_time is not set, will not subscribe to simulated time [/clock] topic
error by following the steps given in link.
However as mentioned in the answer, I always need to run the subscriber first then start publishing the message. If I start publishing first then subscriber it doesn't work.
Could you please let me know is there a way I can fix this, so that I can subscribe to the message anytime?
Problem description:
I have an application which is running inside the docker (Apollo - autonomous driving platform) which uses ros for message communication, I want to create custom messages in my host system and publish to the apollo platform inside docker. For testing purpose I just published simple message by running rostopic pub -r 10 /test_topic std_msgs/String "hello...."
. This did not work as I was getting error /use_sim_time is not set, will not subscribe to simulated time [/clock] topic
. This was fixed by By using --net=host, ROS_IP=127.0.0.1 and ROS_MASTER_URI=http://localhost:11311 and running the subscriber from docker before the publisher from host I got it working.
But this means subscriber must always run before publisher for my scripts to work.
Update 1: @dljubic Please find the details given below:
Outside the docker container:
echo $ROS_MASTER_URI - http://localhost:11311
echo $ROS_HOSTNAME - empty
echo $ROS_IP - empty
Inside the docker container:
echo $ROS_MASTER_URI - http://172.17.0.1:11311
echo $ROS_HOSTNAME - empty
echo $ROS_IP - 172.17.0.1
Thank you, KK
Can you summarize the problem and what you're trying to do? This question doesn't stand on its own as is.
Apologies, I will elaborate the issue. I have updated the question. Thank you.
Cloud you please provide the output of
echo $ROS_MASTER_URI
,echo $ROS_HOSTNAME
andecho $ROS_IP
on your host i.e. outside of a Docker container and inside a Docker container?@dljubic I have updated the question with the details (inside and outside docker container). I am not seeing any output for
HOSTNAME and IP
outside the docker.