1Department of Mechanical Engineering, KAIST
*Corresponding author
An LLM task planner invents the motions a task needs, such as climbing onto a partner's back, and a motion generator turns them into trajectories for two quadrupeds.
Some environments cannot be traversed by a single quadruped robot, for example a ledge that one robot can climb only from its partner's back or a gap that must be bridged with boxes. Solving them requires cooperative task and motion planning (TAMP). Previous works are limited to the motions of a single robot or only select actions from a predefined set of skills. We propose a framework with two parts: task planning that invents motions not defined in advance, and motion generation that realizes the invented motions. Both parts consist of large language model (LLM)-based modules and code-based modules. Task planning divides the trajectory of the whole task into steps and fixes the robot poses at the step boundaries. Motion generation produces keyframes that describe the motion of each step and turns them into a continuous trajectory through kinematic synthesis. The code-based modules check every plan and motion and return failures to the LLM-based modules for correction. The whole trajectory is then refined by trajectory optimization to satisfy the dynamics. On three simulated courses with two RAIBO2 robot models, our framework produced kinematically valid references in all 30 trials, all of which converged in trajectory optimization. Compared with several baselines, our framework showed advantages in success rate, dynamic feasibility, execution time, and generation time and cost.

An LLM task planner splits the task into solo steps of one robot and coupled steps of both robots, and fixes the robot poses at the step boundaries. It is not limited to a predefined skill set.
For every step, in parallel, an LLM motion generator outputs a walking route or a few keyframes. Code-based modules interpolate them, optimize failing intervals, and check the result every 10 ms.
Step trajectories are composed on a global timeline that synchronizes the robots only where the plan requires it, and refined by trajectory optimization.
The task planner of Course 1 (trial 3, the run shown above) invented these steps; nothing was chosen from a skill library. Each robot has its own sequence of solo steps, and the two sequences meet at the coupled step. Step through each robot's plan to see the start and end poses of each step (solo steps show only that robot) and the planner's own description.
Left: the keyframes written by the LLM motion generator, each shown until the next one. Right: the trajectory obtained from them by kinematic synthesis, on the same clock.
Motions generated from keyframes for six steps (1.5× speed). Coupled steps are generated for both robots together.




Generated kinematic references, played at 2× speed.
| Course | Kinematic success | TO convergence | Generation time [min] | Cost [USD] | Trajectory length [s] |
|---|---|---|---|---|---|
| 1 | 10/10 | 10/10 | 15.3 | 1.68 | 52.9 |
| 2 | 10/10 | 10/10 | 14.0 | 1.72 | 58.0 |
| 3 | 10/10 | 10/10 | 13.5 | 2.46 | 70.1 |
10 trials per course. Generation time excludes the trajectory optimization (TO).
Given the same inputs as our task planner and a minimal prompt, a single LLM call writes the full trajectory of both robots. Many of these trajectories pass the kinematic checks, but on the courses where one robot climbs onto or crosses over the other they contain jump-like motions that ignore the dynamics, and the trajectory optimization fails. Played at 2× speed.
| Course | Ours | Barebone | ||
|---|---|---|---|---|
| Kinematic | TO | Kinematic* | TO | |
| 1 · climb on partner | 10/10 | 10/10 | 6/10 | 0/6 |
| 2 · cross over partner | 10/10 | 10/10 | 7/10 | 2/7 |
| 3 · push boxes | 10/10 | 10/10 | 10/10 | 8/10 |
*Without the 1 cm support-edge margin; with it, 1/10, 3/10, and 9/10. TO is run only on kinematically valid trajectories.
An all-coupled planner generates every step for both robots together. At every step boundary the robot with the shorter motion then waits for its partner, and the whole motion takes longer.


The six steps shown under Method are each generated ten times with keyframes and with full trajectories written directly by the LLM.

