fly-ruler-ros2 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fly_ruler_ros2-0.1.0/.clang-format +4 -0
- fly_ruler_ros2-0.1.0/.devcontainer/devcontainer.json +41 -0
- fly_ruler_ros2-0.1.0/.devcontainer/setup.sh +39 -0
- fly_ruler_ros2-0.1.0/.github/workflows/ci.yml +113 -0
- fly_ruler_ros2-0.1.0/.github/workflows/release.yml +63 -0
- fly_ruler_ros2-0.1.0/.gitignore +15 -0
- fly_ruler_ros2-0.1.0/AGENTS.md +11 -0
- fly_ruler_ros2-0.1.0/LICENSE +21 -0
- fly_ruler_ros2-0.1.0/PKG-INFO +90 -0
- fly_ruler_ros2-0.1.0/README.md +74 -0
- fly_ruler_ros2-0.1.0/docker/Dockerfile +20 -0
- fly_ruler_ros2-0.1.0/docker/cross/toolchain.example.cmake +16 -0
- fly_ruler_ros2-0.1.0/docker-compose.yml +32 -0
- fly_ruler_ros2-0.1.0/docs/dev/01-architecture.md +35 -0
- fly_ruler_ros2-0.1.0/docs/dev/02-realtime-and-verification.md +45 -0
- fly_ruler_ros2-0.1.0/docs/guide/build.md +59 -0
- fly_ruler_ros2-0.1.0/docs/guide/configure.md +57 -0
- fly_ruler_ros2-0.1.0/docs/guide/deploy.md +76 -0
- fly_ruler_ros2-0.1.0/docs/guide/generate.md +67 -0
- fly_ruler_ros2-0.1.0/docs/guide/observe.md +52 -0
- fly_ruler_ros2-0.1.0/examples/README.md +18 -0
- fly_ruler_ros2-0.1.0/examples/deliver_saved_model.py +43 -0
- fly_ruler_ros2-0.1.0/examples/generate_model.py +59 -0
- fly_ruler_ros2-0.1.0/examples/initial.toml +23 -0
- fly_ruler_ros2-0.1.0/examples/observe_node.py +25 -0
- fly_ruler_ros2-0.1.0/examples/ros_controller.py +148 -0
- fly_ruler_ros2-0.1.0/itemark-records/README.md +5 -0
- fly_ruler_ros2-0.1.0/justfile +84 -0
- fly_ruler_ros2-0.1.0/pyproject.toml +77 -0
- fly_ruler_ros2-0.1.0/python/fly_ruler_ros2/__init__.py +5 -0
- fly_ruler_ros2-0.1.0/python/fly_ruler_ros2/_json_types.py +8 -0
- fly_ruler_ros2-0.1.0/python/fly_ruler_ros2/cli/__init__.py +25 -0
- fly_ruler_ros2-0.1.0/python/fly_ruler_ros2/cli/_common.py +52 -0
- fly_ruler_ros2-0.1.0/python/fly_ruler_ros2/cli/node.py +107 -0
- fly_ruler_ros2-0.1.0/python/fly_ruler_ros2/cli/project.py +310 -0
- fly_ruler_ros2-0.1.0/python/fly_ruler_ros2/client.py +189 -0
- fly_ruler_ros2-0.1.0/python/fly_ruler_ros2/delivery/__init__.py +20 -0
- fly_ruler_ros2-0.1.0/python/fly_ruler_ros2/delivery/_artifact.py +179 -0
- fly_ruler_ros2-0.1.0/python/fly_ruler_ros2/delivery/_build.py +297 -0
- fly_ruler_ros2-0.1.0/python/fly_ruler_ros2/delivery/_compose.py +78 -0
- fly_ruler_ros2-0.1.0/python/fly_ruler_ros2/delivery/_deploy.py +323 -0
- fly_ruler_ros2-0.1.0/python/fly_ruler_ros2/delivery/_generate.py +183 -0
- fly_ruler_ros2-0.1.0/python/fly_ruler_ros2/delivery/_manifest.py +143 -0
- fly_ruler_ros2-0.1.0/python/fly_ruler_ros2/delivery/_process.py +85 -0
- fly_ruler_ros2-0.1.0/python/fly_ruler_ros2/py.typed +0 -0
- fly_ruler_ros2-0.1.0/python/fly_ruler_ros2/templates/CMakeLists.txt.in +40 -0
- fly_ruler_ros2-0.1.0/python/fly_ruler_ros2/templates/README.md.in +19 -0
- fly_ruler_ros2-0.1.0/python/fly_ruler_ros2/templates/config/initial.toml.in +2 -0
- fly_ruler_ros2-0.1.0/python/fly_ruler_ros2/templates/include/@PACKAGE@/node.hpp.in +13 -0
- fly_ruler_ros2-0.1.0/python/fly_ruler_ros2/templates/launch/model.launch.py.in +40 -0
- fly_ruler_ros2-0.1.0/python/fly_ruler_ros2/templates/package.xml.in +13 -0
- fly_ruler_ros2-0.1.0/python/fly_ruler_ros2/templates/src/main.cpp.in +12 -0
- fly_ruler_ros2-0.1.0/python/fly_ruler_ros2/templates/src/model_node.cpp.in +4 -0
- fly_ruler_ros2-0.1.0/ros2/fly_ruler_ros2_interfaces/CMakeLists.txt +12 -0
- fly_ruler_ros2-0.1.0/ros2/fly_ruler_ros2_interfaces/msg/ModelInput.msg +9 -0
- fly_ruler_ros2-0.1.0/ros2/fly_ruler_ros2_interfaces/msg/ModelSample.msg +18 -0
- fly_ruler_ros2-0.1.0/ros2/fly_ruler_ros2_interfaces/package.xml +15 -0
- fly_ruler_ros2-0.1.0/ros2/fly_ruler_ros2_runtime/CMakeLists.txt +50 -0
- fly_ruler_ros2-0.1.0/ros2/fly_ruler_ros2_runtime/include/fly_ruler_ros2_runtime/detail/http_observer.hpp +33 -0
- fly_ruler_ros2-0.1.0/ros2/fly_ruler_ros2_runtime/include/fly_ruler_ros2_runtime/detail/latest_sample.hpp +52 -0
- fly_ruler_ros2-0.1.0/ros2/fly_ruler_ros2_runtime/include/fly_ruler_ros2_runtime/detail/publication.hpp +41 -0
- fly_ruler_ros2-0.1.0/ros2/fly_ruler_ros2_runtime/include/fly_ruler_ros2_runtime/detail/realtime.hpp +144 -0
- fly_ruler_ros2-0.1.0/ros2/fly_ruler_ros2_runtime/include/fly_ruler_ros2_runtime/detail/step_trace.hpp +104 -0
- fly_ruler_ros2-0.1.0/ros2/fly_ruler_ros2_runtime/include/fly_ruler_ros2_runtime/detail/step_wakeup.hpp +59 -0
- fly_ruler_ros2-0.1.0/ros2/fly_ruler_ros2_runtime/include/fly_ruler_ros2_runtime/model_node.hpp +1248 -0
- fly_ruler_ros2-0.1.0/ros2/fly_ruler_ros2_runtime/package.xml +25 -0
- fly_ruler_ros2-0.1.0/ros2/fly_ruler_ros2_runtime/src/http_observer.cpp +73 -0
- fly_ruler_ros2-0.1.0/ros2/fly_ruler_ros2_runtime/tests/test_latest_sample.cpp +37 -0
- fly_ruler_ros2-0.1.0/ros2/fly_ruler_ros2_runtime/tests/test_step_trace.cpp +131 -0
- fly_ruler_ros2-0.1.0/scripts/README.md +16 -0
- fly_ruler_ros2-0.1.0/scripts/preflight.sh +26 -0
- fly_ruler_ros2-0.1.0/scripts/validation/gtm/_support.py +411 -0
- fly_ruler_ros2-0.1.0/scripts/validation/gtm/prepare_gtm_baseline.py +83 -0
- fly_ruler_ros2-0.1.0/scripts/validation/gtm/probe_control_chain.py +163 -0
- fly_ruler_ros2-0.1.0/scripts/validation/gtm/run_gtm_baseline.py +150 -0
- fly_ruler_ros2-0.1.0/scripts/validation/gtm/run_gtm_realtime_container.sh +52 -0
- fly_ruler_ros2-0.1.0/scripts/validation/gtm/run_gtm_realtime_matrix.py +473 -0
- fly_ruler_ros2-0.1.0/scripts/version.py +87 -0
- fly_ruler_ros2-0.1.0/tests/README.md +15 -0
- fly_ruler_ros2-0.1.0/tests/client/test_observation.py +234 -0
- fly_ruler_ros2-0.1.0/tests/conftest.py +36 -0
- fly_ruler_ros2-0.1.0/tests/delivery/__init__.py +1 -0
- fly_ruler_ros2-0.1.0/tests/delivery/conftest.py +78 -0
- fly_ruler_ros2-0.1.0/tests/delivery/support.py +241 -0
- fly_ruler_ros2-0.1.0/tests/delivery/test_build_project.py +82 -0
- fly_ruler_ros2-0.1.0/tests/delivery/test_compose.py +161 -0
- fly_ruler_ros2-0.1.0/tests/delivery/test_deploy_artifact.py +100 -0
- fly_ruler_ros2-0.1.0/tests/delivery/test_generated_deployment.py +91 -0
- fly_ruler_ros2-0.1.0/tests/delivery/test_recovery.py +308 -0
- fly_ruler_ros2-0.1.0/tests/delivery/test_resources.py +131 -0
- fly_ruler_ros2-0.1.0/tests/device/README.md +31 -0
- fly_ruler_ros2-0.1.0/tests/device/__init__.py +1 -0
- fly_ruler_ros2-0.1.0/tests/device/support.py +150 -0
- fly_ruler_ros2-0.1.0/tests/device/test_bag_capture.py +82 -0
- fly_ruler_ros2-0.1.0/tests/device/test_cross_artifact.py +31 -0
- fly_ruler_ros2-0.1.0/tests/device/test_device_deploy.py +86 -0
- fly_ruler_ros2-0.1.0/tests/device/test_gtm_baseline.py +143 -0
- fly_ruler_ros2-0.1.0/tests/project/test_cli_native.py +182 -0
- fly_ruler_ros2-0.1.0/tests/project/test_generation.py +138 -0
- fly_ruler_ros2-0.1.0/tests/project/test_metadata.py +51 -0
- fly_ruler_ros2-0.1.0/tests/project/test_native.py +171 -0
- fly_ruler_ros2-0.1.0/tests/project/test_source_project.py +45 -0
- fly_ruler_ros2-0.1.0/tests/release/test_install.py +271 -0
- fly_ruler_ros2-0.1.0/tests/release/test_version.py +47 -0
- fly_ruler_ros2-0.1.0/tests/ros2/_container/deployment_probe.py +169 -0
- fly_ruler_ros2-0.1.0/tests/ros2/_container/feedback_probe.py +467 -0
- fly_ruler_ros2-0.1.0/tests/ros2/_container/installed_identity.py +42 -0
- fly_ruler_ros2-0.1.0/tests/ros2/test_cli_generation.py +63 -0
- fly_ruler_ros2-0.1.0/tests/ros2/test_colcon.py +137 -0
- fly_ruler_ros2-0.1.0/tests/ros2/test_installed_identity.py +73 -0
- fly_ruler_ros2-0.1.0/tests/runtime/README.md +15 -0
- fly_ruler_ros2-0.1.0/tests/runtime/__init__.py +1 -0
- fly_ruler_ros2-0.1.0/tests/runtime/_container/sampling_probe.py +149 -0
- fly_ruler_ros2-0.1.0/tests/runtime/test_sampling.py +78 -0
- fly_ruler_ros2-0.1.0/uv.lock +1056 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "FlyRuler ROS 2 Jazzy",
|
|
3
|
+
"dockerComposeFile": [
|
|
4
|
+
"../docker-compose.yml"
|
|
5
|
+
],
|
|
6
|
+
"service": "dev",
|
|
7
|
+
"workspaceFolder": "/workspace/FlyRuler/packages/fly_ruler_ros2",
|
|
8
|
+
"remoteUser": "ubuntu",
|
|
9
|
+
"updateRemoteUserUID": true,
|
|
10
|
+
"shutdownAction": "none",
|
|
11
|
+
"customizations": {
|
|
12
|
+
"vscode": {
|
|
13
|
+
"extensions": [
|
|
14
|
+
"ms-vscode.cpptools",
|
|
15
|
+
"ms-vscode.cmake-tools",
|
|
16
|
+
"tamasfe.even-better-toml",
|
|
17
|
+
"ms-python.python",
|
|
18
|
+
"ms-python.vscode-python-envs",
|
|
19
|
+
"ms-python.vscode-pylance",
|
|
20
|
+
"ms-python.debugpy",
|
|
21
|
+
"charliermarsh.ruff",
|
|
22
|
+
"samuelcolvin.jinjahtml",
|
|
23
|
+
"redhat.vscode-xml",
|
|
24
|
+
"yzhang.markdown-all-in-one",
|
|
25
|
+
"christian-kohler.path-intellisense",
|
|
26
|
+
"nefrob.vscode-just-syntax",
|
|
27
|
+
"Ranch-Hand-Robotics.rde-ros-2",
|
|
28
|
+
"mhutchie.git-graph"
|
|
29
|
+
],
|
|
30
|
+
"settings": {
|
|
31
|
+
"terminal.integrated.defaultProfile.linux": "bash",
|
|
32
|
+
"cmake.configureOnOpen": false,
|
|
33
|
+
"ROS2.distro": "jazzy",
|
|
34
|
+
"ROS2.rosSetupScript": "/opt/ros/jazzy/setup.bash",
|
|
35
|
+
"ROS2.showROS2WelcomeOnStartup": false,
|
|
36
|
+
"git.path": "/usr/bin/git"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"postCreateCommand": "bash .devcontainer/setup.sh"
|
|
41
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Build a container-native SDK environment and real IntelliSense commands.
|
|
3
|
+
set -eo pipefail
|
|
4
|
+
cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.."
|
|
5
|
+
source /opt/ros/jazzy/setup.bash
|
|
6
|
+
|
|
7
|
+
dev="$PWD/build/devcontainer"
|
|
8
|
+
venv="$dev/python"
|
|
9
|
+
if [[ ! -x "$venv/bin/python" ]]; then
|
|
10
|
+
/usr/bin/python3 -m venv --system-site-packages "$venv"
|
|
11
|
+
fi
|
|
12
|
+
python="$venv/bin/python"
|
|
13
|
+
"$python" -m pip install --disable-pip-version-check 'pip>=25.1'
|
|
14
|
+
"$python" -m pip install --disable-pip-version-check --group dev -e '.[export]'
|
|
15
|
+
|
|
16
|
+
# Regenerate only the project owned by this bootstrap, never a user workspace.
|
|
17
|
+
project=$(mktemp -d "$dev/model.XXXXXX")
|
|
18
|
+
trap 'rm -rf -- "$project"' EXIT
|
|
19
|
+
"$python" examples/generate_model.py --output "$project" --package-name flyruler_dev_model
|
|
20
|
+
if [[ -d "$dev/model" ]]; then
|
|
21
|
+
rm -rf -- "$dev/model"
|
|
22
|
+
fi
|
|
23
|
+
mv -- "$project" "$dev/model"
|
|
24
|
+
|
|
25
|
+
colcon --log-base "$dev/log" build --base-paths ros2 "$dev/model" \
|
|
26
|
+
--build-base "$dev/build" --install-base "$dev/install" --merge-install \
|
|
27
|
+
--packages-up-to flyruler_dev_model \
|
|
28
|
+
--cmake-args -DFR_BUILD_ROS_NODE=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
|
|
29
|
+
-DPython3_EXECUTABLE=/usr/bin/python3
|
|
30
|
+
|
|
31
|
+
# Editors and debugger sessions need import paths even without an interactive shell.
|
|
32
|
+
site="$("$python" -c 'import sysconfig; print(sysconfig.get_path("purelib"))')"
|
|
33
|
+
printf '%s\n' /opt/ros/jazzy/lib/python3.12/site-packages \
|
|
34
|
+
"$dev/install/lib/python3.12/site-packages" > "$site/flyruler-ros.pth"
|
|
35
|
+
|
|
36
|
+
# Preserve the loader environment for VS Code debug/run, which may not source Bash.
|
|
37
|
+
source "$dev/install/local_setup.bash"
|
|
38
|
+
printf 'LD_LIBRARY_PATH=%s\nAMENT_PREFIX_PATH=%s\nPYTHONPATH=%s\n' \
|
|
39
|
+
"$LD_LIBRARY_PATH" "$AMENT_PREFIX_PATH" "$PYTHONPATH" > "$dev/ros.env"
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
pull_request:
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
inputs:
|
|
8
|
+
run_ros2:
|
|
9
|
+
description: Build the repository Jazzy image and run real colcon acceptance
|
|
10
|
+
required: true
|
|
11
|
+
type: boolean
|
|
12
|
+
default: false
|
|
13
|
+
core_ref:
|
|
14
|
+
description: FlyRuler core branch, tag, or commit to test against
|
|
15
|
+
required: true
|
|
16
|
+
type: string
|
|
17
|
+
default: main
|
|
18
|
+
|
|
19
|
+
permissions:
|
|
20
|
+
contents: read
|
|
21
|
+
|
|
22
|
+
jobs:
|
|
23
|
+
python-native:
|
|
24
|
+
name: Python and native acceptance
|
|
25
|
+
runs-on: ubuntu-24.04
|
|
26
|
+
steps:
|
|
27
|
+
- name: Check out ROS 2 package
|
|
28
|
+
uses: actions/checkout@v4
|
|
29
|
+
with:
|
|
30
|
+
path: packages/fly_ruler_ros2
|
|
31
|
+
|
|
32
|
+
- name: Check out matching FlyRuler core
|
|
33
|
+
uses: actions/checkout@v4
|
|
34
|
+
with:
|
|
35
|
+
repository: WindLX/FlyRuler
|
|
36
|
+
ref: ${{ inputs.core_ref || 'main' }}
|
|
37
|
+
path: workspace-core
|
|
38
|
+
|
|
39
|
+
- name: Install just
|
|
40
|
+
uses: extractions/setup-just@v4
|
|
41
|
+
|
|
42
|
+
- name: Install uv
|
|
43
|
+
uses: astral-sh/setup-uv@v6
|
|
44
|
+
with:
|
|
45
|
+
enable-cache: true
|
|
46
|
+
|
|
47
|
+
- name: Set up Python 3.12
|
|
48
|
+
uses: actions/setup-python@v5
|
|
49
|
+
with:
|
|
50
|
+
python-version: "3.12"
|
|
51
|
+
|
|
52
|
+
- name: Install Rust stable toolchain
|
|
53
|
+
uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
54
|
+
|
|
55
|
+
- name: Install local core and package
|
|
56
|
+
working-directory: packages/fly_ruler_ros2
|
|
57
|
+
run: just setup ../../workspace-core/packages/fly_ruler
|
|
58
|
+
|
|
59
|
+
- name: Check Python sources and types
|
|
60
|
+
working-directory: packages/fly_ruler_ros2
|
|
61
|
+
run: just check
|
|
62
|
+
|
|
63
|
+
- name: Run project and real native acceptance
|
|
64
|
+
working-directory: packages/fly_ruler_ros2
|
|
65
|
+
run: just test project
|
|
66
|
+
|
|
67
|
+
- name: Build Python wheel and source distribution
|
|
68
|
+
working-directory: packages/fly_ruler_ros2
|
|
69
|
+
run: just build
|
|
70
|
+
|
|
71
|
+
ros2-colcon-manual:
|
|
72
|
+
name: Manual ROS 2 Jazzy colcon acceptance
|
|
73
|
+
if: github.event_name == 'workflow_dispatch' && inputs.run_ros2
|
|
74
|
+
runs-on: ubuntu-24.04
|
|
75
|
+
steps:
|
|
76
|
+
- name: Check out ROS 2 package
|
|
77
|
+
uses: actions/checkout@v4
|
|
78
|
+
with:
|
|
79
|
+
path: packages/fly_ruler_ros2
|
|
80
|
+
|
|
81
|
+
- name: Check out matching FlyRuler core
|
|
82
|
+
uses: actions/checkout@v4
|
|
83
|
+
with:
|
|
84
|
+
repository: WindLX/FlyRuler
|
|
85
|
+
ref: ${{ inputs.core_ref || 'main' }}
|
|
86
|
+
path: workspace-core
|
|
87
|
+
|
|
88
|
+
- name: Install just
|
|
89
|
+
uses: extractions/setup-just@v4
|
|
90
|
+
|
|
91
|
+
- name: Install uv
|
|
92
|
+
uses: astral-sh/setup-uv@v6
|
|
93
|
+
with:
|
|
94
|
+
enable-cache: true
|
|
95
|
+
|
|
96
|
+
- name: Set up Python 3.12
|
|
97
|
+
uses: actions/setup-python@v5
|
|
98
|
+
with:
|
|
99
|
+
python-version: "3.12"
|
|
100
|
+
|
|
101
|
+
- name: Install Rust stable toolchain
|
|
102
|
+
uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
103
|
+
|
|
104
|
+
- name: Install local core and package
|
|
105
|
+
working-directory: packages/fly_ruler_ros2
|
|
106
|
+
run: just setup ../../workspace-core/packages/fly_ruler
|
|
107
|
+
|
|
108
|
+
- name: Build the repository Jazzy test image
|
|
109
|
+
run: docker build -f packages/fly_ruler_ros2/docker/Dockerfile -t fr-ros2-dev:jazzy packages/fly_ruler_ros2
|
|
110
|
+
|
|
111
|
+
- name: Run real ROS 2 colcon acceptance
|
|
112
|
+
working-directory: packages/fly_ruler_ros2
|
|
113
|
+
run: FR_ROS2_TEST_IMAGE=fr-ros2-dev:jazzy just test ros2
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
name: Release to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
# The first release is published locally.
|
|
8
|
+
- "!v0.1.0"
|
|
9
|
+
workflow_dispatch:
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
build:
|
|
16
|
+
runs-on: ubuntu-24.04
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
- uses: extractions/setup-just@v4
|
|
20
|
+
- uses: astral-sh/setup-uv@v6
|
|
21
|
+
- uses: actions/setup-python@v5
|
|
22
|
+
with:
|
|
23
|
+
python-version: "3.12"
|
|
24
|
+
- name: Check tag and SDK versions
|
|
25
|
+
shell: bash
|
|
26
|
+
run: |
|
|
27
|
+
just _check-version
|
|
28
|
+
if [[ "$GITHUB_REF_TYPE" == tag ]]; then
|
|
29
|
+
version=$(uv version --short)
|
|
30
|
+
if [[ "$GITHUB_REF_NAME" != "v$version" ]]; then
|
|
31
|
+
echo "::error::Tag $GITHUB_REF_NAME does not match SDK version $version"
|
|
32
|
+
exit 1
|
|
33
|
+
fi
|
|
34
|
+
fi
|
|
35
|
+
- name: Install locked dependencies
|
|
36
|
+
run: uv sync --locked --extra export --python 3.12
|
|
37
|
+
- name: Check, test and build
|
|
38
|
+
run: just pre-commit
|
|
39
|
+
- name: Verify wheel installation and version updates
|
|
40
|
+
run: just test release
|
|
41
|
+
- uses: actions/upload-artifact@v4
|
|
42
|
+
with:
|
|
43
|
+
name: pypi-distributions
|
|
44
|
+
path: |
|
|
45
|
+
dist/*.whl
|
|
46
|
+
dist/*.tar.gz
|
|
47
|
+
if-no-files-found: error
|
|
48
|
+
|
|
49
|
+
publish:
|
|
50
|
+
if: github.event_name == 'push' && github.ref_type == 'tag'
|
|
51
|
+
needs: build
|
|
52
|
+
runs-on: ubuntu-24.04
|
|
53
|
+
environment:
|
|
54
|
+
name: pypi
|
|
55
|
+
url: https://pypi.org/project/fly-ruler-ros2/
|
|
56
|
+
permissions:
|
|
57
|
+
id-token: write
|
|
58
|
+
steps:
|
|
59
|
+
- uses: actions/download-artifact@v4
|
|
60
|
+
with:
|
|
61
|
+
name: pypi-distributions
|
|
62
|
+
path: dist
|
|
63
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
.venv/
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
.pytest_cache/
|
|
5
|
+
.mypy_cache/
|
|
6
|
+
.ruff_cache/
|
|
7
|
+
*.egg-info/
|
|
8
|
+
dist/
|
|
9
|
+
build/
|
|
10
|
+
install/
|
|
11
|
+
log/
|
|
12
|
+
|
|
13
|
+
# C/C++ IntelliSense stores machine-local symbols here while VS Code is open.
|
|
14
|
+
.vscode/browse.vc.db*
|
|
15
|
+
.vscode/ipch/
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# fly_ruler_ros2
|
|
2
|
+
|
|
3
|
+
将 FlyRuler core 导出的 native 模型装配为 ROS 2 工程,提供 Python 生成工具和节点管理入口。
|
|
4
|
+
|
|
5
|
+
## 本目录特有边界
|
|
6
|
+
|
|
7
|
+
- **必须**:模型编译、C++ wrapper、积分器和变量布局复用 `fly_ruler_core` 的公开接口;core 缺少通用能力时在 core 补充,不复制到本仓。
|
|
8
|
+
- **约定**:生成目录的 `native/` 是 core `CppTarget` 工程;本仓只装配 ROS 2 层和部署说明。
|
|
9
|
+
- **约定**:Python 工程生成测试不依赖 ROS 2;真实节点测试使用已安装并 source 的 ROS 2 环境,另设显式入口。
|
|
10
|
+
- **约定**:包版本唯一来源是 `pyproject.toml`;通过 `just set-version` 更新,运行时读取发行元数据。
|
|
11
|
+
- **约定**:正式用户、开发者和 API 文档由 FlyRuler 顶层文档工程发布;子仓 README 只保留起步和维护入口。
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 windlx
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: fly-ruler-ros2
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: FlyRuler ROS2 节点封装与命令行工具
|
|
5
|
+
Project-URL: Source, https://github.com/WindLX/fly_ruler_ros2
|
|
6
|
+
Project-URL: Issues, https://github.com/WindLX/fly_ruler_ros2/issues
|
|
7
|
+
Author: windlx
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Python: >=3.12
|
|
11
|
+
Requires-Dist: pydantic<3,>=2.14
|
|
12
|
+
Requires-Dist: typer>=0.27.2
|
|
13
|
+
Provides-Extra: export
|
|
14
|
+
Requires-Dist: fly-ruler>=0.3.4; extra == 'export'
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
|
|
17
|
+
# fly-ruler-ros2
|
|
18
|
+
|
|
19
|
+
将 FlyRuler 模型装配为 **ROS 2 Jazzy** 工程与生命周期节点,通过 ROS 话题交换控制输入与状态反馈,并提供轻量的只读 HTTP 观测与跨环境交付工具。
|
|
20
|
+
|
|
21
|
+
- **用户文档**:`docs/guide/`(或 FlyRuler 文档站的[ROS 2 用户手册](https://github.com/WindLX/FlyRuler/blob/main/docs/guide/components/ros2.md))
|
|
22
|
+
- **开发者文档**:`docs/dev/`(或[ROS 2 开发者入口](https://github.com/WindLX/FlyRuler/blob/main/docs/dev/components/ros2.md))
|
|
23
|
+
- **可运行示例**:[examples/README.md](examples/README.md) · **事项追踪**:[itemark-records/README.md](itemark-records/README.md)
|
|
24
|
+
|
|
25
|
+
## 安装
|
|
26
|
+
|
|
27
|
+
需要 **Python 3.12+**,按使用场景选择安装方式:
|
|
28
|
+
|
|
29
|
+
| 场景 | 安装命令 | 说明 |
|
|
30
|
+
| --- | --- | --- |
|
|
31
|
+
| **生成、构建与交付模型工程** | `pip install 'fly-ruler-ros2[export]'` | 引入 `fly-ruler>=0.3.4`,宿主机无需安装 ROS 2 |
|
|
32
|
+
| **仅部署产物或查询运行中节点** | `pip install fly-ruler-ros2` | 轻量客户端,不依赖 `fly_ruler_core` 或 ROS 2 |
|
|
33
|
+
|
|
34
|
+
安装后验证 CLI 入口:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
fr_ros2 --help
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## 快速概览:从模型到运行节点
|
|
41
|
+
|
|
42
|
+
1. **生成源码包**:`python examples/generate_model.py --output build/first_order_node`(或 `fr_ros2 project generate`)将 `ModelProgram`、`CasADi TargetProgram` 或 C++ `SourceProject` 装配为 ROS 2 包。
|
|
43
|
+
2. **构建节点**:`fr_ros2 project build --build-node`(通过 Docker 或本地 Jazzy `colcon`)编译出 `model_node` 与运行器。
|
|
44
|
+
3. **配置与激活**:通过 `ros2 launch` 启动后,用 `ros2 lifecycle` 加载 `initial.toml` 完成 `configure` → `activate`。
|
|
45
|
+
4. **通信与观测**:通过 ROS 话题(`~/command`、`~/feedback`、`~/model_metadata`)闭环控制与录包,或用 `fr_ros2 node state --url http://127.0.0.1:18004` 只读查询状态。
|
|
46
|
+
5. **一键交付与跨机部署**:`fr_ros2 project deploy` 支持本地、SSH 与 Docker/ARM64 部署;`fr_ros2 project deliver` 可将生成、构建与部署串联执行。
|
|
47
|
+
|
|
48
|
+
完整分步教程见 [docs/guide/generate.md](docs/guide/generate.md) ~ [docs/guide/deploy.md](docs/guide/deploy.md)。
|
|
49
|
+
|
|
50
|
+
## 仓库结构
|
|
51
|
+
|
|
52
|
+
| 路径 | 说明 |
|
|
53
|
+
| --- | --- |
|
|
54
|
+
| `python/fly_ruler_ros2/delivery/` | 工程生成、colcon/Docker 构建、部署与一键交付接口 |
|
|
55
|
+
| `python/fly_ruler_ros2/cli/` | `fr_ros2 project` 与 `fr_ros2 node` 命令行实现 |
|
|
56
|
+
| `python/fly_ruler_ros2/client.py` | 不依赖 core/ROS 的只读 HTTP 客户端 |
|
|
57
|
+
| `python/fly_ruler_ros2/templates/` | ROS 2 节点包模板(CMake、C++ 包装、launch 与 TOML) |
|
|
58
|
+
| `ros2/` | 共享 ROS 2 包:`fly_ruler_ros2_runtime` 与 `fly_ruler_ros2_interfaces` |
|
|
59
|
+
| `examples/` | 一阶模型生成、已保存模型交付、控制器与观测示例 |
|
|
60
|
+
| `docs/` | ROS 2 用户手册与开发者手册事实源(由顶层 FlyRuler 文档站挂载发布) |
|
|
61
|
+
| `tests/` | 分组测试套件,说明见 [tests/README.md](tests/README.md) |
|
|
62
|
+
|
|
63
|
+
## 开发与测试
|
|
64
|
+
|
|
65
|
+
在 FlyRuler 工作区进入本目录运行:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
cd packages/fly_ruler_ros2
|
|
69
|
+
just setup ../fly_ruler # 初始化 .venv 并安装本地 core 与 [export]
|
|
70
|
+
just check # ruff + mypy 静态检查
|
|
71
|
+
just test # 运行无需 ROS 的 project 与 client 测试
|
|
72
|
+
FR_ROS2_TEST_IMAGE=fr-ros2-dev:jazzy just test ros2 # 在 Jazzy 镜像中验证真实 ROS 包构建
|
|
73
|
+
just pre-commit # 依次执行 check、test 与 uv build
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
更多测试分组(`delivery`、`runtime`、`device`、`release`)见 [tests/README.md](tests/README.md) 与 [justfile](justfile)。
|
|
77
|
+
|
|
78
|
+
`just fmt` 使用 Ruff 和 clang-format 18;宿主未安装 clang-format 18 时使用一次性的 Jazzy Compose 容器,不需要先打开 VS Code 开发容器。
|
|
79
|
+
|
|
80
|
+
### SDK 版本
|
|
81
|
+
|
|
82
|
+
`just version` 查看当前版本。运行 `just set-version 0.2.0 --dry-run` 预览,去掉 `--dry-run` 后同步 Python 包、`uv.lock` 与随 SDK 交付的 runtime 和 interfaces 两个 ROS 包。该命令不重装当前环境,也不改上游 FlyRuler 依赖或生成的模型包版本。`just check` 会检查这四处版本是否一致。
|
|
83
|
+
|
|
84
|
+
后续版本标签 `vX.Y.Z` 触发 [PyPI 发布工作流](.github/workflows/release.yml);手动运行工作流只构建和验收,不上传。`v0.1.0` 走本地手动发布。自动上传前,在 GitHub 创建 `pypi` Environment,并在 PyPI 将 `WindLX/fly_ruler_ros2`、`release.yml`、`pypi` 登记为该项目的 Trusted Publisher(无需长期令牌)。
|
|
85
|
+
|
|
86
|
+
### VS Code 开发容器
|
|
87
|
+
|
|
88
|
+
1. 在 VS Code 中打开本目录,运行 **Dev Containers: Reopen in Container**(基于 ROS 2 Jazzy + Python 3.12,解释器位于 `build/devcontainer/python/bin/python`)。
|
|
89
|
+
2. 容器内运行 ROS 命令前,先加载 `/opt/ros/jazzy/setup.bash` 与 `build/devcontainer/install/local_setup.bash`。
|
|
90
|
+
3. 如需在已有容器内重建环境,在仓库根目录执行 `bash .devcontainer/setup.sh` 并重新加载窗口。
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# fly-ruler-ros2
|
|
2
|
+
|
|
3
|
+
将 FlyRuler 模型装配为 **ROS 2 Jazzy** 工程与生命周期节点,通过 ROS 话题交换控制输入与状态反馈,并提供轻量的只读 HTTP 观测与跨环境交付工具。
|
|
4
|
+
|
|
5
|
+
- **用户文档**:`docs/guide/`(或 FlyRuler 文档站的[ROS 2 用户手册](https://github.com/WindLX/FlyRuler/blob/main/docs/guide/components/ros2.md))
|
|
6
|
+
- **开发者文档**:`docs/dev/`(或[ROS 2 开发者入口](https://github.com/WindLX/FlyRuler/blob/main/docs/dev/components/ros2.md))
|
|
7
|
+
- **可运行示例**:[examples/README.md](examples/README.md) · **事项追踪**:[itemark-records/README.md](itemark-records/README.md)
|
|
8
|
+
|
|
9
|
+
## 安装
|
|
10
|
+
|
|
11
|
+
需要 **Python 3.12+**,按使用场景选择安装方式:
|
|
12
|
+
|
|
13
|
+
| 场景 | 安装命令 | 说明 |
|
|
14
|
+
| --- | --- | --- |
|
|
15
|
+
| **生成、构建与交付模型工程** | `pip install 'fly-ruler-ros2[export]'` | 引入 `fly-ruler>=0.3.4`,宿主机无需安装 ROS 2 |
|
|
16
|
+
| **仅部署产物或查询运行中节点** | `pip install fly-ruler-ros2` | 轻量客户端,不依赖 `fly_ruler_core` 或 ROS 2 |
|
|
17
|
+
|
|
18
|
+
安装后验证 CLI 入口:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
fr_ros2 --help
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## 快速概览:从模型到运行节点
|
|
25
|
+
|
|
26
|
+
1. **生成源码包**:`python examples/generate_model.py --output build/first_order_node`(或 `fr_ros2 project generate`)将 `ModelProgram`、`CasADi TargetProgram` 或 C++ `SourceProject` 装配为 ROS 2 包。
|
|
27
|
+
2. **构建节点**:`fr_ros2 project build --build-node`(通过 Docker 或本地 Jazzy `colcon`)编译出 `model_node` 与运行器。
|
|
28
|
+
3. **配置与激活**:通过 `ros2 launch` 启动后,用 `ros2 lifecycle` 加载 `initial.toml` 完成 `configure` → `activate`。
|
|
29
|
+
4. **通信与观测**:通过 ROS 话题(`~/command`、`~/feedback`、`~/model_metadata`)闭环控制与录包,或用 `fr_ros2 node state --url http://127.0.0.1:18004` 只读查询状态。
|
|
30
|
+
5. **一键交付与跨机部署**:`fr_ros2 project deploy` 支持本地、SSH 与 Docker/ARM64 部署;`fr_ros2 project deliver` 可将生成、构建与部署串联执行。
|
|
31
|
+
|
|
32
|
+
完整分步教程见 [docs/guide/generate.md](docs/guide/generate.md) ~ [docs/guide/deploy.md](docs/guide/deploy.md)。
|
|
33
|
+
|
|
34
|
+
## 仓库结构
|
|
35
|
+
|
|
36
|
+
| 路径 | 说明 |
|
|
37
|
+
| --- | --- |
|
|
38
|
+
| `python/fly_ruler_ros2/delivery/` | 工程生成、colcon/Docker 构建、部署与一键交付接口 |
|
|
39
|
+
| `python/fly_ruler_ros2/cli/` | `fr_ros2 project` 与 `fr_ros2 node` 命令行实现 |
|
|
40
|
+
| `python/fly_ruler_ros2/client.py` | 不依赖 core/ROS 的只读 HTTP 客户端 |
|
|
41
|
+
| `python/fly_ruler_ros2/templates/` | ROS 2 节点包模板(CMake、C++ 包装、launch 与 TOML) |
|
|
42
|
+
| `ros2/` | 共享 ROS 2 包:`fly_ruler_ros2_runtime` 与 `fly_ruler_ros2_interfaces` |
|
|
43
|
+
| `examples/` | 一阶模型生成、已保存模型交付、控制器与观测示例 |
|
|
44
|
+
| `docs/` | ROS 2 用户手册与开发者手册事实源(由顶层 FlyRuler 文档站挂载发布) |
|
|
45
|
+
| `tests/` | 分组测试套件,说明见 [tests/README.md](tests/README.md) |
|
|
46
|
+
|
|
47
|
+
## 开发与测试
|
|
48
|
+
|
|
49
|
+
在 FlyRuler 工作区进入本目录运行:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
cd packages/fly_ruler_ros2
|
|
53
|
+
just setup ../fly_ruler # 初始化 .venv 并安装本地 core 与 [export]
|
|
54
|
+
just check # ruff + mypy 静态检查
|
|
55
|
+
just test # 运行无需 ROS 的 project 与 client 测试
|
|
56
|
+
FR_ROS2_TEST_IMAGE=fr-ros2-dev:jazzy just test ros2 # 在 Jazzy 镜像中验证真实 ROS 包构建
|
|
57
|
+
just pre-commit # 依次执行 check、test 与 uv build
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
更多测试分组(`delivery`、`runtime`、`device`、`release`)见 [tests/README.md](tests/README.md) 与 [justfile](justfile)。
|
|
61
|
+
|
|
62
|
+
`just fmt` 使用 Ruff 和 clang-format 18;宿主未安装 clang-format 18 时使用一次性的 Jazzy Compose 容器,不需要先打开 VS Code 开发容器。
|
|
63
|
+
|
|
64
|
+
### SDK 版本
|
|
65
|
+
|
|
66
|
+
`just version` 查看当前版本。运行 `just set-version 0.2.0 --dry-run` 预览,去掉 `--dry-run` 后同步 Python 包、`uv.lock` 与随 SDK 交付的 runtime 和 interfaces 两个 ROS 包。该命令不重装当前环境,也不改上游 FlyRuler 依赖或生成的模型包版本。`just check` 会检查这四处版本是否一致。
|
|
67
|
+
|
|
68
|
+
后续版本标签 `vX.Y.Z` 触发 [PyPI 发布工作流](.github/workflows/release.yml);手动运行工作流只构建和验收,不上传。`v0.1.0` 走本地手动发布。自动上传前,在 GitHub 创建 `pypi` Environment,并在 PyPI 将 `WindLX/fly_ruler_ros2`、`release.yml`、`pypi` 登记为该项目的 Trusted Publisher(无需长期令牌)。
|
|
69
|
+
|
|
70
|
+
### VS Code 开发容器
|
|
71
|
+
|
|
72
|
+
1. 在 VS Code 中打开本目录,运行 **Dev Containers: Reopen in Container**(基于 ROS 2 Jazzy + Python 3.12,解释器位于 `build/devcontainer/python/bin/python`)。
|
|
73
|
+
2. 容器内运行 ROS 命令前,先加载 `/opt/ros/jazzy/setup.bash` 与 `build/devcontainer/install/local_setup.bash`。
|
|
74
|
+
3. 如需在已有容器内重建环境,在仓库根目录执行 `bash .devcontainer/setup.sh` 并重新加载窗口。
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
FROM ros:jazzy-ros-base-noble
|
|
2
|
+
|
|
3
|
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
4
|
+
build-essential cmake ninja-build clang-format gdb git openssh-client ca-certificates vim python3-venv htop \
|
|
5
|
+
libtomlplusplus-dev nlohmann-json3-dev libssl-dev libcpp-httplib-dev pkg-config \
|
|
6
|
+
ros-jazzy-demo-nodes-cpp ros-jazzy-demo-nodes-py \
|
|
7
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
8
|
+
|
|
9
|
+
# CLI 与 VS Code 使用同一个具名用户;Linux bind mount 按宿主 UID/GID 写入。
|
|
10
|
+
ARG USER_UID=1000
|
|
11
|
+
ARG USER_GID=1000
|
|
12
|
+
RUN groupmod --gid "$USER_GID" ubuntu \
|
|
13
|
+
&& usermod --uid "$USER_UID" --gid "$USER_GID" ubuntu \
|
|
14
|
+
&& chown -R ubuntu:ubuntu /home/ubuntu \
|
|
15
|
+
&& install -d -o ubuntu -g ubuntu /home/ubuntu/.vscode-server
|
|
16
|
+
|
|
17
|
+
WORKDIR /workspace
|
|
18
|
+
# 交互式 Bash 加载 ROS underlay;安装模型后显式 source 对应 overlay。
|
|
19
|
+
RUN printf '%s\n' 'source /opt/ros/jazzy/setup.bash' >> /etc/bash.bashrc
|
|
20
|
+
CMD ["bash"]
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# 配置练习模板:用户提供匹配 Ubuntu 24.04/Jazzy ARM64 的 sysroot。
|
|
2
|
+
# 不能靠此文件单独补齐 target ROS 或 host rosidl 工具。
|
|
3
|
+
set(CMAKE_SYSTEM_NAME Linux)
|
|
4
|
+
set(CMAKE_SYSTEM_PROCESSOR aarch64)
|
|
5
|
+
|
|
6
|
+
if(NOT DEFINED ENV{FR_SYSROOT})
|
|
7
|
+
message(FATAL_ERROR "Set FR_SYSROOT to the target sysroot inside the build container")
|
|
8
|
+
endif()
|
|
9
|
+
set(CMAKE_SYSROOT "$ENV{FR_SYSROOT}")
|
|
10
|
+
set(CMAKE_FIND_ROOT_PATH "${CMAKE_SYSROOT}")
|
|
11
|
+
set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc)
|
|
12
|
+
set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++)
|
|
13
|
+
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
|
14
|
+
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
|
15
|
+
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
|
16
|
+
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
services:
|
|
2
|
+
dev:
|
|
3
|
+
build:
|
|
4
|
+
context: ./docker
|
|
5
|
+
dockerfile: Dockerfile
|
|
6
|
+
args:
|
|
7
|
+
USER_UID: "${HOST_UID:-1000}"
|
|
8
|
+
USER_GID: "${HOST_GID:-1000}"
|
|
9
|
+
image: fr-ros2-workspace:jazzy
|
|
10
|
+
init: true
|
|
11
|
+
user: ubuntu
|
|
12
|
+
environment:
|
|
13
|
+
HOME: /home/ubuntu
|
|
14
|
+
ROS_DOMAIN_ID: "${ROS_DOMAIN_ID:-43}"
|
|
15
|
+
working_dir: /workspace/FlyRuler/packages/fly_ruler_ros2
|
|
16
|
+
volumes:
|
|
17
|
+
- type: bind
|
|
18
|
+
source: .
|
|
19
|
+
target: /workspace/FlyRuler/packages/fly_ruler_ros2
|
|
20
|
+
# 保留子模块 .git 和 core.worktree 的相对目录关系;只挂载本仓元数据。
|
|
21
|
+
- type: bind
|
|
22
|
+
source: ../../.git/modules/packages/fly_ruler_ros2
|
|
23
|
+
target: /workspace/FlyRuler/.git/modules/packages/fly_ruler_ros2
|
|
24
|
+
bind:
|
|
25
|
+
create_host_path: false
|
|
26
|
+
- vscode-server:/home/ubuntu/.vscode-server
|
|
27
|
+
stdin_open: true
|
|
28
|
+
tty: true
|
|
29
|
+
command: ["sleep", "infinity"]
|
|
30
|
+
|
|
31
|
+
volumes:
|
|
32
|
+
vscode-server:
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# 架构与源码分层
|
|
2
|
+
|
|
3
|
+
`fly_ruler_ros2` 负责将 `fly_ruler_core` 导出的 C++ 模型工程装配为 ROS 2 Jazzy 节点包,并提供无 ROS 依赖的 Python 交付工具与只读 HTTP 客户端。
|
|
4
|
+
|
|
5
|
+
```mermaid
|
|
6
|
+
flowchart TB
|
|
7
|
+
core["fly_ruler_core<br/>ModelProgram / TargetProgram / SourceProject"] --> delivery["Python delivery/<br/>generate / build / deploy / deliver"]
|
|
8
|
+
delivery --> templates["templates/<br/>CMakeLists / model_node.cpp / initial.toml"]
|
|
9
|
+
templates --> cpp_pkg["生成 ROS 2 包<br/>native/ + src/"]
|
|
10
|
+
cpp_pkg --> runtime["ros2/fly_ruler_ros2_runtime<br/>生命周期调度 + HTTP 状态服务"]
|
|
11
|
+
runtime --> interfaces["ros2/fly_ruler_ros2_interfaces<br/>ModelInput / ModelSample / Metadata"]
|
|
12
|
+
runtime -.-> client["Python client.py / fr_ros2<br/>只读 HTTP 观测"]
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## 目录与模块职责
|
|
16
|
+
|
|
17
|
+
| 路径 | 职责边界 |
|
|
18
|
+
| --- | --- |
|
|
19
|
+
| `python/fly_ruler_ros2/delivery/` | `_generate.py`(装配模板)、`_build.py`(colcon/Docker/交叉构建)、`_deploy.py`(本地/SSH/容器部署)、`_compose.py`(`deliver_model` 一键串联)与 `_manifest.py` |
|
|
20
|
+
| `python/fly_ruler_ros2/cli/` | `fr_ros2 project` 与 `fr_ros2 node` 命令行入口 |
|
|
21
|
+
| `python/fly_ruler_ros2/client.py` | 轻量只读 HTTP 客户端,透传运行中节点的 `state`、`diagnostics` 与模型描述(不依赖 `fly_ruler_core` 或 ROS) |
|
|
22
|
+
| `python/fly_ruler_ros2/templates/` | 节点包模板(`CMakeLists.txt.in`、`package.xml.in`、`model_node.cpp.in`、`initial.toml.in`、`model.launch.py.in`) |
|
|
23
|
+
| `ros2/` | 共享 ROS 2 包:`fly_ruler_ros2_runtime`(生命周期节点、周期步进、HTTP 服务)与 `fly_ruler_ros2_interfaces`(消息定义) |
|
|
24
|
+
|
|
25
|
+
## 关键实现不变量
|
|
26
|
+
|
|
27
|
+
1. **复用 core 编译产物**:模型数学库、积分器、变量布局与 C++ wrapper 全部来自 `fly_ruler_core` 的 `CppTarget`。生成绑定使用 `SourceProject.description` 指定的头文件、模型类型和链接目标,并按 `ArtifactFile.MODEL_INFO` 与 `ArtifactFile.NATIVE_RESOURCES` 安装描述和必要的外置资源。
|
|
28
|
+
2. **多形态输入分发**:`generate_project` 接收 `ModelProgram`、CasADi `TargetProgram` 或 `SourceProject`,前两者通过 `core.projects.export` 导出,后者直接复用已有源码与资源;CLI 按磁盘产物种类调用对应 `artifacts` reader。
|
|
29
|
+
3. **部署与启动分开校验身份**:部署前核对安装树的包名、目标平台和 `project_key`;创建节点时核对已安装描述与实际链接的 C++ 库。同名、同平台的另一份工程不能替代当前产物。
|
|
30
|
+
4. **控制面与观测面分离**:ROS 生命周期转换与周期输入走 `ros2 lifecycle` 与 ROS 话题,HTTP 仅提供无状态只读观测与诊断。
|
|
31
|
+
|
|
32
|
+
## 下一步
|
|
33
|
+
|
|
34
|
+
- [实时准入与验证](02-realtime-and-verification.md):了解 `rt_required` 实时准入检查与仓库测试分组
|
|
35
|
+
- [交付与客户端 API](/api/ros2/):查阅 Python 公开接口
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# 实时准入与验证
|
|
2
|
+
|
|
3
|
+
## 实时模式与准入机制
|
|
4
|
+
|
|
5
|
+
节点实例 TOML 支持配置实时调度模式:
|
|
6
|
+
|
|
7
|
+
- **`best_effort`(默认)**:按常规线程周期运行,适合普通开发机、容器与非实时内核联调。
|
|
8
|
+
- **`rt_required`**:面向独立 Linux 进程或真机在环(HITL)台架。节点在 `activate` 前执行严格的准入检查(内核特性、计算线程 CPU 绑核、FIFO 调度策略回读以及内存锁页 `mlockall`),任一条件未满足即拒绝激活;运行期间发生周期失约时由管理侧受控失活,避免静默跑偏。
|
|
9
|
+
|
|
10
|
+
::: tip 在普通内核复现准入拒绝在未启用 `PREEMPT_RT` 或缺少实时权限的普通容器内配置 `rt_required`,即可复现准入检查拒绝;实际控制尾延迟需在目标硬件上用同一安装产物对照测量。台架设计详见 [fr_quad HITL 台架](/dev/components/ros2-hitl)。:::
|
|
11
|
+
|
|
12
|
+
## 开发环境与验证命令
|
|
13
|
+
|
|
14
|
+
在 `packages/fly_ruler_ros2/` 目录下运行 `just --list` 查看全部入口:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
cd packages/fly_ruler_ros2
|
|
18
|
+
uv sync --locked --extra export # 从锁文件安装 PyPI 的 fly-ruler 和开发依赖
|
|
19
|
+
just check # ruff check / format --check + mypy
|
|
20
|
+
just test # 默认执行 tests/project 与 tests/client(无需 ROS)
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
需要联调工作区中的 core 源码时,用 `just setup ../fly_ruler` 代替锁文件安装。验收 PyPI 发行包时,用 `UV_PROJECT_ENVIRONMENT` 指向新的环境路径,且不设置 `PYTHONPATH`,以免导入本地 core。
|
|
24
|
+
|
|
25
|
+
### 按测试分组执行
|
|
26
|
+
|
|
27
|
+
`just test <GROUP>` 可按改动范围精确运行不同维度的验证:
|
|
28
|
+
|
|
29
|
+
| 命令 | 覆盖范围 | 环境前提 |
|
|
30
|
+
| --- | --- | --- |
|
|
31
|
+
| `just test project` | 工程生成约束、native 构建与一步数值验收 | 宿主机 Python 环境(无需 ROS) |
|
|
32
|
+
| `just test client` | HTTP 只读观测客户端与 CLI 行为 | 宿主机 Python 环境(无需 ROS) |
|
|
33
|
+
| `just test delivery` | `generate` / `build` / `deploy` 交付编排 | Docker / 构建环境 |
|
|
34
|
+
| `FR_ROS2_TEST_IMAGE=fr-ros2-dev:jazzy just test ros2` | 真实 ROS 2 Jazzy 容器内 `colcon` 识别、构建与安装验收 | Docker + `fr-ros2-dev:jazzy` 镜像 |
|
|
35
|
+
| `just test runtime` / `device` / `release` | 周期采样实时性、跨机部署与发包安装验收 | 对应实时内核、目标设备或发包环境 |
|
|
36
|
+
|
|
37
|
+
### 开发容器与 C++ 格式化
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
just start-dev # 启动与 VS Code Dev Container 一致的 Jazzy 容器
|
|
41
|
+
just fmt-cpp # 在容器内对 ros2/ 下的 C++ 文件运行 clang-format
|
|
42
|
+
just shell-dev # 进入容器 shell 调试 colcon 与节点
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
提交前可执行 `just pre-commit`(依次运行 `check`、`test` 与 `uv build`)。
|