Skip to content

Commit 9e5777a

Browse files
committed
Add cross-instance DDS communication verify session and gif file.
1 parent 9ef37c4 commit 9e5777a

File tree

4 files changed

+192
-55
lines changed

4 files changed

+192
-55
lines changed

content/learning-paths/automotive/openadkit2_safetyisolation/3_container_spliting.md

Lines changed: 95 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,24 @@ touch docker/cycloneDDS.xml
8181

8282
This will create a duplicate Compose configuration (docker-compose-2ins.yml) and an empty CycloneDDS configuration file to be shared across containers.
8383

84+
To ensure a smooth experience during testing and simulation, it’s a good idea to pull all required container images before moving on.
85+
86+
This avoids interruptions in later steps when you run `docker compose up` or `docker compose run`, especially during the cross-instance DDS validation or full scenario launch.
87+
88+
Run the following command in your project directory:
89+
90+
```bash
91+
docker compose -f docker-compose.yml pull
92+
```
93+
94+
{{% notice info %}}
95+
Each image is around 4–6 GB, so pulling them may vary depending on your network speed.
96+
{{% /notice %}}
97+
98+
This command will download all images defined in the docker-compose-2ins.yml file, including:
99+
- ***odinlmshen/autoware-simulator:v1.0***
100+
- ***odinlmshen/autoware-planning-control:v1.0***
101+
- ***odinlmshen/autoware-visualizer:v1.0***
84102

85103
#### Step 2: Configure CycloneDDS for Peer-to-Peer Communication
86104

