Skip to content

Commit 86f57ea

Browse files
authored
Merge pull request #12 from Zeroth-Robotics/runtime2
Runtime2
2 parents 6417227 + 56633c6 commit 86f57ea

37 files changed

+109
-8288
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ logs/
5151

5252
# artifacts
5353
artifacts/
54+
# Model artifacts directories in models/
55+
models/*_artifacts/
5456

5557
# gitlab-ci-local
5658
.gitlab-ci-local/

.gitlab-ci-local/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!.gitignore

.gitmodules

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
[submodule "runtime/firmware/duo-sdk"]
88
path = runtime/firmware/duo-sdk
99
url = https://github.com/milkv-duo/duo-sdk.git
10-
[submodule "runtime/models/tpu-mlir"]
11-
path = runtime/models/tpu-mlir
12-
url = https://github.com/milkv-duo/tpu-mlir
10+
[submodule "models/tpu-mlir"]
11+
path = models/tpu-mlir
12+
url = https://github.com/milkv-duo/tpu-mlir.git
File renamed without changes.

runtime/models/convert_model.sh renamed to models/convert_model.sh

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,22 @@
22

33
# Function to print usage
44
print_usage() {
5-
echo "Usage: MODEL_PATH=/path/to/your/model.pt [MODEL_SHAPE='1,615'] ./convert_model.sh [model_shape]"
6-
echo " MODEL_PATH: Path to your .pt model file (required)"
7-
echo " MODEL_SHAPE: Shape of the input tensor (optional, can be set as env var or command-line arg)"
8-
echo " Default is '1,615' if not specified"
5+
echo "Usage: $0 <model_path> [model_shape]"
6+
echo " <model_path>: Path to your .pt model file (required)"
7+
echo " [model_shape]: Shape of the input tensor (optional)"
8+
echo " Default is '1,615' if not specified"
99
}
1010

11-
# Check if MODEL_PATH is set
12-
if [ -z "$MODEL_PATH" ]; then
13-
echo "Error: MODEL_PATH environment variable is not set."
11+
# Check if at least one argument is provided
12+
if [ $# -lt 1 ]; then
13+
echo "Error: Model path is required."
1414
print_usage
1515
exit 1
1616
fi
1717

18-
# Set default model shape
19-
MODEL_SHAPE=${MODEL_SHAPE:-"1,615"}
20-
21-
# Override MODEL_SHAPE if provided as command-line argument
22-
if [ $# -eq 1 ]; then
23-
MODEL_SHAPE=$1
24-
fi
18+
# Set model path and shape
19+
MODEL_PATH="$1"
20+
MODEL_SHAPE="${2:-1,615}"
2521

2622
# Extract directory, filename, and name without extension
2723
MODEL_DIR=$(dirname "$MODEL_PATH")

models/ppo_standing.pt

1.85 MB
Binary file not shown.

models/ppo_walking.pt

1.85 MB
Binary file not shown.

runtime/.cargo/config.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ rustflags = [
66
"-L", "./firmware/sts3215",
77
"-L", "./firmware/tpu-sdk-sg200x/lib",
88
"-L", "./firmware/duo-sdk/rootfs/usr/lib",
9+
"-L", "./models/tpu-mlir/lib",
10+
"-Clink-arg=-Wl,-rpath,../models/tpu-mlir/lib",
11+
"-Clink-arg=-Wl,-rpath,./firmware/tpu-sdk-sg200x/lib",
12+
"-Clink-arg=-Wl,-rpath,./firmware/duo-sdk/rootfs/lib",
913
"-Clink-arg=-Wl,-rpath,./tpu-libs",
1014
"-Clink-arg=-Wl,-rpath,./sysroot/lib",
1115
"-Clink-arg=-Wl,-rpath,./sysroot/usr/lib",

runtime/README.md

Lines changed: 13 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,22 @@ If you're connecting via USB, use the following details:
3636
SSH:
3737
3838

39-
4. Download Required Artifacts
40-
Go to OpenLCH Artifacts and download the following:
41-
`runtime`
42-
`servo`
43-
`cviwrapper`
44-
45-
6. Transfer Files to the Target Device
46-
Run the following commands to copy the necessary files to your device:
47-
39+
4. Build Runtime
4840
```bash
49-
scp -O runtime [email protected]:/usr/local/bin/
50-
scp -O servo [email protected]:/usr/local/bin/
51-
scp -O cviwrapper [email protected]:/usr/local/bin/
41+
cargo check && gitlab-ci-local # check and build
42+
```
5243

44+
5. Transfer Files to the Target Device
45+
Find binaries in target/riscv64gc-unknown-linux-musl/release/
5346

47+
`scp -O target/riscv64gc-unknown-linux-musl/release/runtime $MILKV_IP:/usr/local/bin/`
48+
49+
Debug:
50+
Note that you cannot ping the device in Cursor editor terminal for some reason. Try:
51+
```bash
52+
ping 192.168.42.1
5453
```
54+
5555
6. Run the Application
5656
To run the servo setup, execute the following on the target device:
5757

@@ -61,27 +61,12 @@ To run the servo setup, execute the following on the target device:
6161
ls /usr/local/bin/
6262

6363
# Run your desired binary (example: runtime)
64-
sudo /usr/local/bin/runtime
65-
```
66-
67-
68-
69-
70-
```
71-
# Install docker / docker desktop
72-
brew install gitlab-ci-local
64+
/usr/local/bin/runtime
7365
```
7466

75-
### Build
7667

77-
```bash
78-
gitlab-ci-local --stage build-runtime
79-
```
8068

81-
Find binaries in target/riscv64gc-unknown-linux-musl/release/
8269

83-
### Copy to the milk-v board
84-
`scp -O target/riscv64gc-unknown-linux-musl/release/runtime $MILKV_IP:/usr/local/bin/`
8570

8671
If the board is connected over usb, ip is `192.168.42.1`
8772

0 commit comments

Comments
 (0)