Reputation: 1
I'm trying to run a ROS 2 application inside a Docker container and simulate it using Webots on the host machine. (On Mac OS)
I tried to run ROS 2 in a Docker container and then simulate it with Webots on the host.
This is the setup:
Dockerfile: FROM cyberbotics/webots:latest ...
The Controller:
vehicle_driver = WebotsController(
robot_name="silicia2",
parameters=[
{"robot_description": robot_description_path},
],
protocol="tcp",
ip_address="192.168.64.1",
port="1234",
respawn=True
)
However, when I try to run it in the Docker container (after: docker run --rm --network="host" --platform linux/amd64 -it core), and then execute ros2 launch core_simulation autonomous_driving_docker.py
, i get the following error:
ros2 launch core_simulation autonomous_driving_docker.py ip_address:=192.168.64.1 port:=1234 [INFO] [launch]: All log files can be found below /root/.ros/log/2024-11-06-20-56-29-410256-docker-desktop-5937
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [webots_controller_silicia2-1]: process started with pid [5938] ... [INFO] [estimated_state_pub-5]: process started with pid
[5946] [INFO] [visualizer-6]: process started with pid [5948] [webots_controller_silicia2-1] Cannot connect to Webots instance, retrying for another 50 seconds... ...
- Webots is running in the Host
- Adress and Port is correct
This is strange because the demo file from this documentation works: https://cyberbotics.com/doc/guide/running-extern-robot-controllers?tab-os=macos
Why might the ROS 2 controller in Docker be unable to connect to the Webots instance on the host, and how can I troubleshoot or resolve this?
It would be great if someone could provide some help. :)
Upvotes: 0
Views: 86