From f57fe8416f53005acd70536f00dfecacf81a4521 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=A2=E5=B3=B0=E7=91=9E?= Date: Mon, 28 Sep 2026 17:57:17 +0800 Subject: [PATCH 1/3] feat: replace the C++ SDK with the serial transport implementation This branch is a complete port of the litearm Python SDK over the raw serial framing protocol. It shares no git history with main, so it lands as a whole-tree replacement rather than as a patch on the existing SDK. Removed with the previous SDK: proto/litearm.proto, the codec, device, types and exceptions layers, tests/test_arm.cpp, test_arm_direct.cpp, test_codec.cpp, test_device.cpp, and docs/DEVELOPER_GUIDE.zh-CN.md. Preserved unchanged: LICENSE, .github/workflows/ci.yml, .github/workflows/release.yml, .releaserc.json, .markdownlint.json. .gitignore is the union of both files. Scope: 49 commands, 27 test binaries, 379 cases, verified against a 7-axis arm on firmware Litearm1.8.0-7J. Known deviation: docs/DEVELOPER_GUIDE.md and TROUBLESHOOTING.md are Chinese, where main keeps an English guide plus a .zh-CN variant. README.md follows the repository convention and is English. --- .gitignore | 8 + AGENTS.md | 199 +-- CMakeLists.txt | 257 ++- README.md | 951 +++++++--- README.zh-CN.md | 835 +++++++-- TROUBLESHOOTING.md | 356 ++++ UNVERIFIED_REGISTER.md | 70 + build.sh | 92 + cmake/litearm.pc.in | 16 + cmake/litearmConfig.cmake.in | 25 + cmake/toolchain-aarch64-linux-gnu.cmake | 36 + docs/DEVELOPER_GUIDE.md | 684 +++---- docs/DEVELOPER_GUIDE.zh-CN.md | 462 ----- env.ps1 | 35 + env.sh | 33 + examples/01_hello.cpp | 59 + examples/02_movej.cpp | 55 + examples/03_move_p.cpp | 45 + examples/04_ik_tcp.cpp | 41 + examples/05_ff_tune.cpp | 53 + examples/06_cartesian.cpp | 110 ++ examples/07_vel_jitter_trace.cpp | 238 +++ examples/README.md | 61 + examples/_common.cpp | 115 ++ examples/_common.hpp | 66 + include/litearm/ack.hpp | 286 +++ include/litearm/arm.hpp | 1132 ++++++++---- include/litearm/cart.hpp | 318 ++++ include/litearm/clock.hpp | 51 + include/litearm/codec.hpp | 74 - include/litearm/device.hpp | 133 -- include/litearm/diagnostics.hpp | 86 + include/litearm/errors.hpp | 225 +++ include/litearm/exceptions.hpp | 181 -- include/litearm/framing.hpp | 85 + include/litearm/litearm.hpp | 58 + include/litearm/log.hpp | 139 ++ include/litearm/model.hpp | 121 ++ include/litearm/msg.hpp | 33 + include/litearm/params.hpp | 66 + include/litearm/protocol.hpp | 327 +++- include/litearm/rot.hpp | 158 ++ include/litearm/state.hpp | 88 + include/litearm/testing.hpp | 308 ++++ include/litearm/transport.hpp | 188 +- include/litearm/types.hpp | 207 --- proto/litearm.proto | 142 -- run_example.ps1 | 28 + run_example.sh | 28 + src/ack.cpp | 371 ++++ src/arm.cpp | 2185 ++++++++++++++++------- src/cart.cpp | 699 ++++++++ src/clock.cpp | 18 + src/codec.cpp | 297 --- src/device.cpp | 133 -- src/diagnostics.cpp | 205 +++ src/errors.cpp | 268 +++ src/exceptions.cpp | 73 - src/framing.cpp | 65 + src/log.cpp | 176 ++ src/model.cpp | 150 ++ src/params.cpp | 80 + src/protocol.cpp | 301 ++++ src/rot.cpp | 211 +++ src/state.cpp | 91 + src/testing.cpp | 768 ++++++++ src/transport.cpp | 587 +++++- src/types.cpp | 312 ---- tests/test_accessors.cpp | 155 ++ tests/test_arm.cpp | 777 -------- tests/test_arm_assembly.cpp | 250 +++ tests/test_arm_direct.cpp | 39 - tests/test_cart.cpp | 549 ++++++ tests/test_cli.cpp | 41 + tests/test_clock.cpp | 92 + tests/test_codec.cpp | 359 ---- tests/test_commands.cpp | 447 +++++ tests/test_device.cpp | 170 -- tests/test_diagnostics.cpp | 120 ++ tests/test_errors.cpp | 176 ++ tests/test_ff.cpp | 155 ++ tests/test_fork_guard.cpp | 201 +++ tests/test_frame_ownership.cpp | 272 +++ tests/test_framework.cpp | 160 ++ tests/test_framework.hpp | 155 ++ tests/test_framing.cpp | 141 ++ tests/test_full_coverage.cpp | 501 ++++++ tests/test_license.cpp | 204 +++ tests/test_log.cpp | 212 +++ tests/test_model.cpp | 194 ++ tests/test_packaging.cpp | 102 ++ tests/test_params.cpp | 117 ++ tests/test_precheck.cpp | 213 +++ tests/test_protocol.cpp | 332 +++- tests/test_protocol_sync.cpp | 523 ++++++ tests/test_register.cpp | 233 +++ tests/test_rot.cpp | 241 +++ tests/test_state.cpp | 117 ++ tests/test_support.hpp | 281 +++ tests/test_threading.cpp | 200 +++ tests/test_transport.cpp | 420 +++-- tests/test_zero_g.cpp | 288 +++ 102 files changed, 19035 insertions(+), 5756 deletions(-) create mode 100644 TROUBLESHOOTING.md create mode 100644 UNVERIFIED_REGISTER.md create mode 100755 build.sh create mode 100644 cmake/litearm.pc.in create mode 100644 cmake/litearmConfig.cmake.in create mode 100644 cmake/toolchain-aarch64-linux-gnu.cmake delete mode 100644 docs/DEVELOPER_GUIDE.zh-CN.md create mode 100644 env.ps1 create mode 100755 env.sh create mode 100644 examples/01_hello.cpp create mode 100644 examples/02_movej.cpp create mode 100644 examples/03_move_p.cpp create mode 100644 examples/04_ik_tcp.cpp create mode 100644 examples/05_ff_tune.cpp create mode 100644 examples/06_cartesian.cpp create mode 100644 examples/07_vel_jitter_trace.cpp create mode 100644 examples/README.md create mode 100644 examples/_common.cpp create mode 100644 examples/_common.hpp create mode 100644 include/litearm/ack.hpp create mode 100644 include/litearm/cart.hpp create mode 100644 include/litearm/clock.hpp delete mode 100644 include/litearm/codec.hpp delete mode 100644 include/litearm/device.hpp create mode 100644 include/litearm/diagnostics.hpp create mode 100644 include/litearm/errors.hpp delete mode 100644 include/litearm/exceptions.hpp create mode 100644 include/litearm/framing.hpp create mode 100644 include/litearm/litearm.hpp create mode 100644 include/litearm/log.hpp create mode 100644 include/litearm/model.hpp create mode 100644 include/litearm/msg.hpp create mode 100644 include/litearm/params.hpp create mode 100644 include/litearm/rot.hpp create mode 100644 include/litearm/state.hpp create mode 100644 include/litearm/testing.hpp delete mode 100644 include/litearm/types.hpp delete mode 100644 proto/litearm.proto create mode 100644 run_example.ps1 create mode 100755 run_example.sh create mode 100644 src/ack.cpp create mode 100644 src/cart.cpp create mode 100644 src/clock.cpp delete mode 100644 src/codec.cpp delete mode 100644 src/device.cpp create mode 100644 src/diagnostics.cpp create mode 100644 src/errors.cpp delete mode 100644 src/exceptions.cpp create mode 100644 src/framing.cpp create mode 100644 src/log.cpp create mode 100644 src/model.cpp create mode 100644 src/params.cpp create mode 100644 src/protocol.cpp create mode 100644 src/rot.cpp create mode 100644 src/state.cpp create mode 100644 src/testing.cpp delete mode 100644 src/types.cpp create mode 100644 tests/test_accessors.cpp delete mode 100644 tests/test_arm.cpp create mode 100644 tests/test_arm_assembly.cpp delete mode 100644 tests/test_arm_direct.cpp create mode 100644 tests/test_cart.cpp create mode 100644 tests/test_cli.cpp create mode 100644 tests/test_clock.cpp delete mode 100644 tests/test_codec.cpp create mode 100644 tests/test_commands.cpp delete mode 100644 tests/test_device.cpp create mode 100644 tests/test_diagnostics.cpp create mode 100644 tests/test_errors.cpp create mode 100644 tests/test_ff.cpp create mode 100644 tests/test_fork_guard.cpp create mode 100644 tests/test_frame_ownership.cpp create mode 100644 tests/test_framework.cpp create mode 100644 tests/test_framework.hpp create mode 100644 tests/test_framing.cpp create mode 100644 tests/test_full_coverage.cpp create mode 100644 tests/test_license.cpp create mode 100644 tests/test_log.cpp create mode 100644 tests/test_model.cpp create mode 100644 tests/test_packaging.cpp create mode 100644 tests/test_params.cpp create mode 100644 tests/test_precheck.cpp create mode 100644 tests/test_protocol_sync.cpp create mode 100644 tests/test_register.cpp create mode 100644 tests/test_rot.cpp create mode 100644 tests/test_state.cpp create mode 100644 tests/test_support.hpp create mode 100644 tests/test_threading.cpp create mode 100644 tests/test_zero_g.cpp diff --git a/.gitignore b/.gitignore index 52a9aa9..3ebdbd1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,14 @@ # Build artifacts build/ +build-*/ generated/ +*.o +*.a +*.csv +*.bin +compile_commands.json +.cache/ +Testing/ # IDE .vscode/ diff --git a/AGENTS.md b/AGENTS.md index c45dafe..2c5b2e8 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,117 +1,86 @@ # AGENTS.md -Operating rules for agents working in this repository. They are mandatory, not advisory. - -Everything you write — commit messages, PRs, issues, documentation — is in English, following industry conventions, unless told otherwise. - -## 1. Git Workflow - -These rules assume the repository is hosted on GitHub. Where it has no GitHub remote, the GitHub-specific steps (PRs, issues, releases) do not apply; branching, commit, and testing rules apply to every Git repository. - -**Never modify code directly on the default branch.** Always create a new branch first. - -- The default branch may be `main` or `master`; `` below means whichever it is. -- Sync before branching: `git switch && git pull --ff-only`. -- Create a branch: `git switch -c /`. - - Examples: `feat/oauth-login`, `fix/null-pointer-on-logout`, `chore/bump-deps`. - - `` is one of the commit types listed below. -- Keep branches small and single-purpose. One branch solves one problem. -- Keep the branch current by rebasing on ``; do not merge `` into it. -- Never rewrite history that has already been pushed to a shared branch. - -### Commits - -Every commit message follows Conventional Commits: - -``` -: - - - -