Skip to content

Commit 04c96b6

Browse files
committed
Update with single repo approach
1 parent fbf287c commit 04c96b6

5 files changed

Lines changed: 50 additions & 40 deletions

File tree

content/learning-paths/embedded-and-microcontrollers/device-connect-strands/_index.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ prerequisites:
2222
- Basic familiarity with Python virtual environments and command-line tools.
2323
- (Optional) A Raspberry Pi for testing a full infrastructure setup
2424

25-
author: Annie Tallund
25+
author:
26+
- Annie Tallund
27+
- Kavya Sri Chennoju
2628

2729

2830

content/learning-paths/embedded-and-microcontrollers/device-connect-strands/background.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,5 @@ By working through the remaining sections you will:
7373
- Optionally extend the setup to a Raspberry Pi connected over the network, discovering and commanding it from your laptop through the Device Connect infrastructure.
7474

7575
The next section covers the environment setup.
76+
77+
TODO: add links to the Strands Robots docs, mesh.md, pypi?,

content/learning-paths/embedded-and-microcontrollers/device-connect-strands/run-example.md

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ You will need two terminal windows open at the same time: one to keep the simula
2929
| Host or Target | 1 | Simulated robot — keep running throughout |
3030
| Host | 2 | Agent tool invocations |
3131

32-
Make sure you are in the workspace directory you created during setup and that your virtual environment is activated:
32+
Make sure you are in the repository directory and that your virtual environment is activated:
3333

3434
```bash
35-
cd ~/strands-device-connect
35+
cd ~/strands-device-connect/redacted
3636
source .venv/bin/activate
3737
```
3838

@@ -45,18 +45,21 @@ python <<'PY'
4545
import logging
4646
logging.basicConfig(level=logging.INFO)
4747
from strands_robots import Robot
48-
Robot('so100')
48+
r = Robot('so100')
49+
r.run()
4950
PY
5051
```
5152

52-
When the `Robot('so100')` object is created, the SDK downloads the MuJoCo physics model for the SO-100 arm (this download happens only on the first run and takes a minute or two), then starts the simulation and registers the robot on the Device Connect device mesh. The robot publishes a presence heartbeat every 0.5 seconds under a unique device ID, for example `so100_sim-abc123`.
53+
When the `Robot('so100')` object is created, the SDK downloads the MuJoCo physics model for the SO-100 arm (this download happens only on the first run and takes a minute or two), then starts the simulation and registers the robot on the Device Connect device mesh. The robot publishes a presence heartbeat every 0.5 seconds under a unique device ID, for example `so100-abc123`.
5354

5455
You should see INFO-level log output similar to:
5556

5657
```output
57-
INFO:strands_robots.mesh:Zenoh session started
58-
INFO:strands_robots.mesh:Peer ID: so100_sim-abc123
59-
INFO:strands_robots.mesh:Heartbeat thread started
58+
device_connect_sdk.device.so100-a3f1b2 - INFO - Using ZENOH messaging backend
59+
device_connect_sdk.device.so100-a3f1b2 - INFO - Connected to ZENOH broker: []
60+
device_connect_sdk.device.so100-a3f1b2 - INFO - Driver connected: strands_sim
61+
device_connect_sdk.device.so100-a3f1b2 - INFO - Subscribed to commands on device-connect.default.so100-abc123.cmd
62+
🤖 so100-abc123 is online. Ctrl+C to stop.
6063
```
6164

6265
Leave this process running. The simulated robot is only discoverable as long as this process is alive.
@@ -79,9 +82,9 @@ PY
7982
The output is similar to:
8083

8184
```output
82-
Found 2 robot(s):
83-
so100_sim-abc123 — idle
84-
so100_sim-def456 — idle
85+
Discovered 1 device(s):
86+
[robot] so100-lab-1 — idle
87+
Functions: execute, getFeatures, getStatus, reset, step, stop
8588
```
8689

8790
The peer ID (for example `so100_sim-abc123`) is assigned at startup and changes each run. Note the actual ID shown in your terminal - you will need it in the next step.
@@ -105,7 +108,8 @@ PY
105108
You will see the following output:
106109

107110
```output
108-
Result: {'success': True, 'result': {'status': 'success', 'content': [{'text': "🚀 Policy started on 'so100' (async)"}]}}
111+
-> so100-lab-1: pick up the cube
112+
{"status": "success", "content": [...]}
109113
```
110114

111115
{{% notice Robot output in terminal 1 %}}
@@ -158,7 +162,10 @@ if devices:
158162
'execute',
159163
{'instruction': 'pick up the cube', 'policy_provider': 'mock'},
160164
)
161-
print(f'Result: {result}')
165+
print(f'Execute result: {result}')
166+
167+
status = invoke_device(devices[0]['device_id'], 'getStatus')
168+
print(f'Status: {status}')
162169
PY
163170
```
164171

@@ -173,8 +180,9 @@ The output is similar to:
173180

174181
```output
175182
Found 1 robot(s):
176-
so100_sim-abc123
177-
Result: {'success': True, 'result': {'status': 'accepted'}}
183+
so100-lab-1 — idle
184+
Execute result: {'success': True, 'result': {'status': 'success', 'content': [...]}}
185+
Status: {'success': True, 'result': {...}} # full sim state dict
178186
```
179187

180188
## What you've accomplished and what's next

content/learning-paths/embedded-and-microcontrollers/device-connect-strands/run-infra-example.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ layout: learningpathall
1010

