- Copy the docker-compose.yml and Dockerfile to a new folder.
- Run
docker compose up -d - Next in,
- Terminal 1 :>> Run
docker compose exec -it rosc1 tmate - Terminal 2 :>> Run
docker compose exec -it rosc2 tmate - Terminal 3 :>> Run
docker compose exec -it rosc3 tmate - Now, you have been connected to those containers in respective terminal. In,
- Terminal 1 :>> Run
ros2 run demo_nodes_cpp talker - Terminal 2 :>> Run
ros2 run demo_nodes_cpp listener - Terminal 3 :>> Run
ros2 run demo_nodes_cpp listener
- Terminal 1 :>> Run
- Terminal 1 :>> Run
- You can observe that the listeners on the rosc2 and rosc3 containers are listening to the talker on rosc1 container.
- By running the docker-compose.yml, we are running 4 containers,
- robot_ds ( container running fastdds discovery server )
- rosc1 and rosc2 ( configured as localhost and shared memory with robot_ds for interprocess communication ( shm transport in dds )
- rosc3 ( configured to connect to dds and transport data in udp or tcp/ip mode ( default if shm transport is not possible) )
- Data is transferred using UDPV4 in
rosc1 -- rosc2and inrosc1 -- rosc3, even though therosc1 -- rosc2met the requirements for ipc (using shm transport). - The fastdds_qos settings have to be configured to realise the expected behaviour of shm transport