ROS 1 Bridge running in docker container not receiving published topics from ROS 2 humble
I am using my system to simulate(22.04 & Humble) a turtlebot3 and a teleop twist keyboard. This system publishes camera topics to be used by container 1.
2 docker containers.
Container 1: runs ORB SLAM3(18.04 & Melodic)
I've tried to install ROS2 in this container so I can just run the bridge straight away but since it's running 18.04 I have been unable to install ros 2
Container 2&3: runs ros 1 bridge(foxy & noetic) & master taken from link text
Although when running ROSCORE in Container 1 it acts as the master node and gives the ip 127.0.0.1 without running the master node container in container 2&3 I will get the error that there is no master, which is why I am running 2 ROS1 masters.
Issue When running rostopic list in container 1, no topics publsihed from the system are received
I have implemented this method because I'd like to use ROS2 Humble for whatever I am able to and add in a docker containers which contain 1 of several visual SLAM algorithms I'd like to use since they are all written for various distros and ubuntu versions
Asked by ros-nice-nick on 2023-05-19 20:28:58 UTC
Answers
Two ROS1 masters cannot make the systems communicate with each other through ROS topics as you observed. Instead, you can try using docker's --net=host
(for example docker run -it --net=host --name container_name image_name:image_tag
) while running the containers. (or in case of docker-compose network-mode: "host"
)
This allows them to share the network resources (such as IP) and then you don't need two ROS masters.
Alternatively, you can also try following the tutorial: http://wiki.ros.org/ROS/Tutorials/MultipleMachines if you want the dockers to be on isolated networks.
PS: In case you find ros1 bridge to introduce latencies or packet drop, consider trying the slim_bridge!
Asked by Gaurav Gupta on 2023-05-20 05:28:51 UTC
Comments
This doesn't sound like bridging ros1-ros2 question. It sounds like using network app (e.g. ROS) in Docker container question. Without a proper configuration, local addresses used in your Docker container do not access outside of the same container.
Asked by 130s on 2023-05-20 10:43:25 UTC