Using the library¶
All code below is real API; headers live under include/rtctrl/.
Link against the rtctrl::rtctrl CMake target.
Model and coordinates¶
#include "rtctrl/model/chain_model.hpp"
#include "rtctrl/model/joint_map.hpp"
#include "rtctrl/model/zvector.hpp"
using namespace rtctrl;
model::ChainModel chain("models/crane_x7/crane_x7.ztk");
model::JointMap map(chain); // canonical 8-DOF ↔ DXL ids ↔ roki indices
model::ZVector q8(model::kCanonicalDof); // RAII zVec, starts zeroed
model::ZVector q9(model::kModelDof);
q8[1] = 0.6; // shoulder tilt
map.expand(q8, q9); // finger B mimics finger A
chain.fk(q9); // forward kinematics
ChainModel::chain() exposes the underlying rkChain* for any roki
API not wrapped yet: the wrappers are conveniences, not a wall.
Model loading resolves mesh paths relative to the .ztk file (the
mi-lib convention), so it works from any working directory.
Inverse kinematics¶
#include "rtctrl/model/ik_solver.hpp"
model::IkSolver ik(chain, map); // arm joints only; fingers excluded
zVec3D target_pos; zMat3D target_att; // world-frame gripper-base pose
// ... fill target ...
model::ZVector init(model::kModelDof), solution(model::kModelDof);
const auto result = ik.solve(target_pos, target_att, init, solution);
if (!result.converged) {
// unreachable or constrained: residuals/iterations say why.
// A finite-but-wrong answer never comes back as success.
}
IkResult carries position/attitude residuals, the iteration count,
and joint-limit/finiteness flags. The solver uses roki's
Levenberg–Marquardt iteration with the error-damped equation solver;
it converges at reachable singular poses (that robustness is pinned by
tests).
The effector defaults to the gripper base; pass a link name to target
another frame. The model ships a virtual tool-center point,
crane_x7_tcp_link: a fixed, massless frame at the midpoint of the
closed fingertips whose axes coincide with the world axes when the
gripper points forward (+x), so TCP x is the approach direction and
TCP z is up when the gripper is level. World-frame pose targets then
read naturally (identity attitude = level, forward-pointing gripper):
model::IkSolver tcp_ik(chain, map, "crane_x7_tcp_link");
On hardware,
x7_pose --tcp X Y Z ROLL_RAD PITCH_RAD YAW_RAD uses exactly this
solver (seeded from the measured posture; a non-converged solve is
refused before any motion), and adding --preview <basename> writes
an .init.ztk for rk_pen without touching the bus. For both --tcp
and --posture, the subsequent hardware placement must bring every
measured joint within 0.01 rad of its resolved target. A stalled or
exhausted placement correction, or any dropped position command,
deactivates the arm and returns a nonzero exit instead of entering the
normal hold phase.
Authored postures¶
Authored joint postures use strict, versioned TOML files under
config/postures/:
format_version = 1
name = "Zeros posture"
joint_positions = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
joint_positions contains the eight canonical joint displacements in
radians. Unknown keys, incompatible versions, non-finite values, and a
joint count other than eight are errors. Use a posture without hardware
by adding --preview:
./build/apps/x7_pose --posture config/postures/zeros.toml \
--preview /tmp/zeros
Identification .dwells.json files are generated experiment sidecars,
not authored posture files. Archived sidecars remain usable through the
explicit --legacy-anchor-sidecar <file.dwells.json> compatibility
option. Arbitrary text or JSON is not accepted by --posture.
Hardware placement defaults to normal servo position mode. Select current-based-position explicitly when that mode is part of the experiment:
./build/apps/x7_pose --posture config/postures/zeros.toml \
--mode current-based-position --effort-limit-nm 2.5
The CBP path stages the requested all-joint effort ceiling before torque-on
and carries it through placement and the final hold. The ceiling defaults to
2.5 Nm when omitted and must not exceed any joint's configured limit.
--effort-limit-nm is rejected in position mode so a safety-relevant value is
never silently ignored. CBP changes the servo operating mode; it does not add
host-side feedback or computed torque. Keep the power cutoff in reach and
support the arm before pressing Enter to disable torque.
Trajectories and motion files¶
#include "rtctrl/model/trajectory.hpp"
#include "rtctrl/model/zvs_writer.hpp"
auto traj = model::MinJerkTrajectory::withVelocityLimit(q_start, q_goal,
/*vel limit*/ 1.0);
model::ZVector q(model::kCanonicalDof), dq(model::kCanonicalDof),
ddq(model::kCanonicalDof);
traj.sample(t, q, dq, ddq); // C² quintic; dq/ddq optional
model::ZvsWriter log("motion.zvs"); // one "<dt> <zVec>" line per frame
log.frame(0.01, q9); // view: rk_anim <model.ztk> motion.zvs
if (!log.close()) { /* a write failed; the file is incomplete */ }
chain.writeInitZtk("pose.init.ztk", q9); // static posture for
// rk_pen -model <model.ztk> -init pose.init.ztk
ZvsWriter buffers its frames, so a write error (a full disk, for example)
often surfaces only when the buffer is flushed. The first failure latches:
frame() returns false for it and every later frame, and close() returns
false. Only close() returning true means the file holds every counted frame.
Every app and example that writes through ZvsWriter checks it: the planner
fails with cannot finish PTP output before publishing a bundle, and the
follow and track simulators report motion: writing <file> failed; the motion
is incomplete and exit 1.
writeInitZtk delegates to roki's own rkChainInitWriteZTK: the
[roki::chain::init] format stores revolute displacements in degrees,
so a hand-written radian file loads as a near-zero posture.
Cartesian PTP planning¶
x7_plan_ptp plans a straight world-frame TCP translation with a
shortest-path spherical attitude interpolation. It solves IK at every
sample, writes the model's nine joint coordinates to a .zvs file, and
writes an analysis-ready trajectory diagnostics CSV. The app is entirely
offline and never opens the hardware bus.
Start with the checked-in configuration:
./build/apps/x7_plan_ptp --config config/ptp_example.toml
rk_anim models/crane_x7/crane_x7.ztk ptp.zvs
For a top-down approach toward a nominal tabletop object, use the separate pick example:
./build/apps/x7_plan_ptp --config config/ptp_pick_example.toml
rk_anim models/crane_x7/crane_x7.ztk ptp_pick_approach.zvs
uv run --project tools tools/plot/ptp_trajectory.py \
ptp_pick_approach.csv --output /tmp/ptp-pick-review.png
It starts at [0.22, -0.10, 0.26] m with the TCP pointing forward, then reaches
forward and across the workspace to [0.28, 0.10, 0.08] m while pitching by
pi/2 so the TCP approach axis finishes downward. Those coordinates are
illustrative. Measure the actual table and object frame, check collisions, and
update both endpoints before using the trajectory around hardware. The plan
does not command the gripper to close.
The configuration schema is:
model = "../models/crane_x7/crane_x7.ztk"
output = "ptp.zvs"
end_effector = "crane_x7_tcp_link"
[diagnostics]
enabled = true
output = "ptp.csv"
[trajectory]
profile = "minimum-jerk" # linear, trapezoidal, or minimum-jerk
sample_rate = 100.0
motion_time = 2.0
max_linear_velocity = 0.05
max_angular_velocity = 0.5
trapezoid_acceleration_fraction = 0.2
[start]
position = [0.20, 0.0, 0.25] # m, world frame
rpy_rad = [0.0, 0.0, 0.0] # roll, pitch, yaw in radians
[end]
position = [0.22, 0.0, 0.25]
rpy_rad = [0.0, 0.0, 0.0]
[ik]
strict = true
position_tolerance = 1.0e-4
attitude_tolerance = 1.0e-3
max_iterations = 200
initial_joints = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
The attitude convention is
\(R=R_z(\mathit{yaw})R_y(\mathit{pitch})R_x(\mathit{roll})\), matching
x7_pose --tcp. Both apps convert these world-frame RPY radians to an
attitude matrix before calling IkSolver; the solver receives the
matrix, not an angle-axis vector. RoKi's degree-valued angle-axis syntax
applies to textual ZTK input and is not the runtime IK reference
convention. The model path is relative to the TOML file. Trajectory and
diagnostics output paths are relative to the directory where the app is
invoked; .zvs and .csv are appended when absent. Unknown keys and
malformed values are errors, which prevents misspelled options from
silently using defaults.
model, [start], and [end] are required. Optional defaults are
ptp.zvs, a same-basename ptp.csv diagnostics file,
crane_x7_tcp_link, minimum jerk, 100 Hz, strict IK, position tolerance
\(10^{-4}\) m, attitude tolerance \(10^{-3}\) rad, 200 IK iterations, and
an all-zero canonical initial joint seed.
The three profiles apply to one scalar path-progress variable. The geometric translation remains a line and attitude remains SLERP for all profiles:
linearhas constant path speed and an instantaneous velocity change at each endpoint.trapezoidalhas symmetric acceleration and deceleration ramps. Each ramp occupies 20 percent of the motion by default.minimum-jerkuses the quintic \(10u^3-15u^4+6u^5\) and is the default.
Motion time and Cartesian velocity limits are compatible constraints, not mutually exclusive choices. The selected duration is
where \(\theta\) is the shortest attitude change and \(c\) is the profile's peak progress speed: 1 for linear, \(1/(1-a)\) for a trapezoid with ramp fraction \(a\), and \(15/8\) for minimum jerk. Linear and angular velocity limits must be specified together. If no timing constraint is present, the duration defaults to 5 seconds.
The planner creates enough equal intervals to meet or exceed the
requested sample rate, adjusts the interval so the endpoint occurs at
the exact duration, and includes both endpoints. The first IK solve
uses initial_joints in canonical order; each later solve uses the
previous solution. The gripper stays at its initial value, and finger
B is emitted as the mimic of finger A.
Strict IK is the default. A non-converged sample aborts planning before
the output file is opened. With strict = false, a finite, in-limit
best result is written with a warning containing its time and
residuals; a non-finite or limit-violating result remains fatal. The
app also reports the worst IK residuals, peak sampled joint speed and
acceleration, and minimum joint-limit margin.
Trajectory diagnostics and plots¶
The diagnostics CSV has one schema-versioned row per .zvs sample. It
records:
- analytic target TCP position, quaternion attitude, world-frame linear and angular velocity, and acceleration;
- FK position, quaternion attitude, velocity, and acceleration evaluated from the IK joint solution;
- world-frame position and rotation-vector errors plus the complete IK result;
- canonical eight-joint position, sampled velocity and acceleration, and joint-limit margin.
Target Cartesian derivatives come directly from the selected scalar
profile. Joint velocity and acceleration are second-order finite-difference
estimates of the sampled IK path; the FK rates use those estimates. They do
not yet define a continuous joint interpolant for a hardware tracker.
profile_derivative_discontinuity marks samples where an ideal linear or
trapezoidal profile has no unique two-sided derivative.
Quaternion attitude is authoritative. Angular velocity and acceleration are world-frame vectors, not derivatives of RPY angles. The plotter derives and unwraps RPY only for display:
uv run --project tools tools/plot/ptp_trajectory.py ptp.csv \
--output /tmp/ptp-review.png
The plot covers target versus FK TCP position and attitude, Cartesian
speed and acceleration, joint position, joint velocity and acceleration,
IK/FK errors, and minimum joint-limit margin. Use --show for an
interactive window. Without --show, --output is required so plotting a
completed bundle cannot modify it accidentally.
Use --diagnostics FILE to select another CSV path or --no-diagnostics
for ordinary non-bundle planning. A bundle always contains diagnostics.
Common settings can be overridden without editing the TOML file:
./build/apps/x7_plan_ptp --config plan.toml \
--output trial.zvs --diagnostics trial.csv --motion-time 4 \
--max-linear-velocity 0.04 --max-angular-velocity 0.4 \
--sample-rate 200 --profile trapezoidal --no-strict-ik
Portable planning bundles¶
Create an immutable, self-contained archive by giving a directory that does not yet exist:
./build/apps/x7_plan_ptp --config plan.toml \
--bundle backups/pick-20260826 --motion-time 4
--bundle owns the trajectory and diagnostics locations and is therefore
exclusive with --output, --diagnostics, and --no-diagnostics. The
target is checked before the source configuration is loaded. An existing
directory, regular file, or symbolic link is refused without inspection
or modification, even if the source configuration is missing or malformed.
Failed creation removes its private staging directory and does not publish
a partial bundle.
A successful bundle contains:
pick-20260826/
source.toml
plan.toml
trajectory.zvs
trajectory.csv
manifest.toml
model/
crane_x7.ztk
meshes/visual/...
source.toml is a byte-for-byte copy of the input. plan.toml records
the effective configuration after CLI overrides, with portable paths
model/crane_x7.ztk, trajectory.zvs, and trajectory.csv. The planner
reloads this copied configuration and generates the initial trajectory and
diagnostics from the copied model. Every relative import: used by the
model is copied with its directory layout; absolute imports and imports
that escape the model directory are refused.
manifest.toml records the bundle format version, rtctrl version, build
Git commit and dirty state, and the size and SHA-256 of every archived
file. The bundle is staged beside its destination and published with a
no-replace rename only after planning and hashing succeed.
Reproduce into a new output file without modifying the archive:
./build/apps/x7_plan_ptp \
--config backups/pick-20260826/plan.toml \
--output /tmp/pick-reproduced.zvs \
--diagnostics /tmp/pick-reproduced.csv
cmp backups/pick-20260826/trajectory.zvs /tmp/pick-reproduced.zvs
cmp backups/pick-20260826/trajectory.csv /tmp/pick-reproduced.csv
For strict reproduction, build the Git commit named in manifest.toml.
Loading plan.toml resolves the model relative to the archive, so the
repository's current model is not used. --bundle is creation-only and
is not used for replay.
The planner checks kinematics and model joint limits, but it does not perform collision checking or certify a trajectory for hardware. A hardware tracking app must independently validate the file, starting posture, joint rates, operating modes, and collision constraints before enabling torque.
Host-side computed-torque tracking¶
x7_track_sim and x7_track replay a ZVS reference with the same host-side
current controller:
The controller uses measured velocity directly. It has no host velocity
estimator, low-pass filter, integral term, per-joint gain scaling, friction
term, or current-mode settling controller. Those historical countermeasures
remain available in arm::PracticalComputedTorque, but the renewed app does
not select them. For the complete timestamped bundle workflow, hardware
procedure, and analysis commands, see
Host-side controller comparison.
Generate a synthetic reference, check the complete configuration, and run the dynamics simulation first:
./build/apps/x7_plan_ptp --config config/ptp_example.toml
./build/apps/x7_track_sim --config config/track_example.toml --check
./build/apps/x7_track_sim --config config/track_example.toml \
--motion /tmp/track-sim.zvs --log /tmp/track-sim.csv
A manually taught ZVS can be selected with --reference. Use the same
filtering decision made during the teaching review, commonly --filter
low-pass for raw taught motion. Synthetic planner output normally uses
--filter none.
Deliberately slow the reference without changing its path:
./build/apps/x7_track_sim --config config/track_example.toml \
--playback-rate 0.5 --bundle /tmp/track-half-speed
A playback rate in (0, 1] multiplies reference velocity by the rate and
acceleration by its square. The total tracking duration is divided by the
rate. --kp, --kd, --effort-limit-nm, --filter, and --interpolation
are also shared by both frontends.
Both frontends first move to reference frame zero in servo position mode. The hardware frontend settles there, stops the command thread, calculates gravity current at that stationary posture, and performs the reviewed position to current transition with the preload already staged. Tracking begins on fresh current-mode feedback. No mode change occurs during motion.
Tracking error is assessed separately from execution status. The result stores
aggregate, per-joint RMS, and peak errors plus tracking_pass. Missing the
assessment thresholds does not abort or make an otherwise clean invocation
fail. The larger hard-error envelope, position gates, command rejection,
watchdogs, I/O checks, and verified shutdown remain active.
The hardware app is intentionally experimental and has not been validated on the renewed path. The plain law was unstable in the historical campaign. Keep the actuator cutoff in reach, use a short slow reference, inspect the complete simulation first, and support the arm before ending the final hold.
./build/apps/x7_track --config config/track_example.toml \
--playback-rate 0.5 --check
./build/apps/x7_track --config config/track_example.toml \
--playback-rate 0.5 --bundle /tmp/track-campaign/hardware
Create the matching simulation at /tmp/track-campaign/simulation with the
same configuration and overrides. Do not run these commands back-to-back
without inspecting the simulation and preparing the hardware workspace.
Archive simulation and hardware runs beneath a common campaign directory, then compare them:
uv run --project tools tools/plot/track_comparison.py /tmp/track-campaign \
--output /tmp/track-campaign/comparison.png \
--summary-csv /tmp/track-campaign/comparison.csv
The directory form expects simulation/simulation.csv and
hardware/hardware.csv. Two explicit CSV paths can be supplied instead.
x7_track_sim also accepts an optional [simulation] link_force spec, a
prescribed external force started at the first tracking cycle, after the
current-mode switch. See
link-force disturbances.
Manual motion teaching¶
x7_teach records a trajectory while an operator guides the arm. It supports
two acquisition modes:
torque-offleaves every servo disabled and reads position, velocity, and current directly. This is the default and should be tried first.gravity-compensationuses the reviewedx7_floatactivation, calibrated gravity preload, soft-limit start gate, current-mode control cycle, servo watchdog, and host deadman. It requires the approved vendor-scale hardware configuration.
Both modes completed successfully on the physical arm 2026-08-28. The recorded workflow was then exercised through dynamics simulation and position/CBP hardware playback. This establishes the app workflow, not the safety of an arbitrary taught path: every new recording still requires visual inspection, simulation, preflight, and the normal hardware precautions.
Validate the configuration without opening the bus:
./build/apps/x7_teach --config config/teach_example.toml --check
For a torque-off recording, support the arm throughout the run. The first Enter starts recording and the second Enter stops it:
run_stamp=$(date +%Y%m%d-%H%M%S)
./build/apps/x7_teach --config config/teach_example.toml \
--mode torque-off --bundle "/tmp/teach-torque-off-${run_stamp}"
Gravity compensation adds a separate support confirmation. Keep supporting the arm during activation, press Enter to start, guide the arm and press Enter to stop, then support it from below and press Enter once more to disable torque:
run_stamp=$(date +%Y%m%d-%H%M%S)
./build/apps/x7_teach --config config/teach_example.toml \
--mode gravity-compensation \
--bundle "/tmp/teach-gravity-${run_stamp}"
The recording stops automatically at recording.max_duration_s if the second
Enter is not received. In gravity-compensation mode, torque remains active
after that stop until the separate support Enter or
finalization.operator_timeout_s. Activation, start wait, recording, and
support wait share a hard 60 second torqued-session ceiling. A timeout or
unclean shutdown makes the command fail.
The hardware acquisition loop always reads at 100 Hz. The CSV retains those
raw samples across the complete session, including the start wait and the
gravity-mode support wait. It records phase transitions, measured state, and,
when gravity compensation is active, submitted and applied torque command
metadata. recording.sample_rate_hz, or --sample-rate, selects the uniform
1 to 100 Hz ZVS output rate. The app linearly resamples only the interval
between the start and stop events and does not smooth it. Use the filtering and
interpolation settings in x7_follow when preparing a manually taught
reference for replay.
Standalone output files are created exclusively and never overwritten:
./build/apps/x7_teach --config config/teach_example.toml \
--output /tmp/pick-taught.zvs --log /tmp/pick-taught.csv \
--sample-rate 50 --max-duration 20
rk_anim models/crane_x7/crane_x7.ztk /tmp/pick-taught.zvs
--bundle is mutually exclusive with --output, --log, and --check.
Its target must not exist and is refused before the source configuration is
loaded. A successful bundle contains the source and effective TOML files, the
hardware configuration, model and meshes, trajectory.zvs, recording.csv,
result.toml, and a SHA-256 manifest. The effective teach.toml uses paths
inside the bundle, so its configuration and model can be checked later with:
./build/apps/x7_teach --config /tmp/teach-torque-off-STAMP/teach.toml --check
rk_anim /tmp/teach-torque-off-STAMP/model/crane_x7.ztk \
/tmp/teach-torque-off-STAMP/trajectory.zvs
To replay a taught motion, point reference in a copy of
config/follow_example.toml at the new ZVS. Run x7_follow_sim and inspect its
full-session log before considering hardware. A taught path records what the
operator did; it does not provide collision, speed, acceleration, or endpoint
safety certification.
The complete two-mode procedure, including immutable campaign storage, is in teaching playback and servo-mode comparison.
Servo-side trajectory following¶
x7_follow_sim and x7_follow run the same phase controller against the
dynamics simulator and the real arm. They delegate the feedback loop to each
Dynamixel servo. The host sends position or current-based-position commands
without a host-side tracking correction during the reference phase. This is
separate from the parked computed-torque x7_track app. Velocity mode is not
offered because replaying a position reference through Goal Velocity requires
a host-side position loop.
For a command-by-command position-versus-CBP campaign using a planned or manually taught reference, see teaching playback and servo-mode comparison.
Generate the example reference, validate the follow configuration, and run the simulation first:
./build/apps/x7_plan_ptp --config config/ptp_example.toml
./build/apps/x7_follow_sim --config config/follow_example.toml --check
./build/apps/x7_follow_sim --config config/follow_example.toml \
--motion /tmp/follow-sim.zvs --log /tmp/follow-sim.csv
rk_anim models/crane_x7/crane_x7.ztk /tmp/follow-sim.zvs
uv run --project tools tools/plot/follow_tracking.py /tmp/follow-sim.csv \
--output /tmp/follow-review.png
Both output files cover the complete session: home positioning, home correction and settling, reference tracking, and the final hold. The CSV also records the reference and measured joint states, mode-native command, submission receipt, applied target sequence, effort ceiling, and clamp/gate flags. The plotter validates this schema and places its legends above the traces so they do not obscure the data.
To compare archived position and current-based-position hardware runs, place
the bundles under position/ and cbp/ in one directory, then run:
run_dir=/tmp/follow-mode-hw-20260827-155637
uv run --project tools tools/plot/follow_mode_comparison.py "$run_dir" \
--output "$run_dir/comparison.png" \
--summary-csv "$run_dir/comparison.csv"
The comparison uses only tracking-phase samples, excluding home positioning
and the final operator hold. It prints aggregate and per-joint RMS and peak
errors, cycle-period statistics, rejected command receipts, clamp/gate events,
and command-application lag. The figure shows the shared reference with both
measured responses, together with per-joint error traces and RMS and peak bars.
Two CSV paths can be supplied instead of the common bundle directory. A
confirmed CBP abort_hold can be examined with the explicit
--failure-analysis shared-prefix mode documented in
Teaching playback and servo-mode comparison.
The checked-in config/follow_example.toml documents every option. Input paths
are relative to that TOML file. Output
paths are invocation-relative and are created exclusively; an existing file
is refused. The main processing controls are:
control.rate_hz: one 20 to 200 Hz cycle rate for every phase. Hardware timing has been validated at 100 Hz; other rates print an experimental-use warning.control.mode:positionorcurrent-based-position. Current-based position requires one or eight positivecurrent_based_position.effort_limit_nmvalues, each no greater than the deployment limit.home: linear, trapezoidal, or minimum-jerk PTP motion to the first reference frame. Duration is the greater ofmotion_time, when present, and the duration required byvelocity_limit. Strict mode refuses tracking if the measured home error remains abovetolerance_radafter bounded correction retries. Non-strict mode records and warns about that error.reference_processing: no filter, first-order low-pass, moving average, or Savitzky-Golay filtering, followed by linear or shape-preserving cubic interpolation at the control-cycle times. Filtering preserves the authored first and final frames. The interpolator provides joint position, velocity, and acceleration at arbitrary times even when the.zvsand control rates differ.safety: a one-time tracking warning, a sustained-error abort threshold and duration, and a larger immediate-error abort threshold. There is no strict endpoint convergence gate during tracking. These thresholds detect gross disagreement without turning ordinary servo following error into a phase transition.finalization: a positivewait_time_sholds for that duration. Zero keeps the final posture commanded until the operator supports the arm from below and presses Enter, bounded byoperator_timeout_s. The nonblocking Enter check cannot starve the hardware command cycle.simulation.link_force: an optional prescribed link-force disturbance forx7_follow_sim; the hardware frontend ignores it. See link-force disturbances.
This first version deliberately uses one homogeneous motor mode for home, tracking, and finalization. Changing a Dynamixel operating mode requires torque to be disabled. A mode change at the home-to-tracking boundary would therefore introduce an unsupported gravity-drop interval. Supporting different phase modes requires a separately reviewed in-place transition protocol.
The simulation converts position commands to bounded PD torque, then integrates the robot dynamics. Current-based position uses the same position adapter with the requested effort ceiling. These adapters verify phase logic, interpolation, safety gates, and command saturation. They are not a high-fidelity model of the Dynamixel firmware, current loop, friction, backlash, or gear compliance.
Motor parameters and hardware run¶
An optional motor_parameters input accepts the versioned TOML produced by
dxl_inspect dump-params. Keep only the parameters reviewed for this run and
remove operating_mode: control.mode owns that register. Unknown motor IDs
are refused before bus contact. During activation the batch is applied and
read back transactionally while every servo is torque-off; incomplete rollback
aborts activation. Activation then checks Drive Mode again and refuses a
drive_mode with bit 3 (Torque On by Goal Update) set, since its goal snap
would switch torque on early. The bundle copies this exact parameter input.
After completing the hardware bring-up checklist and reviewing the simulation log, use position mode for the first hardware trial:
./build/apps/x7_follow --config config/follow_example.toml --check
run_stamp=$(date +%Y%m%d-%H%M%S)
./build/apps/x7_follow --config config/follow_example.toml \
--log "follow-hw-${run_stamp}.csv"
--check performs configuration, model, reference, joint-limit, velocity,
effort, and motor-parameter-file validation without opening the bus. A real run
uses the feedback-synchronized hardware cycle, servo and host watchdogs, stale
command rejection, and verified shutdown. Keep the actuator power cutoff in
reach. At completion, support the arm from below before Enter; torque-off makes
the arm fall limp. Any home refusal, tracking abort, I/O failure, operator
timeout, stale submission, or unclean shutdown is a failed run.
The run ends with the background thread's cycle statistics: the cycle,
overrun, stale and deadline-miss counts, a hardware faults: line (read and
write failures, maximum lateness, maximum feedback age at submission), and
host-measured phases: quantiles of each phase of the cycle. --timing-log
FILE (hardware only, not with --bundle; x7_track accepts it too) also
writes one CSV row of host stamps per background cycle, drained off the control
threads; an incomplete timing log fails the run. The cycle column numbers the
rows 1, 2, ... over the whole run, and segment counts background-thread runs:
x7_track restarts its thread at the mode switch, so its log has two.
deadline_miss marks a window that closed with no submission while a
controller was armed. After the arm is released the app also writes
FILE.summary.toml, which holds the run status, whether the log is complete,
and the cycle counters both when the controller finished and after the thread
stopped (an existing file is refused before the bus is touched). The
stamps are host
observations: read_start_ns is when the host began the feedback transaction,
not when the servos sampled, and write_return_ns is when the host's write
returned, not when the bytes left the adapter.
--hold-current SECONDS and --sweep-current JOINT:AMPLITUDE:DURATION
(hardware only; not with --reference, --check, or --bundle) replace the
configured reference with one built from the posture the arm is resting in.
The posture is read torque-off before activation. The hold keeps it; the sweep
moves one canonical arm joint (0 to 6) out by AMPLITUDE radians and back along
two minimum-jerk halves of DURATION/2 seconds each. Both references start
exactly at the measured posture, so the run never homes or corrects: there is
no homing or home-correction cycle, and every command is the reference itself.
It refuses before any motion command if the arm has moved more than 0.005 rad
from that posture by the time tracking would begin (status home_refused),
and it aborts tracking once any joint is 0.05 rad from the reference (status
posture_departure; a provisional bound, tighter than the general [safety]
gates). That check runs on each feedback sample before the reference is
commanded from it: the cycle whose feedback departed is answered with a hold at
that sample's posture, never with the reference. The generated
reference is written to <log>.reference.zvs (an existing file is refused) and
validated like any reference before torque-on. It requires filter = none,
since a filtered reference would no longer start at the posture. These modes
let a new control rate be exercised without a multi-joint homing motion: hold
first, then a wrist-only sweep (--sweep-current 6:0.3:6).
Portable follow bundles¶
Create a new immutable simulation archive:
./build/apps/x7_follow_sim --config config/follow_example.toml \
--bundle backups/follow-sim-20260827
For hardware, replace x7_follow_sim with x7_follow. The requested bundle
path must not exist. It is refused before the source configuration is loaded,
and publishing uses a no-replace rename. --check and --bundle are mutually
exclusive. A completed archive contains source.toml, portable follow.toml,
the reference, deployment and optional motor parameter files, model and meshes,
the frontend outputs, result.toml, and a SHA-256 manifest.toml. Normal
controller refusals are archived with their result and full log; setup failures
remove the private staging directory.
Replay a simulation bundle into new files, leaving the archive unchanged:
./build/apps/x7_follow_sim \
--config backups/follow-sim-20260827/follow.toml \
--motion /tmp/follow-reproduced.zvs \
--log /tmp/follow-reproduced.csv
cmp backups/follow-sim-20260827/simulation.zvs /tmp/follow-reproduced.zvs
cmp backups/follow-sim-20260827/simulation.csv /tmp/follow-reproduced.csv
For strict reproduction, build the Git commit recorded by the manifest. A hardware replay is intentionally not expected to be byte-identical because measured state and bus timing are physical inputs.
Link-force disturbances and the force-budget screen¶
These tools support disturbance experiments in which a force acts on the arm during motion and is then removed, so that the baselines here and controllers in dependent projects can be compared under one loading rule. They provide a reusable simulated disturbance and an offline load screen. Physical apparatus operation and fuse qualification are outside this repository.
Link-force specification¶
One rtctrl-x7-link-force TOML file describes the disturbance for the
simulators, the force-budget screen, and external code
(model::loadLinkForce). config/link_force_example.toml:
format = "rtctrl-x7-link-force"
version = 1
link = "crane_x7_tcp_link"
point_link_m = [0.0, 0.0, 0.0] # in the link's own frame
magnitude_n = 3.0
direction_world = [0.0, 1.0, 0.0] # or anchor_world_m = [x, y, z]
[profile]
onset_s = 0.4
rise_s = 0.2
hold_s = 0.6
fall_s = 0.2
direction_worldis a fixed world direction, normalized on use.anchor_world_minstead pulls the application point toward a fixed world point, which models a cable over a pulley. Exactly one is required.- The amplitude is
magnitude_ntimes a profile that is zero before onset, rises overrise_swith a raised cosine, holds, and falls overfall_swith a raised cosine. Both ramps have zero slope at their ends, so the force has no steps.rise_sandfall_smust be positive and all four profile keys are required. - The profile clock starts at the first tracking cycle (the feedback time of
that cycle's state) and runs in elapsed tracking time. It is not scaled by
playback_rate, so compare runs only at the same playback rate and reference processing.
Every controller receives the same scalar force profile under the same loading rule. In anchor mode the realized world vector and joint torques depend on where each controller holds the attachment point, so they are logged rather than assumed equal. A fixed world direction is the simpler first comparison.
Simulating a disturbance¶
Point the simulation table of a follow or track configuration at a spec:
[simulation]
link_force = "link_force_example.toml" # relative to this config
x7_follow_sim and x7_track_sim load the spec during --check, reject an
unknown link and an onset at or after the end of the run (tracking plus final
hold), and warn when the profile outlasts the run. The force is added to the
forward dynamics as J^T f after the actuator effort clamp, so it is never
truncated by the effort limits and the controller sees it only through motion.
SimArm::setDisturbance, the older constant joint torque, is applied before
that clamp instead.
Besides the main log, a run writes <log stem>_disturbance.csv (in a bundle,
simulation_disturbance.csv) with one row per simulator step attempt. Each row
records the attempt index, the step's start_seq/end_seq in the main log's
feedback_seq numbering, its sim-time bounds, the last completed substep's
force, application point and joint torques, and the force and joint impulses
of the completed substeps. Within a substep the force is constant at its value
at the substep start, so the impulses are exactly what the integrator applied.
A substep that contains the end of the rise, the end of the hold, or the
release ends there, so every phase of the profile is sampled even when it is
shorter than the integration step (integration_step_s). A pulse shorter than
one control period, or than one integration step, therefore still appears in
its row's impulse. A phase shorter than the integration step is applied as one
constant sample, though: the shape, and with unequal ramps the impulse, is
resolved only to the integration step.
Join the two logs by seq, never by timestamp. The main row with feedback seq
s joins the complete row with end_seq = s (the step that produced it) and
the row with start_seq = s (the step that followed it). Some rows are
unmatched by design:
- the initial main row has no preceding step;
- the final successful step has no later main row;
- a rejected step, and every
fault_latchedrow after it, has no later main row; - a track main row recorded without a step (an assessment abort) has no following step.
Zero-substep rows repeat their start time and seq. Keep the unmatched rows in any analysis.
Once a spec is set, every substep is accounted strictly. When a nonzero force
is requested, an undefined direction (an anchor within 1 mm of the point) is
anchor_fault and a non-finite force is non_finite_force; for every
substep, a failed dynamics solve is solve_failed and a non-finite
acceleration or state update is non_finite_state. The update is checked
before the joint stops, which could otherwise clip an infinite position to a
finite limit. A zero requested force (before onset, after
release, or a zero magnitude) never evaluates the direction. A rejected
substep commits nothing: the state and the clock stay at the last completed
substep, and the simulator latches. It then refuses feedback and commands,
records fault_latched for further steps, and still deactivates. The run
fails with the status printed. Failing to write a disturbance row is
different: the physics stays complete and feedback stays valid, but the step
and the run fail because the log is incomplete.
JointState::tau in the main log keeps its meaning: the servo-equivalent
torque before the model-coordinate effort clamp. Under saturation it can
differ from the effort the dynamics used, so only the disturbance log is exact
about what was applied. The tracking-error columns measure error against the
time-indexed reference. Analysis of rejoining the path after a delay belongs
to the controller under study and must separate path deviation from delayed
progress.
Bundles archive the spec as link_force.toml, write
link_force = "link_force.toml" into the portable configuration, and add
provenance to result.toml: link_force_enabled, link_force_started (the
tracking start was reached), and link_force_applied (a completed substep
applied a nonzero force) with the first and last application times. A replay
reproduces all three outputs byte for byte. Hardware frontends ignore the key,
print a notice that it is simulation-only, and record
link_force_enabled = false with a note: an archived simulation spec is not
evidence that any apparatus applied a force.
Force-budget screen¶
x7_force_budget is a model-based screen with this contract: compute the
largest force amplitude satisfying user-supplied joint holding-torque
allowances at sampled reference poses under a quasi-static model. It is not a
hardware safety or fuse rating. It never opens the bus.
./build/apps/x7_plan_ptp --config config/ptp_example.toml
./build/apps/x7_force_budget --config config/force_budget_example.toml
At every sample (N = ceil(duration * sample_rate_hz) intervals, endpoints
included, one sample for a zero duration) it evaluates the gravity load g
at the reference pose and the joint torque per newton a = J^T u of the
spec's application point and direction. The bound requires feasibility for
every amplitude from zero up to it, |g_i - a_i F| <= allow_i for all
0 <= F <= F_max:
- a joint whose gravity load already exceeds its allowance is infeasible, even if some positive force would compensate it;
- otherwise the joint bound is
(allow_i + sgn(a_i) g_i) / |a_i|, computed without avoidable overflow; a_i = 0imposes no bound from that modeled constraint (inf), which never means unlimited physical loading;- a bound that cannot be represented, a non-finite pose, gravity, point, or torque coefficient, and a degenerate anchor are failed evaluations.
The amplitude bound is the minimum over joints and samples, reported with the
binding joint and the earliest binding time, plus a disturbance-only bound
that ignores gravity. The whole reference path is screened, and denser
sampling is not a continuous-path guarantee. The tool prints the bound, the
planned magnitude_n, and a headroom ratio. The ratio reads n/a when the
planned magnitude is zero, the bound is unbounded, or the evaluation failed.
Only a successful evaluation whose planned magnitude is within the bound
prints within the supplied sampled model allowances and exits 0. Exceeding,
infeasible, and failed evaluations exit 1 and still write the CSV. Invalid
input exits 1 without one. The CSV begins with # lines that carry the
contract and qualification, then one schema-versioned row per sample.
budget.joint_allowance_nm (one or eight values) is an engineering input
that this screen does not establish. Actuator effort limits, such as the
torque constant times the current limit or the ceilings derived for the EFL
study, describe actuator and model effort, not allowable external mechanical
loads. The screen excludes motion transients, off-path yielding of compliant
controllers, fuse release, friction, bearing and bracket loads, and the
individual finger-linkage loads behind the gripper's reduced torque. Selecting
a physical fuse, including its release tolerance and transient loading, is a
separate engineering decision.
Using a link force from your own controller¶
Dependent projects drive the same disturbance through the library. Set the spec before the run, start its clock when tracking starts, and attach the interval log:
#include "rtctrl/arm/link_force_log.hpp"
#include "rtctrl/arm/sim_arm.hpp"
#include "rtctrl/model/link_force.hpp"
const auto spec = model::loadLinkForce("config/link_force_example.toml");
arm::LinkForceCsvLog log("run_disturbance.csv"); // exclusive; outlives sim
arm::SimArm sim(options);
sim.setLinkForce(spec); // strict accounting from here on, force still zero
sim.linkForceLogTo(&log); // one row per step() attempt
sim.setMode(arm::ControlMode::Position);
sim.activate();
// ... at the first tracking cycle, with that cycle's feedback state:
sim.startLinkForce(state.t);
// ... after the run:
const bool clean = !sim.linkForceFaulted() && !sim.linkForceLogFailed() &&
log.close();
model::evaluateForceBudget and model::writeForceBudgetCsv expose the
screen in the same way.
Writing a controller (the bridge)¶
A controller is one function, written once, run anywhere:
#include "rtctrl/arm/runner.hpp"
struct MyController : arm::Controller {
explicit MyController(const arm::JointState& start) {
zVecCopyNC(start.q.get(), home.q.get()); // capture home ONCE
}
void update(const arm::JointState& state, arm::JointCommand& cmd,
double t) override {
(void)state;
cmd.mode = arm::ControlMode::Position; // or Velocity / Current
zVecCopyNC(home.q.get(), cmd.q.get()); // hold home + offset
const double ramp = std::min(1.0, t / 3.0); // no step at t = 0
zVecElemNC(cmd.q.get(), 6) += 0.3 * ramp * std::sin(t);
}
arm::JointState home;
};
Two safety habits are baked into that shape (they are what
examples/x7_wave.cpp does): the reference is anchored to a
captured posture, never an absolute value that would command a jump
from wherever the arm actually is, and the offset ramps in from zero
so the first command equals the measured posture.
In simulation (roki forward dynamics, deterministic, no hardware):
#include "rtctrl/arm/sim_arm.hpp"
arm::SimArm::Options opt;
opt.initial_q8 = {0, 0.6, 0, -1.2, 0, -0.5, 0, 0.2};
arm::SimArm sim(opt);
sim.setMode(arm::ControlMode::Position);
sim.activate(); // no motion commanded
arm::JointState start;
sim.readState(start);
MyController c(start);
arm::run(sim, c, /*seconds=*/10.0); // read → update → write → step
On the robot (identical controller code; this listing is written as an in-repo program: the verified-shutdown guard it uses is the apps' shared plumbing, not part of the installed library API):
#include "rtctrl/arm/real_arm.hpp"
#include "rtctrl/dxl/port.hpp"
#include "rtctrl/hw/crane_x7.hpp"
// Repository-internal: the x7_* apps' shared plumbing lives under
// apps/, NOT in the installed rtctrl:: API — in-repo programs include
// it relatively (examples/ does exactly this):
#include "../apps/common/x7_common.hpp"
auto config = hw::Config::load("config/crane_x7.toml");
dxl::Port port(config.port, config.baudrate);
hw::CraneX7 hardware(port, config);
hardware.onEscalate([&port] { port.close(); }); // deadman → bus silence
arm::RealArm robot(hardware);
if (!robot.setMode(arm::ControlMode::Position)) return 1; // must match config
if (!robot.activate()) return 1; // verifies servos, arms watchdogs, snaps goals
// Verified shutdown from here on: CraneX7's DESTRUCTOR deliberately
// does not torque off, so every exit after activation must deactivate
// and CHECK the result — the x7_* apps share x7::ShutdownGuard
// (apps/common/x7_common.hpp), which also silences the bus on an unclean
// deactivation so the servo watchdogs halt the arm.
x7::ShutdownGuard shutdown{hardware};
arm::JointState start;
if (!robot.readState(start)) { shutdown.run(); return 1; }
MyController c(start);
const bool ok = arm::run(robot, c, 10.0);
const bool clean = shutdown.run(); // deactivate + verify; quiesce on failure
return ok && clean ? 0 : 1;
(examples/x7_wave.cpp is a complete example using this pattern,
including the apps/ header the same relative way, runnable against
dxl_emu or the robot.)
arm::run returns false for several distinct reasons. Pass an
arm::RunReport as its last argument to learn which: it names the end
(arm::describe(report.end): a failed read, a feedback gap or over-long
interval, a rejected command, an observer veto, a failed step, and so on),
the cycle, and the sequence numbers and timestamps of the last accepted and
the final sample. The report is filled during the run and read at its end,
so nothing is printed per cycle; x7_wave prints it on an abort.
readState gives positions, velocities, and torque estimates
(\(\hat\tau = k_t\,i\)). On hardware it returns a fresh sample while that
sample's bounded command window is open; step() blocks until the next
successful feedback read and returns false after a safety escalation. The
shipped controllers arm::GravityComp, arm::ComputedTorque, and the retained
historical arm::PracticalComputedTorque follow
exactly this pattern; see the
theory documents and their
sources for worked examples.
Logging from a control loop¶
Do not write files from update(), a CycleObserver, or anything else on the
control thread. A buffered write to a regular file can block in the kernel for
tens to hundreds of milliseconds (journal commits, device power states, other
processes' fsync calls; a 162 ms append was measured on the development
workstation). On hardware a 25 ms stall makes arm::run abort on the feedback
gap, and a 250 ms stall trips the submission deadman. Queue the rows through
util::AsyncWriter instead; every app run log uses it:
#include "rtctrl/util/async_writer.hpp"
util::AsyncWriter log("run.csv"); // exclusive creation; starts its writer thread
log.appendf("t,q0\n");
log.commitRow();
// per cycle: format in memory and queue; the file is never touched here
log.appendf("%.4f,%.6f\n", t, zVecElemNC(state.q.get(), 0));
if (!log.commitRow()) { /* a row was dropped or a write failed */ }
// after the shutdown:
const bool log_ok = log.close(); // drains, flushes, closes
The queue is bounded (4 MiB by default, about 30 s of a 100 Hz log with
1.2 kB rows), so a commit never allocates or waits for the file. The writer
thread hands the queue to the file every 20 ms; that interval is nominal,
since a blocked write delays the next one. A row that does not fit, and any
failed write or flush, latches the writer: later rows are refused and
close() returns false, so a log is either complete or reported incomplete,
never silently gapped.
Failure detection is asynchronous and has no time bound. A write's failure is
known only when the write returns: while a write is blocked in the kernel,
commits keep succeeding and ok() stays true. The failure then surfaces at the
next commitRow, and close() always reports it. A queue overflow is reported
by the commit that hits it. A killed process loses the unwritten part of the
batch being written (up to the queue capacity) and every row queued behind it
(up to the capacity again), so up to about 8 MiB with the default; without a
blocked write that is about the last 20 ms of rows.
Whether a failed log aborts the run is the application's decision. x7_follow
and x7_track abort once a failure is known, as they always did on a failed
write. x7_float, x7_gravity_demo, and x7_teach finish the session,
because an abort would de-torque an arm the operator may already have
released, and then void it.
A per-cycle .zvs export (the joint sequence rk_anim replays) follows the
same rule: model::AsyncZvsWriter writes model::ZvsWriter's format byte for
byte, with the file I/O on a writer thread, and x7_wave --zvs uses it.
ZvsWriter itself writes on the calling thread, so it is for offline tools
only.
Talking to servos directly¶
For tools and experiments below the bridge:
#include "rtctrl/dxl/port.hpp"
#include "rtctrl/dxl/sync_group.hpp"
dxl::Port port("/dev/ttyUSB0", 3000000);
dxl::SyncGroup group(port, {2, 3, 4, 5, 6, 7, 8, 9});
group.setupIndirect(); // once, torque OFF (EEPROM-gated)
std::vector<dxl::Feedback> fb;
group.readAll(fb); // ONE bus transaction, SI units
port.write8(8, dxl::reg::kLed.addr, 1);
The dxl_inspect app is this API as a CLI. In tests, substitute
emu::FakePacketIO for Port behind the same PacketIO interface,
or run against dxl_emu's pseudo-terminal with Port itself.
Measuring bus and cycle timing¶
x7_bus_timing measures the bus with every servo torque-off and never writes
Torque Enable or Drive Mode. A timing run refuses, before any write, a servo
with torque on or with Drive Mode bit 3 (Torque On by Goal Update, firmware
v45 and later) set, since on such a servo a goal write switches torque on.
--inventory reports each servo's bus-timing registers (Return Delay Time,
Status Return Level, baud register, firmware), its Drive Mode and the USB
adapter.
A timing run replays one mode's exact per-cycle traffic at a fixed rate and
writes one CSV row of host stamps per cycle plus a summary:
./build/apps/x7_bus_timing --inventory --out inventory.toml
./build/apps/x7_bus_timing --rate-hz 500 --profile current --duration 60 \
--log bus-current-500hz.csv
--confirm-writes (each unchanged production write followed by a read of the
last servo's Model Number) and --drain turn it into a calibration run that
observes transport timing. --read-path bounded receives the grouped
read through the bounded path of control-rate Phase R (35 ms budget and an
equal guard by default, --budget-ms and --guard-ms), after a read-only
check of the bus profile. dxl/wire_budget.hpp gives the analytic wire bytes of each
cycle, and x7_controller_bench measures controller computation without a bus.
tools/timing_summary.py reduces probe logs and app --timing-log files to
measured, estimated and envelope quantities. The procedure that uses them is
control-rate qualification;
tools/e1_prod.sh and tools/e1_cal.sh run its torque-off E1 step,
tools/trace_session.sh its traced torque-off diagnostics, and
tools/trace_correlate.py checks a traced run's association with its trace
and locates each read's delay along the receive path; tools/latency_timer.py
reads and sets the adapter's latency timer for the torque-off experiment
(trace_session.sh --latency-steps), and tools/latency_hold.py is its hold
diagnostic.
On the library side, hw::CraneX7::Options::timing_ring_capacity enables the
per-cycle hw::CycleRecord ring that popCycleRecord() drains, and
CycleStats::timing always holds host-measured histograms of every phase of
the background cycle. util::RealtimePolicy applies a SCHED_FIFO priority,
CPU affinity, memory lock or fine timer slack to the calling thread, all or
nothing.
Backing up and restoring motor parameters¶
dxl_inspect dump-params captures the configuration and tuning
XM430-W350/XM540-W270 registers in a versioned TOML document. With no ids it
scans the complete Protocol 2.0 id range; trailing ids select only those
motors. Use - instead of a filename for machine-readable standard output.
# All motors found on the bus
./build/apps/dxl_inspect --port /dev/ttyUSB0 dump-params x7-params.toml
# Only ids 2, 3, and 8
./build/apps/dxl_inspect --port /dev/ttyUSB0 \
dump-params selected-params.toml 2 3 8
Each [[motor]] records its id, model number, firmware version, and a
[motor.parameters] table. Values are raw control-table integers. The dump
includes communication settings for audit completeness, but the loader treats
baud_rate, secondary_id, protocol_type, status_return_level, and
startup_configuration as dump-only. The communication fields can remove the
response path needed to verify and roll back the transaction. Startup
configuration can enable torque automatically after power-on, which is outside
this loader's torque-off contract.
To apply a file, leave only the parameter keys that should be enforced, edit their values, and run:
# Apply entries for every motor in the file
./build/apps/dxl_load_params --port /dev/ttyUSB0 x7-params.toml
# Apply only the id 2 entry
./build/apps/dxl_load_params --port /dev/ttyUSB0 x7-params.toml 2
The loader parses and validates the whole file before opening the bus. It then requires every selected motor to match the recorded model and report torque off, and completes all preflight reads before its first write. Unchanged values are skipped to avoid EEPROM wear. Changed values are read back exactly. A failure triggers best-effort rollback and reports whether rollback was fully verified. Operating-mode changes reset gains and profiles in XM firmware, so the loader snapshots and restores any such fields omitted from the file.
The document is intentionally strict: unknown keys, duplicate ids, invalid register widths, and unsupported operating-mode values are errors. Runtime state such as torque enable, Bus Watchdog, goals, telemetry, LEDs, and indirect address mappings is not part of a parameter dump.
Testing your additions¶
- Pure logic → Catch2 unit test (
tests/unit/), labelunit. - Anything touching the bus → drive it against
emu::FakePacketIO(fast) and, if it exercises new wire behavior, the pty fixture (tests/integration/). - Anything producing motion → acceptance test on
SimArmfirst; hardware only after (that ordering is the project's core rule, though sim passage is necessary, not sufficient: the rigid-joint sim cannot certify gains against gear elasticity; see the computed-torque theory notes). - Line-speed/serial-timing behavior is invisible to pty tests (a lesson learned the hard way; see the hardware findings in history.md): budget a hardware check for it.
Conventions¶
- Conventional Commits; a commit is a module plus its tests.
- Canonical joint order everywhere above the
dxllayer. - SI units (rad, rad/s, Nm, A, V) outside
dxl/conversions.hpp; raw servo units never leak upward; the deliberate exceptions are the servo-parameter passthroughs (operating-mode codes and the raw profile registers onCraneX7), which stay in register units by design. - New mi-lib quirks belong in the repo guidance (CLAUDE.md gotchas) and the project memory: several cost hours to discover.