executing-two-arm-plans-with-a-temporal-plan-graph
What it does
trajectory_a / trajectory_b ({times, joints}, inserting-pauses'
format) are resampled every dt (0.1 s) into nodes. For each node of one
arm, the other arm's nodes at earlier time steps are scanned: wherever they
collide (sphere clearance under margin, 10 mm) and then stop colliding, an
edge requires the other arm to have reached the first node past the
collision before this node starts (APEX-MR's findCollisionDeps, one_robust
variant). With execute (default) two threads step through their nodes
with robot.move_to_joints, each waiting only on its incoming edges;
execute: false returns the graph (edges: [arm, node, other arm, node]).
Checks
FakeContext unit tests (tests/bundles/test_executing_two_arm_plans_with_a_temporal_plan_graph.py):
no edges for apart arms, edges and waits for crossing plans executed by a
fake two-arm robot with one slow arm (never closer than the margin), a start
collision, a refused move, graph-only mode.
Speed drift (python -m tests.bundles._tpg_eval, CPU, inserting-pauses'
30 crossing tasks: each arm home -> a reach into the shared middle -> home in
4 s, made collision-free as timed by inserting-pauses first; each arm then
runs at a random 0.6-1.4x of its planned speed): 19 of 29 tasks have
cross-arm edges (median 3). Executed by time alone, 9 of 19 collide; with
the TPG 0 of 19, no deadlock, median makespan 5.44 s (time-indexed 5.22 s,
one arm after the other 8.69 s), median total wait 0.28 s. One task was
unresolved by inserting-pauses and one had an arm ending in the other's way;
both were skipped.
Limits
- The input plans must be collision-free as timed; a plan that collides at the same time step gives a cycle (wait on each other). Run inserting-pauses-to-resolve-two-arm-conflicts first.
- Node-to-node
robot.move_to_joints(0.1 s steps); APEX-MR's shortcutting and its action dependency graph (ADG) across tasks are not ported. - No twin run.
Provenance
APEX-MR src/tpg.cpp (TPG::init, TPG::findCollisionDeps) and
include/tpg.h, MIT (LICENSE.apex-mr); the header of scripts/run_tpg.py
lists the changes.


