Skip to content

Commit 77104d6

Browse files
committed
2 parents 936ec03 + b811941 commit 77104d6

60 files changed

Lines changed: 2195 additions & 3094 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.clang-format

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
BasedOnStyle: LLVM
2+
Language: Cpp
3+
Standard: c++17
4+
ColumnLimit: 120
5+
IndentWidth: 4
6+
ContinuationIndentWidth: 4
7+
TabWidth: 4
8+
UseTab: Never
9+
BreakBeforeBraces: Attach
10+
AllowShortFunctionsOnASingleLine: Inline
11+
AllowShortIfStatementsOnASingleLine: Never
12+
AllowShortLoopsOnASingleLine: false
13+
AlignConsecutiveAssignments:
14+
Enabled: true
15+
AcrossEmptyLines: false
16+
AcrossComments: false
17+
AlignCompound: false
18+
PadOperators: true
19+
PointerAlignment: Middle
20+
ReferenceAlignment: Middle
21+
SortIncludes: false

.github/workflows/checks.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Checks
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
pre-commit:
9+
name: Pre-commit
10+
runs-on: ubuntu-22.04
11+
steps:
12+
- uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 0
15+
16+
- uses: actions/setup-python@v5
17+
with:
18+
python-version: "3.10"
19+
20+
- name: Install checks
21+
run: python -m pip install pre-commit ruff clang-format
22+
23+
- name: Run checks
24+
run: pre-commit run --all-files --show-diff-on-failure

.pre-commit-config.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
repos:
2+
- repo: local
3+
hooks:
4+
- id: ruff-fatal
5+
name: ruff fatal checks
6+
entry: ruff check --select E9,F63,F7,F82
7+
language: system
8+
types_or: [python, pyi]
9+
exclude: ^third_party/
10+
11+
- id: clang-format
12+
name: clang-format
13+
entry: clang-format --dry-run --Werror
14+
language: system
15+
files: ^(src|robot_server|robot_client)/.*\.(c|cc|cpp|cxx|h|hpp)$

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,21 @@ cmake --build build --target model-cli model-server
2525
`VLACPP_BUILD_ROBOT_SERVER` is the only project-level build option. The build no
2626
longer registers CTest targets or the old `vlacpp` shared C ABI.
2727

28+
## Checks
29+
30+
Install and run the local checks with:
31+
32+
```sh
33+
python -m pip install pre-commit ruff clang-format
34+
pre-commit install
35+
pre-commit run --all-files
36+
```
37+
38+
The hook set follows the same shape as `llama.cpp`'s pre-commit setup, but is
39+
kept local and lightweight: Python fatal checks through `ruff`, and C/C++
40+
format checks through `clang-format`. GitHub Actions runs the same hooks on all
41+
tracked files in pushes and pull requests.
42+
2843
## SmolVLA Server
2944