1111
The previous section ran entirely on a local network, with Device Connect handling device-to-device discovery automatically. That approach is fast and requires zero configuration, but it has natural limits: both the robot and the agent must be on the same LAN, device state is ephemeral, and there is no registry you can query by device type.
1212

13-
This section goes one step further. You will run the Zenoh router, an etcd state store, and a registry service on your machine using Docker, then connect a Raspberry Pi on the same network as the remote device. The agent running on your machine will discover the robot running on the Pi through the infrastructure, as if both were part of the same managed fleet. The Pi never needs to run Docker — it just needs Python and the packages from setup.
13+
This section goes one step further. You will run the Zenoh router, an etcd state store, and a registry service on your machine using Docker, then connect a Raspberry Pi on the same network as the remote device. You can use a different device as long as you can access it, but the Raspberry Pi will be used as an example. This device is also referred to as the target.
14+
15+
The agent running on your machine will discover the robot running on the Pi through the infrastructure, as if both were part of the same managed fleet. The Pi never needs to run Docker — it just needs Python and the packages from setup.
1416

1517
Confirm Docker and Docker Compose v2 are available on the host before continuing:
1618

@@ -19,6 +21,14 @@ docker --version
1921
docker compose version
2022
```
2123

24+
## Clone and bring up the Docker image
25+
26+
```bash
27+
cd ~/strands-device-connect
28+
git clone --depth 1 https://github.com/arm/device-connect.git
29+
30+
```
31+
2232
## Machine and terminal layout
2333

2434
This section involves two machines. Keep track of which commands run where:
@@ -36,6 +46,7 @@ In host terminal 1, bring up the Device Connect infrastructure stack. The Compos
3646
```bash
3747
cd ~/strands-device-connect/device-connect/packages/device-connect-server
3848
docker compose -f infra/docker-compose-dev.yml up -d
49+
cd ../../..
3950
```
4051

4152
Confirm the services are healthy:
@@ -71,7 +82,7 @@ Note the address returned — for the rest of this section it is referred to as
7182

7283
## Step 3 — Prepare the Raspberry Pi
7384

74-
On the Raspberry Pi, follow the same repository and environment setup from the setup section of this Learning Path: install Python 3.12, clone both repositories, create the virtual environment, and install the packages with the same editable install commands.
85+
On the Raspberry Pi, follow the same repository and environment setup from the setup section of this Learning Path: install Python 3.12, clone the `redacted` repository, create the virtual environment, and install the packages with the same editable install commands.
7586

7687
Once the environment is ready, export the three variables that tell the SDK to route traffic through the Device Connect router on your host rather than using local network discovery:
7788

@@ -92,7 +103,8 @@ python <<'PY'
92103
import logging
93104
logging.basicConfig(level=logging.INFO)
94105
from strands_robots import Robot
95-
Robot('so100')
106+
r = Robot('so100')
107+
r.run()
96108
PY
97109
```
98110

content/learning-paths/embedded-and-microcontrollers/device-connect-strands/setup.md

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,14 @@ git --version
1717

1818
These instructions are tested on Python 3.12. Earlier versions of Python 3 may work but are not validated against the `redacted-branch` branch used in this Learning Path.
1919

20-
## Clone the repositories
20+
## Clone the repository
2121

22-
You need two repositories. The `device-connect` contains the SDK and agent tools as local packages. The `redacted` repository contains the robot runtime and the `robot_mesh` Strands tool.
22+
The code run in this Learning Path sits in the `redacted` repository. It contains the robot runtime and the `robot_mesh` Strands tool.
2323

2424
```bash
25-
mkdir -p ~/strands-device-connect
26-
cd ~/strands-device-connect
27-
25+
mkdir ~/strands-device-connect
26+
cd strands-device-connect
2827
git clone https://github.com/redacted
29-
git clone https://github.com/arm/device-connect.git
30-
```
31-
32-
After cloning, your workspace should look like this:
33-
34-
```output
35-
~/strands-device-connect/
36-
├── device-connect/
37-
└── redacted/
3828
```
3929

4030
## Check out the integration branch
@@ -44,7 +34,7 @@ The Device Connect integration code for `redacted` lives on the `redacted-branch
4434
TODO: remove feature branch? replace redacted and redacted-branch
4535

4636
```bash
47-
cd redacted
37+
cd ~/strands-device-connect/redacted
4838
git checkout redacted-branch
4939
cd ..
5040
```
@@ -58,17 +48,13 @@ python3.12 -m venv .venv
5848
source .venv/bin/activate
5949
```
6050

61-
Now install the packages:
51+
Now install the packages and make sure they are available on your `PYTHONPATH` environment variable:
6252

6353
```bash
64-
pip install --upgrade pip setuptools wheel hatchling hatch-vcs
65-
pip install -e device-connect/packages/device-connect-sdk
66-
pip install -e "device-connect/packages/device-connect-agent-tools[strands]"
67-
pip install -e "redacted[sim]"
54+
pip install -e ".[sim]"
55+
export PYTHONPATH="$PWD:$PYTHONPATH"
6856
```
6957

70-
TODO: simplify commands?
71-
7258
## How discovery works — no configuration needed
7359

7460
The `strands-robots` SDK uses Device Connect's built-in device-to-device discovery: every `Robot()` instance announces itself on the local network at startup, and any process running `discover_devices()` or `robot_mesh(action='peers')` on the same network segment will find it automatically.

0 commit comments

Comments
 (0)