@@ -273,60 +291,82 @@ Reference:
273291
- [ROS2 documentation](https://docs.ros.org/en/humble/How-To-Guides/DDS-tuning.html#cyclone-dds-tuning)
274292

275293

276-
#### Step 5: Execution: Launching the Distributed Containers
277-
278-
To start the system, you need to configure and run separate launch commands on each machine.
279-
280-
On each instance, copy the appropriate launch script into the openadkit_demo.autoware/docker directory.
281-
282-
{{< tabpane code=true >}}
283-
{{< tab header="Planning-Control" language="bash">}}
284-
!/bin/bash
285-
# Configure the environment variables
286-
export SCRIPT_DIR=/home/ubuntu/openadkit_demo.autoware/docker
287-
CONF_FILE_PASS=$SCRIPT_DIR/etc/simulation/config/pass_static_obstacle_avoidance.param.yaml
288-
CONF_FILE_FAIL=$SCRIPT_DIR/etc/simulation/config/fail_static_obstacle_avoidance.param.yaml
289-
290-
export CONF_FILE=$CONF_FILE_FAIL
291-
export COMMON_FILE=$SCRIPT_DIR/etc/simulation/config/common.param.yaml
292-
export NGROK_AUTHTOKEN=$NGROK_AUTHTOKEN
293-
export NGROK_URL=$NGROK_URL
294-
295-
# Start planning-control
296-
echo "Running planning v1.."
297-
TIMEOUT=120 CONF_FILE=$CONF_FILE_PASS docker compose -f "$SCRIPT_DIR/docker-compose-2ins.yml" up planning-control --abort-on-container-exit {{< /tab >}}
298-
299-
{{< tab header="Visualizer & Simulator" language="bash">}}
300-
#!/bin/bash
301-
# Configure the environment variables
302-
SCRIPT_DIR=/home/ubuntu/openadkit_demo.autoware/docker
303-
export
304-
CONF_FILE_FAIL=$SCRIPT_DIR/etc/simulation/config/fail_static_obstacle_avoidance.param.yaml
305-
export CONF_FILE=$CONF_FILE_FAIL
306-
export COMMON_FILE=$SCRIPT_DIR/etc/simulation/config/common.param.yaml
307-
export NGROK_AUTHTOKEN=$NGROK_AUTHTOKEN
308-
export NGROK_URL=$NGROK_URL
309-
# Start visualizer and show logs
310-
docker compose -f "$SCRIPT_DIR/docker-compose-2ins.yml" up visualizer -d
311-
echo "Waiting 10 seconds for visualizer to start..."
312-
sleep 10
313-
docker compose -f "$SCRIPT_DIR/docker-compose-2ins.yml" logs visualizer
314-
# Start simulator
315-
echo "Running simulator v1.."
316-
TIMEOUT=300 CONF_FILE=$CONF_FILE_FAIL docker compose -f "$SCRIPT_DIR/docker-compose-2ins.yml" up simulator --abort-on-container-exit
317-
TIMEOUT=300 CONF_FILE=$CONF_FILE_FAIL docker compose -f "$SCRIPT_DIR/docker-compose-2ins.yml" up simulator --abort-on-container-exit
318-
TIMEOUT=300 CONF_FILE=$CONF_FILE_FAIL docker compose -f "$SCRIPT_DIR/docker-compose-2ins.yml" up simulator --abort-on-container-exit
319-
{{< /tab >}}
320-
{{< /tabpane >}}
321-
322-
Once both machines are running their respective launch scripts, the Visualizer will generate a web-accessible interface using the machine’s public IP address.
323-
You can open this link in a browser to observe the demo behavior, which will closely resemble the output from the [previous learning path](http://learn.arm.com/learning-paths/automotive/openadkit1_container/4_run_openadkit/).
324-
325-
![img3 alt-text#center](split_aws_run_15.gif "Figure 4: Simulation")
326-
327-
Unlike the previous setup, the containers are now distributed across two separate instances, allowing for real-time cross-node communication.
328-
Behind the scenes, this setup demonstrates how DDS handles low-latency, peer-to-peer data exchange in a distributed ROS 2 environment.
329-
330-
To facilitate demonstration and observation, the simulator is configured to run `three times` sequentially, allowing you to validate the DDS communication across multiple execution cycles.
294+
#### Step 5: Verifying Cross-Instance DDS Communication with ROS 2
295+
296+
To confirm that ROS 2 nodes can exchange messages across two separate EC2 instances using DDS, this test will walk you through a minimal publisher–subscriber setup using a custom topic.
297+
298+
##### On Planning-Control Node (Publisher)
299+
300+
On the first EC2 instance, you will publish a custom message to the /hello topic using ROS 2.
301+
This will simulate outbound DDS traffic from the planning-control container.
302+
303+
Set the required environment variables and launch the planning-control container.
304+
305+
```bash
306+
export SCRIPT_DIR=/home/ubuntu/openadkit_demo.autoware/docker
307+
export CONF_FILE=$SCRIPT_DIR/etc/simulation/config/fail_static_obstacle_avoidance.param.yaml
308+
export COMMON_FILE=$SCRIPT_DIR/etc/simulation/config/common.param.yaml
309+
export NGROK_AUTHTOKEN=""
310+
export NGROK_URL=""
311+
export TIMEOUT=300
312+
313+
# Launch the container
314+
docker compose -f docker/docker-compose-2ins.yml run --rm planning-control bash
315+
```
316+
317+
Once inside the container shell, activate the ROS 2 environment and start publishing to the /hello topic:
318+
319+
```bash
320+
# Inside the container:
321+
source /opt/ros/humble/setup.bash
322+
ros2 topic list
323+
ros2 topic pub /hello std_msgs/String "data: Hello From Planning" --rate 1
324+
```
325+
326+
##### On Simulator Node (Subscriber) side
327+
328+
On the second EC2 instance, you will listen for the /hello topic using ros2 topic echo.
329+
This confirms that DDS communication from the planning node is received on the simulation node.
330+
331+
Same with Publisher side, you need to set the required environment variables and launch the Simulator container.
332+
333+
```bash
334+
export SCRIPT_DIR=/home/ubuntu/openadkit_demo.autoware/docker
335+
export CONF_FILE=$SCRIPT_DIR/etc/simulation/config/fail_static_obstacle_avoidance.param.yaml
336+
export COMMON_FILE=$SCRIPT_DIR/etc/simulation/config/common.param.yaml
337+
export NGROK_AUTHTOKEN=""
338+
export NGROK_URL=""
339+
export TIMEOUT=300
340+
341+
# Launch the container
342+
docker compose -f docker/docker-compose-2ins.yml run --rm simulator bash
343+
```
344+
345+
Once inside the container shell, activate the ROS 2 environment and start publishing to the /hello topic:
346+
347+
```bash
348+
# Inside the container:
349+
source /opt/ros/humble/setup.bash
350+
ros2 topic list
351+
ros2 topic echo /hello
352+
```
353+
354+
In the simulator container, you should see repeated outputs like:
355+
```
356+
root@ip-172-31-19-5:/autoware# ros2 topic echo /hello
357+
data: Hello From Planning
358+
---
359+
data: Hello From Planning
360+
---
361+
data: Hello From Planning
362+
---
363+
data: Hello From Planning
364+
---
365+
```
331366

367+
This confirms that:
368+
- DDS peer discovery between the two machines is successful.
369+
- ROS 2 nodes are able to communicate across EC2 instances via /hello topic.
370+
- The network settings including host mode, security group, and CycloneDDS peer configuration are correctly applied.
332371

372+
In the next section, you’ll complete the full end-to-end demonstrationa with all of concepts.
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
---
2+
title: Executing the Multi-Instance with DDS-Based Communication
3+
weight: 5
4+
5+
### FIXED, DO NOT MODIFY
6+
layout: learningpathall
7+
---
8+
9+
### Demonstrating the Distributed OpenAD Kit in Action
10+
11+
In this session, you’ll bring all the previous setup together and execute the full [OpenAD Kit](https://autoware.org/open-ad-kit/) demo across two Arm-based instances.
12+
13+
OpenAD Kit is an open-source reference design for autonomous driving workloads on Arm.
14+
It demonstrates how Autoware modules can be deployed on scalable infrastructure — whether on a single machine or split across multiple compute nodes.
15+
16+
#### Preparing the Execution Scripts
17+
18+
This setup separates the simulation/visualization environment from the planning-control logic, allowing you to explore how ROS 2 nodes communicate over a distributed system using DDS (Data Distribution Service).
19+
20+
To start the system, you need to configure and run separate launch commands on each machine.
21+
22+
On each instance, copy the appropriate launch script into the openadkit_demo.autoware/docker directory.
23+
24+
{{< tabpane code=true >}}
25+
{{< tab header="Planning-Control" language="bash">}}
26+
!/bin/bash
27+
# Configure the environment variables
28+
export SCRIPT_DIR=/home/ubuntu/openadkit_demo.autoware/docker
29+
CONF_FILE_PASS=$SCRIPT_DIR/etc/simulation/config/pass_static_obstacle_avoidance.param.yaml
30+
CONF_FILE_FAIL=$SCRIPT_DIR/etc/simulation/config/fail_static_obstacle_avoidance.param.yaml
31+
32+
export CONF_FILE=$CONF_FILE_FAIL
33+
export COMMON_FILE=$SCRIPT_DIR/etc/simulation/config/common.param.yaml
34+
export NGROK_AUTHTOKEN=$NGROK_AUTHTOKEN
35+
export NGROK_URL=$NGROK_URL
36+
37+
# Start planning-control
38+
echo "Running planning v1.."
39+
TIMEOUT=120 CONF_FILE=$CONF_FILE_PASS docker compose -f "$SCRIPT_DIR/docker-compose-2ins.yml" up planning-control -d
40+
{{< /tab >}}
41+
42+
{{< tab header="Visualizer & Simulator" language="bash">}}
43+
#!/bin/bash
44+
SCRIPT_DIR=/home/ubuntu/openadkit_demo.autoware/docker
45+
46+
export CONF_FILE_FAIL=$SCRIPT_DIR/etc/simulation/config/fail_static_obstacle_avoidance.param.yaml
47+
export CONF_FILE=$CONF_FILE_FAIL
48+
export COMMON_FILE=$SCRIPT_DIR/etc/simulation/config/common.param.yaml
49+
export NGROK_AUTHTOKEN=$NGROK_AUTHTOKEN
50+
export NGROK_URL=$NGROK_URL
51+
export TIMEOUT=300
52+
53+
# Start visualizer once
54+
docker compose -f "$SCRIPT_DIR/docker-compose-2ins.yml" up visualizer -d
55+
echo "Waiting 10 seconds for visualizer to start..."
56+
sleep 10
57+
58+
# Run simulator scenario 3 times
59+
for i in {1..3}; do
60+
echo "Running simulator demo round $i..."
61+
docker compose -f "$SCRIPT_DIR/docker-compose-2ins.yml" run --rm simulator
62+
echo "Round $i complete. Waiting 5 seconds before next run..."
63+
sleep 5
64+
done
65+
echo "All simulator runs complete."
66+
{{< /tab >}}
67+
{{< /tabpane >}}
68+
69+
You can also find the prepared launch scripts—`opad_planning.sh` and `opad_sim_vis.sh` —inside the `openadkit_demo.autoware/docker` directory on both instances.
70+
71+
These scripts encapsulate the required environment variables and container commands for each role.
72+
73+
#### Running the Distributed OpenAD Kit Demo
74+
75+
On the Planning-Control node, execute:
76+
77+
```bash
78+
./opad_planning.sh
79+
```
80+
81+
On the Simulation and Visualization node, execute:
82+
83+
```bash
84+
./opad_sim_vis.sh
85+
```
86+
87+
Once both machines are running their respective launch scripts, the Visualizer will generate a web-accessible interface using the machine’s public IP address.
88+
You can open this link in a browser to observe the demo behavior, which will closely resemble the output from the [previous learning path](http://learn.arm.com/learning-paths/automotive/openadkit1_container/4_run_openadkit/).
89+
90+
![img3 alt-text#center](split_aws_run.gif "Figure 4: Simulation")
91+
92+
Unlike the previous setup, the containers are now distributed across two separate instances, enabling real-time, cross-node communication.
93+
Behind the scenes, this architecture demonstrates how DDS manages low-latency, peer-to-peer data exchange in a distributed ROS 2 environment.
94+
95+
To support demonstration and validation, the simulator is configured to run `three times` sequentially, giving you multiple opportunities to observe how data flows between nodes and verify that communication remains stable across each cycle.
96+
97+
Now that you’ve seen the distributed system in action, consider exploring different QoS settings, network conditions, or even adding a third node to expand the architecture further.
31.7 KB
Loading
2.93 MB
Loading

0 commit comments

Comments
 (0)