| Step | Without | With |
|---|---|---|
| Coop. ascent | 0/10 | 10/10 |
| Coop. transfer | 2/10 | 10/10 |
| Platform ascent | 0/10 | 10/10 |
| Pillar crossing | 8/10 | 10/10 |
| Box push | 10/10 | 10/10 |
| Maze walk | 10/10 | 10/10 |
| Total | 30/60 | 60/60 |
Success of the kinematic synthesis on the same keyframes without and with the optimization. The effect concentrates on motions with height changes and many contacts.
The full prompts given to the LLM modules. The task planner and motion generator also receive the environment, the robot models, and renderings of the scene.
# Cooperative robot planning
## Task
- Generate robot-local skill sequences, necessary dependencies, and step boundary poses.
- Bring each robot to its assigned goal; no arrival order is required.
- Plan activities and dependencies before choosing step boundary poses.
- Invent solo or cooperative skills as needed, even if they are not yet implemented.
## Inputs
- The environment JSON defines the robots, obstacles, movable objects and task.
- Object centers follow zero_center_world + axis_world * position_m.
- Rendered images show the initial scene and candidate keyframes.
- Use JSON for geometry and task rules; visual markers are not obstacles.
- Use only supplied inputs and this experiment's conversation. Do not access other runs, source environments, repository history or provenance files.
- Optional calculation code may run only in temp/. Do not invoke other models or install packages.
## Constraints
- Each robot's first step starts at its supplied initial pose; subsequent starts match its preceding step ends.
- Do not invent hardware, task restrictions or mandatory cooperation.
- At their final step endpoints, both robots must have all four feet supported inside their own goal at its height.
- Collision-free boundary poses do not establish a feasible transition. Trace each proposed route through actual connected free space or traversable support surfaces, checking the full extent of walls and barriers and the robot's swept body and limb envelope. Respect task-specific non-traversable surfaces throughout the transition.
- Before a cooperative step, mentally trace the approach, alignment, contact transfers, and exit. Choose start poses that both robots can reach and that provide sufficient clearance and stable support throughout the motion.
- Do not assume that naming a new skill makes a transition feasible. For each proposed climb, crossing or support transfer, identify the intermediate support surfaces and explain how the robot can reach and clear them using its supplied geometry. Do not defer an unresolved geometric contradiction to motion generation.
- Move passive objects only through pushing contact within travel limits; check collisions during movement and access before and after it.
- Never move an object while the other robot uses it as support.
- A yielding or waiting pose must keep the robot's entire geometry clear of the partner's route and the movable object's complete swept volume, with positive clearance. Checking only the feet or the object's initial and final positions is insufficient.
- Boundary poses use nominal joints and zero roll/pitch, with all four feet supported on horizontal surfaces at one height.
- Choose step boundaries that permit both arrival from the preceding activity and departure into the next activity. After crossing an obstacle, clear the entire robot before restoring nominal standing or starting ordinary walking; merge adjacent phases when no suitable nominal boundary exists.
## Preferences
- Prefer routes with ample clearance, stable support, and straightforward approach and alignment.
- Prefer connected terrain routes, ramps and intermediate supports over large direct climbs or tightly constrained obstacle crossings when they offer a geometrically clearer transition. Compare alternatives before committing to a demanding maneuver.
- Among similarly feasible routes, prefer less travel and waiting.
- Among feasible plans, prefer the shortest estimated overall task completion time, rather than simply fewer steps or less total travel. Compare alternative robot assignments and action orders, including their travel, manipulation and waiting costs along dependency chains.
- Do not move an access-enabling object early by default. Compare early preparation by one robot with moving it when another robot reaches the required contact side. Prefer the assignment that reduces overall completion time while preserving clearance and independent progress.
- Apply dependencies only to the motion that requires clearance. Perform safe preparation beforehand, and finish waiting poses aligned for the next motion when feasible.
- When yielding or enabling access, end at the first valid nominal pose where the entire robot, including its legs and feet, has sufficient clearance from the paths of the partner and moving objects. Separate remaining travel. Release the dependency there only if access remains clear.
- Before adding waits or detours around a shared passage, compare both traversal orders and prefer the one that avoids blocking subsequent approaches.
- Absorb very short repositioning into an adjacent step by adjusting its boundary when feasible, including ending directly at the goal. Preserve necessary dependency, cooperative, and distinct-skill boundaries.
- Prefer contact-based motions with continuous support and low impact over highly dynamic motion.
- For ascents or descents of about 0.5 m or more, consider partner support for stability and lower impact.
- When crossing a partner's back, prefer sideways alignment if it improves support width. Choose either sideways heading to minimize travel and turning.
## Output contract
- Read inputs/output_schema.json and write the matching JSON result to temp/model_output.json, relative to the workspace root. Use English and exact supplied IDs. Do not repeat the JSON in the final chat message.
- Define each robot's step sequence. Solo steps belong to one robot; both robots reference the same cooperative step. Use cooperative for coupled participation during an activity.
- Add only additional finish-to-start dependencies. A robot that finishes a predecessor may continue its own sequence.
- Separate ordinary walking or turning from non-locomotion skills whenever a valid nominal boundary allows it. Keep movements essential to the skill's contact transitions within that skill. Use unique IDs for activities with different conditions. locomotion means ordinary walking/turning on connected horizontal support.
- Declare required object states and changes. Order changes so they do not occur while another step requires that state.
- Supply start and end {x, y, yaw} for each solo step and each cooperative robot role.
- Resolve shared-space or object conflicts through routes or dependencies. Choose waiting poses that do not obstruct movement.
- Python builds preview pairs from ready steps and propagates robot/object states into full-scene keyframes. These are review examples, not execution-time barriers.
## Feedback protocol
- Python performs validation and rendering; propose or review plans rather than invoking these tools.
- Initially or after changes, write action=propose to that file with the complete plan with step boundaries.
- Review the latest feedback and relevant images. Recheck transition routes beyond the host's boundary checks.
- Correction images show only failed keyframes. After a repair passes validation, new attachments are limited to those previously failed keyframes; unchanged views are not repeated. Other keyframes remain checked and saved, and a valid draft without failures may have no new images.
- Accept only the latest host-valid candidate when no changes remain by writing this to temp/model_output.json: {"action":"accept","plan":null}.
- If supplied facts establish infeasibility, write action=propose to that file with plan.status=infeasible. Explain why in plan.summary; return empty robot_plans, solo_steps, cooperative_steps and dependencies.
# Keyframe and locomotion generation
## Task
- Generate a walking route or keyframe sequence from the supplied initial state to the goal state, following the step's intended activity and contact requirements.
## Inputs
- inputs/motion_info.json defines the activity, active_robots, robot_mapping, initial/goal states and reference_speeds, with gc_order for interpreting the initial and goal GC values.
- inputs/environment.json defines environment geometry, movable objects, contact_tolerances_m and cooperative robot_contact policy.
- inputs/keyframe_format.json defines the keyframe or walking-route representation inside the submitted JSON file's motion field.
- inputs/rsc/robot_summary.md provides robot dimensions, joint transforms/limits, collision shapes and nominal foot positions. Refer to this summary instead of the full URDFs for robot information. URDF and mesh files are tool assets.
- Initial-call attachments show the initial state first and the goal state second, with only participating robots visible.
<!-- robot-api:start -->
- inputs/robot_api.py provides FK/IK, coordinate and anchor conversions, batch IK and collision checks.
- inputs/robot_api_interface.md describes API usage. Refer to this document instead of reading or copying the implementation source, and call the public functions.
<!-- robot-api:end -->
## Framework rules
- Use only this workspace and session. Keep calculation code and intermediate results under temp/; never modify inputs or trusted tools.
- Print only concise diagnostic information needed for the next decision. Save complete model information and detailed per-frame results to temp/ files.
- Use locomotion only when a planar body route is sufficient to specify the motion. Along the entire route, the robot must be able to use its default walking gait on continuous, sufficiently wide horizontal support, while keeping body height, roll and pitch constant. The body, legs and ordinary foot swings must have adequate clearance. There must be no object changes or cooperative contacts.
- Use keyframes when feasibility depends on choosing particular footholds, placing feet on separate or narrow supports, crossing gaps or obstacles, or changing body posture to obtain clearance. Equal initial and goal heights are not sufficient for locomotion.
- Avoiding obstacles by routing around them may use locomotion. Traversing them through deliberate body or foot maneuvers requires keyframes. When uncertain, choose keyframes. Do not mix modes within a step.
- The submitted mode must match the representation actually constructed and checked. If you constructed a keyframe sequence, return that sequence as mode=keyframes; do not replace it with body-only locomotion endpoints to shorten the response.
- In locomotion, keep base height constant and roll/pitch zero. Place the xyz/yaw waypoints needed to describe the route and maintain collision clearance.
- In keyframes, envision the complete motion and foot-transfer sequence. Record a keyframe whenever one foot or one diagonal pair finishes landing. Add intermediate states needed to represent body, supporting-robot or object motion without foot transfers.
- Each participating robot has all four feet on valid supports at each keyframe. Supports may differ between feet; free and self-support are invalid. A landed state does not imply a body stop or a return to a symmetric nominal pose.
- Place intermediate landing states so that foot transfers between consecutive keyframes, including the initial and goal states, obey the shared support constraints. Do not omit transfer completions or output airborne swing midpoints.
- Candidate searches and numerical optimization are allowed for keyframe poses only; internal checks do not replace final host validation.
- Consider the complete motion when selecting keyframes, but limit numerical calculations and checks to the keyframe poses. The host generates, checks and repairs trajectories between keyframes.
<!-- robot-api:start -->
- Prefer the provided check_collisions for single-pose collision queries. Check the requested poses while revising. Internal checks do not replace final host validation.
- Reuse loaded contexts and prefer batch IK for repeated solves. Use IK failure_details and joint-change diagnostics when useful.
<!-- robot-api:end -->
<!-- motion-guidelines -->
## Output contract
- Write temp/model_output.json with only a motion field containing the representation matching inputs/keyframe_format.json. Include only the specified fields. Submit the numeric data file, not source code or reconstruction instructions; do not repeat its contents in the final chat message. You may use calculation code under temp/ to construct and check the keyframe poses before writing the computed numeric values and identifiers to the file. The host determines timing, durations and sampling. Do not add timing fields or numerically construct transitions.
- Inside motion, for keyframes write {"mode":"keyframes","keyframes":[...]}. Each keyframe contains robots and object_states. Include exactly active_robots; cooperative robots share each keyframe index. Each robot contains base_position_xyz, base_orientation_rpy and feet with LF/RF/LH/RH. Each foot contains contact_point_xyz and support.
- Supply world-frame surface contact points rather than foot sphere centers. Body positions are world-frame xyz and orientations are roll/pitch/yaw; units are metres and radians.
- Support IDs are ground, supplied static/movable object names or another active robot alias. Avoid unnecessary rounding that would exceed the supplied contact tolerances.
- Each keyframe's object_states includes exactly the objects listed in this step's object_changes, with position_m inside their travel limits; use {} when none are listed. Other objects retain their supplied states.
- Output only intermediate keyframes. The host inserts the exact initial and goal states; the same foot-transfer rules apply to both boundaries. Do not duplicate the goal when it represents the final landing. Return an empty list only when no intermediate states are needed.
- Inside motion, for locomotion write {"mode":"locomotion","robot":"R1","keypoints":[{"base_position_xyz":[x,y,z],"yaw":yaw},...]}. Use the supplied active robot alias and provide at least two points including the exact initial and goal body positions and yaw. Do not add extra fields.
## Feedback protocol
- On the initial call, write the full intermediate keyframe sequence or walking route to temp/model_output.json matching the supplied format.
- After each call, the host reads the submitted JSON file. For keyframes, it validates and renders the supplied poses. For locomotion, it checks and renders representative standing poses at the route points, using the initial joint posture at intermediate points and the exact supplied initial/goal poses at the endpoints. It checks collisions, joint limits, foot support and support-edge margin without synthesizing gait or checking transitions.
- When this session resumes, review the supplied diagnostics and images and revise the requested representation. Keep input conditions and validation tolerances unchanged.
- For keyframe revisions, the host provides all failed intermediate keyframes together with their errors, images and immediate neighboring states. IK-failed images show diagnostic seed joints, not achieved foot targets.
- When pose feedback specifies replacement_indices, recreate temp/model_output.json with only the replacement keyframes or route points in replacement_indices order inside the motion field, matching the supplied revision schema. Keep the keyframe count, all unrequested states and the exact initial/goal conditions unchanged.
- For pose-only keyframe patches, preserve the foot-transfer sequence and support-local anchors of feet not targeted for correction, while adjusting the body poses and foot placements of failed states. Coordinate adjacent replacements and both robots in cooperative frames so that the merged sequence satisfies the Framework rules. The host merges replacements and independently rechecks the full sequence.
- For pose-only locomotion patches, adjust only the requested route points while preserving the mode, robot alias and all other points. The host merges replacements and rechecks all route poses.
- Passing keyframe or route-pose validation establishes the validity of the supplied poses only. The host then synthesizes the continuous trajectory, applies geometric repair where applicable and validates the final motion.
- If trajectory synthesis or validation fails, the host provides diagnostics and available images and requests a complete replacement sequence or route using the original file format. You may change intermediate states and their count to repair the containing intervals and maintain continuity with neighboring intervals. Keep the exact initial/goal states fixed. Limit your calculations to poses; transition generation and checking remain the host's responsibility.
- Trajectory feedback images sample failure intervals padded by 1 s every 0.25 s, plus initial/final and peak-error frames. Use feedback.images for attachment order and whole-motion timestamps. A synthesis failure without a trajectory may provide textual diagnostics only.
- The host finishes when final trajectory validation passes. Each session permits one draft and at most two corrections; format, pose and trajectory failures share this correction budget. If the correction budget is exhausted, the run fails without a fresh-session retry. Stop after writing the requested JSON file; no acceptance response is needed.
## Constraints - Generate motion only for the participating robots and satisfy the supplied initial state and goal requirements. Preserve explicitly fixed boundary poses, required contacts and movable-object endpoints when specified. - Maintain support from at least three feet, or from a diagonal pair: LF–RH or RF–LH. Relocate at most one foot or one diagonal pair per robot at a time, keeping the remaining feet anchored in their support frames. Moving supports may carry those anchors through the world. - Keep every robot configuration within the supplied joint limits. Body poses and foot placements must be jointly reachable throughout the motion, including transitions between contact states. - Avoid collisions between robots, the environment and movable objects. Intended contact must not become interpenetration beyond the supplied geometric tolerances; do not use tolerances as additional free space. - Do not touch or use walls as support with any robot link, including feet. Follow the planned route around walls rather than climbing over them. Wall contact is a validation failure even without penetration. - Respect the supplied contact tolerances and permitted contact regions. When using another robot as a support, follow any specified contact frame, locations, placement tolerance and contact-count restrictions. - For each supporting foot on a finite surface, maintain at least 0.01 m between the foot sphere's projected outer edge and the support boundary, measured in the support-local plane. Account for the foot radius when choosing contact locations. - Keep movable objects within their supplied travel limits and maintain physical contact while pushing them. ## Preferences ### Continuous progression - Design the overall body progression first, then coordinate foot transfers with it. Advance the body concurrently with foot transfers and preserve smooth body position, orientation and velocity across contact transitions. - Do not force a whole-body stop at every landing or repeatedly separate foot transfers from body-only shifts. Once support is established, begin the next transfer promptly; add settling time only when needed. ### Foot transfers and stance - Prefer alternating diagonal transfers when support, reachability and collision clearance permit. Otherwise move one foot at a time while preserving the required support. - During sustained progression, alternate the leading diagonal pair when terrain permits. Avoid repeatedly advancing one pair while the other only catches up to restore a symmetric stance. Preserve staggered footholds across successive landings. - Do not repeatedly return to a nominal or symmetrically aligned pose between transfers. Use alignment or recovery poses only when required for clearance, contact changes, cooperative readiness or the final pose. - Maintain a well-spread fore–aft stance around the center of mass. Sequence foothold advances according to the direction of travel without crowding the fore and hind feet; adjust the body path or use an intermediate foothold when space or reachability is limited. ### Foot paths - Use continuous rounded swing paths with enough terrain and obstacle clearance to avoid dragging. Avoid separate lift–translate–lower phases, unnecessary detours and apex holds unless clearance requires them. - Keep touchdown gentle without stopping the whole body. Avoid abrupt changes in foot motion or robot configuration. ### Body posture - Avoid excessive lateral sway and keep torso roll modest. Use brief, small tilts when needed for clearance or support transfer, then return toward level. Prefer adjusting footholds, foot paths or body height over large torso rolls. ### Pace and efficiency - Use the supplied reference speeds as the intended default pace for body translation and rotation. Maintain a natural pace consistent with actual travel distance, accumulated rotation and necessary support transfers. - Slow down locally only while alignment, contact transfer or clearance requires it, then resume the normal pace. Avoid rushing an entire action or slowing the entire motion because one maneuver is delicate. - Give each foot transfer enough time for a rounded clearance path and gentle touchdown. Avoid abrupt changes in joint angles or foot positions. - Avoid excessive short steps, unnecessary waits and long durations for small movements. ### Object contact and cooperation - If assistance from another participating robot is available and an action or obstacle cannot be handled alone while satisfying support, reachability and collision constraints, use coordinated cooperative motion rather than forcing an infeasible solo motion. Choose complementary roles and contact interactions appropriate to the task and geometry, preserving any roles and contact conditions already specified. - When using a partner's back as a stepping surface, align the supporting robot sideways, with its torso's fore–aft axis approximately perpendicular to the supported robot's direction of ascent or crossing. Choose either sideways heading according to clearance and required turning. Complete this alignment before the first foot lands on its back, and maintain the supporting heading while those contacts remain established. - For box pushing, prefer shoulder contact with walking feet when feasible. Lower contact toward the box's center-of-mass height and shift the body slightly forward relative to its feet rather than pitching forward. Preserve foot clearance and pushing contact. - A robot providing support should maintain a stable supporting pose and contact surface. Move it when needed for the cooperative task, while coordinating both robots to avoid unnecessary disturbance of established support contacts. - Apply these preferences within the constraints above. Terrain and required contacts may justify sequential transfers, aligned poses, brief pauses or local slowing; they do not justify violating support, reachability or collision constraints.
@article{kim2026cooperative,
title = {{CoTAMP}: Cooperative Task and Motion Planning for Quadruped Robots with Large Language Models},
author = {Kim, Woojin and Hwangbo, Jemin},
journal = {arXiv preprint},
year = {2026}
}