▶ Try it its model runs in your browser, nothing to install
arche/two-link-arm
Two-link arm
A two-link arm hanging from a fixed shoulder, a motor and an encoder at each joint, and a controller that cancels gravity and reaches its pose; its plant in MuJoCo (archec gen --target mujoco), its test cases run against it (archec sim --plant … --test).
plantmujocorobotarmcontrolgravity-compensation
archec add main.arche arche/two-link-arm@^0.1
Package
| Kind | template |
|---|---|
| Version | 0.1.0 |
| License | Apache-2.0 |
| Export control | none |
| Works with | archec >=0.10 |
| Edition | 0.12 |
| Handlers | the action language (```arche), run as TypeScript from its code |
| Home | https://github.com/arche-lang/arche-lang |
Model
| Systems | Arm |
|---|---|
| Components | Link Motor Encoder Controller |
| Requirements | 2 |
| Messages | 2 |
Code it brings
| Where | Language | Lines |
|---|---|---|
main.arche · Controller.on_shoulder.body | arche | 4 |
main.arche · Controller.on_elbow.body | arche | 11 |
Two-link arm
A two-link arm hanging from a fixed shoulder: two 0.5 m links of 1 kg, a motor (N·m) and an encoder at each joint. Its controller cancels gravity and adds a PD law on top, so it reaches its targets — a plain PD, as examples/arm has, stops short of them, held back by gravity.
| | | |---|---| | Plant | 2 hinges (y), 2 torque motors (±20 N·m), 2 encoders, 1 ms step | | Controller | τ = G(q) + KP·(target − q) − KD·q̇, 100 Hz; KP 40, KD 6 | | Requirements | REQ-ARM-REACH (within 0.02 rad in 2 s), REQ-ARM-HOLD | | Test plan | TP-ARM: reach the first pose, hold it, a second pose |
archec new my-arm --template two-link-arm a project from it, yours to change
archec gen main.arche --target mujoco -o out
archec sim main.arche --plant out/mujoco/plant_bridge.py --test
python3 out/mujoco/plant_bridge.py --viewer
In MuJoCo (4.0), from 0, 0 to 0.6, 0.9 rad: within 0.02 rad at 0.78 s, and 2·10⁻⁶ rad off at 3 s. Change the targets (controller.target_shoulder, target_elbow) or the links' mass and length — G(q) uses LINK_MASS and LINK_LENGTH, so change them together.
Versions
| Version | Published | archec | State |
|---|---|---|---|
0.1.0 | 2026-11-12 | >=0.10 | public |
Signature
Signed by arche with key e660d0a8851875b9. Files: 3, fingerprint sha256-4b62d917af56341075e5…. archec add checks both before it writes anything.
Discussion
Loading…