3045
```sh

eval/lerobot_so101/README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
```
1212
eval/lerobot_so101/
13+
├── run_sync.py # 入口:ROBOT_PLATFORM -> SyncControlLoop
14+
├── sync_loop.py # observe -> predict -> act 循环
1315
├── so101_client.py # SO101RobotClient(BasePolicy 实现)
1416
├── utils/
1517
│ ├── robot.py # build_camera_config 等
@@ -18,10 +20,7 @@ eval/lerobot_so101/
1820
├── test/ # test_camera.py, run_camera_test.sh
1921
└── shell/ # so101_env.sh, run_robot_client.sh 等
2022
21-
robot_client/base_policy/
22-
├── run_sync.py # 入口:ROBOT_PLATFORM -> SyncControlLoop
23-
├── base.py # BasePolicy
24-
└── sync_loop.py # observe -> predict -> act 循环
23+
eval/base_platform.py # BasePolicy
2524
```
2625

2726
## 安装
@@ -51,7 +50,7 @@ pip install -e "eval/lerobot_so101/lerobot_camera_opencv_crop"
5150
| `MODEL_IMAGE_NAME` | 发给 model-server 的 image key(本 checkpoint 默认 `observation.images.camera1`|
5251
| `CAMERA_`* | 分辨率、backend、resize、warmup 等 |
5352
| `ROBOT_USE_DEGREES` | follower 关节单位(默认 degrees) |
54-
| `ROBOT_PLATFORM` | `base_policy` 平台(默认 `lerobot_so101``so101_client.py`|
53+
| `ROBOT_PLATFORM` | 平台选择(默认 `lerobot_so101``eval.lerobot_so101.so101_client`|
5554
| `SERVER` / `TASK` / `FPS` | vla.cpp TCP 推理 |
5655
| `DATASET_REPO_ID`| 录制数据集 |
5756

@@ -88,7 +87,7 @@ bash eval/lerobot_so101/shell/run_robot_client.sh
8887

8988
```bash
9089
source eval/lerobot_so101/shell/so101_env.sh
91-
python -m base_policy
90+
python -m eval.lerobot_so101.run_sync
9291
```
9392

9493
按键:**R** 回 home,**Q** 退出。
@@ -136,4 +135,3 @@ cd eval/lerobot_so101
136135
cd eval/lerobot_so101
137136
./shell/record_dataset.sh
138137
```
139-

eval/lerobot_so101/shell/so101_env.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ EOF
3636
fi
3737
export ROBOT_CAMERAS="${ROBOT_CAMERAS//$'\n'/}"
3838

39-
# --- Inference client (python -m base_policy) ---
39+
# --- Inference client (python -m eval.lerobot_so101.run_sync) ---
4040
export ROBOT_PLATFORM="lerobot_so101"
4141
export SERVER="${SERVER:-127.0.0.1:5555}"
4242
export TASK="${TASK:-grab the block.}"

eval/lerobot_so101/test/test_camera.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
from lerobot.cameras.utils import make_cameras_from_configs
2525
from lerobot.utils.import_utils import register_third_party_plugins
2626

27-
from utils.robot import build_camera_config
28-
from model_client import image_to_rgb_hwc_u8_bytes, state_to_list
27+
from eval.lerobot_so101.utils.robot import build_camera_config
28+
from robot_client.python.model_client import image_to_rgb_hwc_u8_bytes, state_to_list
2929

3030
# Default matches shell/run_robot_client.sh (camera1 + warmup_s).
3131
DEFAULT_ROBOT_CAMERAS = (

eval/libero/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,8 @@ stay last because it consumes the rest of the command line. The runner itself is
199199
model-agnostic; pi0-specific values appear only in this launch command. The
200200
optional `ROBOTCPP_BACKEND` environment override selects the server backend.
201201

202-
The reusable simulation policy and server lifecycle helpers live in
203-
`robot_client/base_policy/sim_policy.py`. The LIBERO client supplies only the
202+
The reusable base policy and server lifecycle helpers live in
203+
`robot_client/policy/base_policy.py`. The LIBERO client supplies only the
204204
LIBERO-specific request adapter, matching LeRobot LIBERO rollout input
205205
semantics:
206206

eval/libero/benchmark_model_server_policy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
from eval.libero.client import DEFAULT_IMAGE_KEYS, LiberoClient
1313
from eval.libero.utils import DEFAULT_RESULTS_DIR, timestamp, write_json
14-
from robot_client.base_policy.sim_policy import (
14+
from robot_client.policy.base_policy import (
1515
maybe_launch_server,
1616
parse_server_env,
1717
server_command,

eval/libero/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import numpy as np
88

9-
from robot_client.base_policy.sim_policy import SimPolicy
9+
from robot_client.policy.base_policy import BasePolicy
1010
from eval.libero.env import DEFAULT_LIBERO_CAMERA_KEYS
1111

1212

@@ -75,7 +75,7 @@ def build_libero_request(
7575
}
7676

7777

78-
class LiberoClient(SimPolicy):
78+
class LiberoClient(BasePolicy):
7979
"""LIBERO-specific model-server policy client."""
8080

8181
def __init__(

0 commit comments

Comments
 (0)