Ros Docker to ROS non docker multiple machines.

asked 2021-06-05 10:27:50 -0600

sgttrieu gravatar image

updated 2021-06-06 16:12:20 -0600

Hi, I try to run ROS on different machines: each machine publish and subscribe some topics to/from the other Machine 1: run in the docker and configure as the master I edit .bashrc file

export ROS_MASTER_URI=http://MasterIP:11311
export ROS_IP=MasterIP

I also run roscore in docker and on master machine

Machine 2: I edit .bashrc file

export ROS_MASTER_URI=http://MasterIP:11311
export ROS_IP=machineIP

My testing step: Run roscore in docker on master machine, rosrun the program. on the second machine I run the program (vehiclecontrol_test) but it does not show anything (but I can still see the topics with rostopic list command, When I run topiclist echo /topic nothing showing)

robotest@robotest:~/robo-test/Vu/vtd2ros$ rosrun vtd2ros vehiclecontrol_test

When I try to run vehiclecontrol_test on the same machine with the master, it receives data

robotest@robotest:~/RoboTest/Vu/vtd2ros$ rosrun vtd2ros vehiclecontrol_test
My modifzied Throttle: 0[ INFO] [1622716994.915362905]: Throttle: [0]
[ INFO] [1622716994.916656551]: Steering Angle: [0]
[ INFO] [1622716994.925302807]: Throttle: [0]

.............................................................................................................. Now I try to run simple program outside of docker in Master machine. I receive the correct information in the other machine. Therefore, I can conclude that the problem is because in the master machine I run ROS in docker. I have researched information regarding connection docker with non-docker in ROS( muti machines) I found most suggestion using "--net=host"

  docker run \
  -it \
  -v `dirname  $(pwd)`:/home/apollo_ros_bridge \
  -v `dirname  $(pwd)`/container_root:/root \
  -v /etc/timezone:/etc/timezone:ro \
  -v /etc/localtime:/etc/localtime:ro \
  -e DISPLAY \
  -e QT_X11_NO_MITSHM=1 \
  -e QT_GRAPHICSSYSTEM=native \
  -e IMAGE_NAME=auroai/apollo_ros_bridge \
  -e TZ=`cat /etc/timezone` \
  --net=host \
  --privileged \
 auroai/apollo_ros_bridge:latest
#   -v ``:/home/cyber_ros_bridge/.bazel

I tried to configure it in both .bashrc (both machines) and in run.sh script of docker but I am still not able to receive anything from docker in another machine.

edit retag flag offensive close merge delete

Comments

For those who face the same issue. We got to configure this in Docker run also not just .bashrc file. -e ROS_MASTER_URI=http://MasterIP:11311 -e ROS_IP=MasterIP

sgttrieu gravatar image sgttrieu  ( 2021-06-18 10:03:09 -0600 )edit