name: newton-ros-parity
description: "Validate or replay Moleworks Newton observations through moleworks_ros. Use when bringing up the ROS parity stack, checking /clock and TF, debugging controller-facing terrain topics, replaying Dig3D-style comparisons, or cleaning up stale ROS/Newton processes after parity work."
Newton ROS Parity
Use this skill for Newton <-> moleworks_ros parity and replay workflows. Pair it with ros2-debugging for TF/topic primitives.
Source Of Truth
Start from the active branch docs and scripts:
docs/ros/WORKTREE_SETUP.mddocs/ros/DOCKER_RUNBOOK.mddocs/ROS_PARITY_LOG.mdscripts/ros/AGENTS.mdscripts/ros/tests/run_compare_smoke_checks.shscripts/debug/compare_bucket_kinematics_to_pinocchio.py
Open narrower diagnostics only when needed:
scripts/ros/diagnostics/check_base_pose_match.pyscripts/ros/diagnostics/dump_synced_ros_snapshot.pyscripts/ros/diagnostics/dump_newton_height_grid.pyscripts/ros/diagnostics/dump_gridmap_sampling.pyscripts/ros/diagnostics/dump_controller_grid_bounds.py
Bringup Preference
If parity uses the running moleworks_ros container:
- Attach interactively to the container.
- Create and manage a fresh tmux session inside that shell.
- Launch components in order instead of blasting everything at once.
- Inspect pane output between steps with
tmux capture-pane.
This avoids fragile nested host quoting and makes cleanup tractable.
Health Checks Before Dig3D / Compare
Use long TF timeouts. Minimum checks:
source /opt/ros/jazzy/setup.bash
source /workspace/moleworks/ros2_ws/install/setup.bash
timeout 15 bash -lc "ros2 topic echo /clock --once"
timeout 15 bash -lc "ros2 topic echo /excavation_mapping/grid_map --once"
timeout 15 bash -lc "ros2 run tf2_ros tf2_echo map CABIN 2>&1" | head -40
Do not start the compare path until /clock, the controller-facing terrain topic, and the required TF chain are live.
Terrain Publisher Rule
- If direct analytical terrain publishing is enabled, keep the standard perception path off unless the user explicitly wants both.
- Do not leave multiple publishers on the controller-facing terrain topic by accident.
Cleanup Is Mandatory
After parity, Dig3D replay, or TorchScript comparison:
- Kill the tmux session that launched the stack.
- Scan for orphaned
ros2 launch, controller, state-publisher, and helper processes. - Kill the exact PIDs that remain.
- Re-check process lists and host/container resource usage.
Useful checks:
ps -eo pid,cmd | rg 'ros2 launch|dig_3d_controller|robot_state_publisher|mole_joint_state_publisher|publish_flat_excavation_map|compare'
docker stats --no-stream --format '{{.Name}}\t{{.MemUsage}}\t{{.CPUPerc}}' <container>
nvidia-smi --query-gpu=memory.used,memory.total --format=csv,noheader,nounits
Do not leave a stale parity stack running while starting a new one.
Kinematics Contract Notes
When debugging bucket or EE velocity parity:
State.body_qis the body-frame or body-origin pose.State.body_qdis a COM-referenced twist in world coordinates.- Public
eval_jacobian()behaves like a world-origin screw Jacobian in world coordinates. - Therefore
eval_jacobian(...) @ joint_qdis not generally equal toState.body_qd. - If parity depends on tool-point or COM velocity, transport the screw twist to the correct point or compare against an independent implementation plus finite-difference checks.
Do not interpret a Jacobian mismatch as proof of FK failure without checking the contract first.
Context Hygiene
- Prefer repo scripts and diagnostics over ad-hoc ROS archaeology.
- Keep live CLI output bounded with timeouts and
tmux capture-pane. - If the task turns into prolonged pane/log/process inspection, also use
moleworks-subagent-orchestrator.