jeguzzi / robomaster_ros

ROS2 for DJI Robomaster EP and S1
https://jeguzzi.github.io/robomaster_ros
MIT License
49 stars 10 forks source link

host cannot communicate with container #13

Open UserName-wang opened 4 months ago

UserName-wang commented 4 months ago

Hi, I started the container via command: sudo docker compose up I tried to use rqt (and rqt_graph) to monitor the topics published in container. and rqt can list out the topics in container but cannot print out the topic content. but rqt_grahp cannot find the nodes created in container. and RVIZ2 also cannot subscribe the image from S1. ROS_DOMAIN_ID were set to the same number both in container and host. Are there any other settings should be done before connect to S1 in container? I think it could be easy to correct the settings. thank you for any suggestions.

the yaml file: version: '3' services: driver: image: jeguzzi/robomaster_ros:humble build: context: .. dockerfile: Dockerfile network_mode: host environment:

log information print out in terminal: sudo docker compose up [sudo] password for orin: WARN[0000] Found orphan containers ([s1-teleop-1]) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up. [+] Running 1/0 ✔ Container s1-driver-1 Created 0.0s Attaching to driver-1 driver-1 | [INFO] [launch]: All log files can be found below /root/.ros/log/2024-02-24-03-33-28-258386-orin-agx-1 driver-1 | [INFO] [launch]: Default logging verbosity is set to INFO driver-1 | [INFO] [robomaster_driver-1]: process started with pid [64] driver-1 | [INFO] [robot_state_publisher-2]: process started with pid [66] driver-1 | [INFO] [joint_state_publisher-3]: process started with pid [68] driver-1 | [robot_state_publisher-2] Warning: link 'speaker_link' material 'Material #32.001' undefined. driver-1 | [robot_state_publisher-2] at line 84 in /ros_ws/src/urdfdom/urdf_parser/src/model.cpp driver-1 | [robot_state_publisher-2] Warning: link 'speaker_link' material 'Material #32.001' undefined. driver-1 | [robot_state_publisher-2] at line 84 in /ros_ws/src/urdfdom/urdf_parser/src/model.cpp driver-1 | [robomaster_driver-1] [INFO] [1708745610.117109422] [robomaster]: Waiting for a robot driver-1 | [robomaster_driver-1] [INFO] [1708745610.122266496] [robomaster]: Found a robot driver-1 | [robomaster_driver-1] [INFO] [1708745610.123151966] [robomaster]: Try to connect via sta to robot with sn None driver-1 | [robomaster_driver-1] [INFO] [1708745610.843849004] [robomaster]: Connected driver-1 | [robomaster_driver-1] [INFO] [1708745610.960670140] [robomaster]: [Chassis] Topic cmd_vel will control wheel speeds driver-1 | [robomaster_driver-1] [INFO] [1708745611.204520034] [robomaster]: Set initial robot mode to free driver-1 | [robomaster_driver-1] [INFO] [1708745611.277636644] [robomaster]: Enabled modules: Battery, Camera, Chassis, LED, Speaker, Gimbal, Blaster driver-1 | [robomaster_driver-1] [INFO] [1708745612.112190250] [robomaster]: [Camera] Started video stream with resolution 360p

UserName-wang commented 4 months ago

Screenshot from 2024-02-24 11-58-13 ![Uploading Screenshot from 2024-02-24 11-59-33.png…]()

jeguzzi commented 2 months ago

Hi @UserName-wang, sorry for the delay.

Communication with ROS nodes running in docker via host network is a bit tricky. What I normally do is to add the following config to the services

    network_mode: host
    pid: host
    ipc: host

I will add them the docker-compose files on the repos, thanks.

UserName-wang commented 2 months ago

@jeguzzi , Thank you for your suggestion! I will try and give you feedback. I'm so happy that you didn't forgot this topic!