Official implementation of LLM+MAP: Bimanual Robot Task Planning using Large Language Models and Planning Domain Definition Language. The code runs LLM+MAP on the bimanual humanoid robot NICOL in CoppeliaSim and includes the evaluation scripts.
What can be run.
- Without a simulator:
plan_generation.py,ablation_study.pyandscene_understanding.py.- With CoppeliaSim:
main.py,plan_validation.pyandNICOL/task_config_generation.py, which control the NICOL robot. See NICOL simulation.
- Tasks
- NICOL simulation
- Repository structure
- Installation
- Usage
- Outputs
- Troubleshooting
- Acknowledgements
- License
| Task | Goal | Skills | Configs |
|---|---|---|---|
ServeWater |
Pour the water from the blue cup into the yellow cup. Serve the yellow cup to the human and put the blue cup into the box. | grasp, move_to, move_above, pour, release | 100 |
ServeFruit |
Put the apple and the banana into a large bowl. Bring the bowl to the human with both hands. | grasp, move_to, move_above, place, push, release, co_hold, co_move_to | 100 |
StackBlock |
Stack the selected colored blocks into two piles on the tray in front of the human. | grasp, move_to, move_above, place, release | 100 |
Each task config (task_configs/<task>/task_config_<i>.json) holds a randomly sampled scene:
- the object poses,
- the ground-truth table areas of the objects (left / overlap / right),
- the task description and the ground-truth visual description.
plan_generation.py uses these configs directly, so no simulator is needed.
The robot experiments run on NICOL in CoppeliaSim. The simulation builds on nicol_coppeliasim, the open-source CoppeliaSim environment of NICOL from the Knowledge Technology group at the University of Hamburg.
In the paper, the robot was controlled through the NICOL API (nicol_api) by Lennart Clasmeier and Jan-Gerrit Habekost. It is the group's robot interface: the same calls drive the physical robot (via ROS) and the simulation, and it solves the arm kinematics with CycleIK.
This repository ships NICOL/nicol_sim.py, a stand-in driver for NICOL in CoppeliaSim.
plan_validation.py and main.py take --ik to choose how the arms' joint angles are computed:
--ik |
Solver | Extra setup |
|---|---|---|
cycleik (default, recommended) |
CycleIK: a neural network trained for NICOL's arms. Used in the paper. | Install CycleIK (see Installation) |
coppelia |
CoppeliaSim's built-in solver (simIK plugin, damped least squares) | None |
dls |
Damped least squares on the URDF model, with pytorch-kinematics |
A NICOL URDF: install CycleIK, which ships one, or set NICOL_URDF=/path/to/NICOL.urdf |
To add another solver, write a class with solve(pose) that returns the 8 arm joint angles and register it in IK_SOLVERS in NICOL/nicol_sim.py.
├── plan_generation.py # Plan generation from the task configs (runnable, no simulator needed)
├── ablation_study.py # LLM+P (single-agent BFWS only) vs. LLM+MAP on the saved LLM code (runnable)
├── scene_understanding.py # Evaluate OWLv2 object-area recognition on images/ (runnable)
├── main.py # Full run on NICOL: perception → planning → execution (needs CoppeliaSim)
├── plan_validation.py # Execute saved plans on NICOL and measure success (needs CoppeliaSim)
├── owlv2_inference.py # OWLv2 detection + mapping of detections to table areas
├── tasks.py # Task classes for the simulator (needs CoppeliaSim)
├── log_utils.py # Console logging helpers
├── LLM/
│ ├── LMP.py # LLM calls: llm_pddl (LLM+MAP) and llm_direct (LLM-direct baseline)
│ ├── prompts.py # System prompts, rules and per-task skill descriptions
│ └── code_blocks.py # PDDL domain, problem template, actions and FMAP/BFWS solver code
├── NICOL/
│ ├── nicol.ttt # CoppeliaSim scene with the NICOL robot
│ ├── ServeWater.ttm, ServeFruit.ttm, StackBlock.ttm # Task models
│ ├── nicol_controller.py # Runs a two-hand plan step by step
│ ├── nicol_executor.py # Robot skills (grasp, pour, place, ...)
│ ├── nicol_sim.py # Stand-in driver for NICOL in CoppeliaSim, selectable arm IK
│ ├── utils.py # Plan parsing into per-hand commands
│ └── task_config_generation.py # Sample new task configs in the simulator (needs CoppeliaSim)
├── task_configs/<task>/ # 100 scene configs per task
└── images/ # Example scene images from NICOL's eye camera
1. Python environment (tested with Python 3.10):
conda create -n llm_map python=3.10 && conda activate llm_map
pip install -r requirements.txt2. FMAP. It is installed with up-fmap, but it needs a Java runtime on your PATH (tested with OpenJDK 17).
3. BFWS planner (optional: skip this if you plan with FMAP only, --use_bfws false).
- Build the
ff-versionof BFWS against LAPKT, following their instructions. - Tell the code where the binary is:
export BFWS_BIN=/path/to/BFWS-public/ff-version/bfws # or put `bfws` on your PATH4. LLM API keys. Keys are only read from environment variables:
export OPENAI_API_KEY=... # OpenAI models (gpt-4o, gpt-4.1, o1, ...)
export OPENAI_BASE_URL=... # optional: any OpenAI-compatible endpoint
export DEEPSEEK_API_KEY=... # optional: deepseek-* models5. Simulator (only for the scripts that control NICOL).
- Install CoppeliaSim 4.5.1, as described in the nicol_coppeliasim README. Newer versions may not work.
- Install CycleIK, the default IK solver. It must be an editable install, because it loads its config and the NICOL URDF from the cloned folder:
git clone https://github.com/jangerritha/CycleIK.git && pip install -e CycleIKThe pretrained NICOL weights are downloaded automatically on first use.
Without CycleIK, run with --ik coppelia (see Inverse kinematics for the trade-offs).
Run all scripts from the repository root, because paths such as ./task_configs and ./tmp are relative to it.
Every script supports --help.
Add --wandb to log to Weights & Biases (project LLM-MAP-<task>).
Plan generation (runnable):
python plan_generation.py --task_name ServeFruit --model_name gpt-4.1 --task_nums 10 # LLM+MAP (FMAP + BFWS)
python plan_generation.py --task_name ServeFruit --model_name gpt-4.1 --task_nums 10 --use_bfws false # LLM+MAP (FMAP only)
python plan_generation.py --task_name ServeFruit --model_name gpt-4.1 --task_nums 10 --direct # LLM-direct baseline--use_bfws (default true) controls the planners used for LLM+MAP:
true: the PDDL problem is solved by both the multi-agent FMAP planner and the single-agent BFWS planner, and the plan with fewer parallel steps is kept.false: only FMAP is used, so the BFWS binary is not needed.
main.py accepts the same flag.
Each run prints its progress, for example:
[12:00:18] [LLM+MAP] Instance 0 (1/1), scene type: ['right', 'right', 'right']
[12:00:18] [LLM+MAP] Trial 1/4: gpt-4.1 is generating the PDDL problem code...
[12:00:23] [LLM+MAP] Solving the generated PDDL problem with FMAP (multi-agent) and BFWS (single-agent)...
[12:00:25] [LLM+MAP] Plan saved to ./results/pddl_plans/ServeFruit/pddl_plan_0.json (selected planner: FMAP)
Evaluation scripts (runnable):
python ablation_study.py --task_name ServeFruit --task_nums 10 # LLM+P vs. LLM+MAP; run plan_generation.py first
python scene_understanding.py --task_name StackBlock --task_nums 1 # OWLv2 area recognition on images/Running on NICOL. Start CoppeliaSim with NICOL/nicol.ttt loaded first.
python plan_validation.py --task_name ServeFruit --model_name gpt-4.1 --task_nums 10 # execute generated plans
python main.py --task_name ServeWater --model_name gpt-4.1 --task_nums 5 # perception → planning → execution
python NICOL/task_config_generation.py --task_name ServeWater --task_nums 100 # sample new task configsAdd --ik coppelia or --ik dls to plan_validation.py or main.py to run without CycleIK (see Inverse kinematics).
| Path | Content |
|---|---|
results/pddl_plans/<task>/llm_pddl_<i>.py |
Full planning script: fixed code blocks + the LLM-generated problem |
results/pddl_plans/<task>/code_string_<i>.json |
LLM-generated problem code only |
results/pddl_plans/<task>/pddl_plan_<i>.json |
LLM+MAP plan |
results/direct_plans/<task>/direct_plan_<model>_<i>.json |
LLM-direct plan |
results/llm+p/<task>/ |
Ablation: single-agent scripts and plans |
results/owlv2_images/ |
OWLv2 detections drawn by scene_understanding.py |
results/<task>_<model>_<pddl|direct>_plan_gen.csv |
Planning success and LLM/planner time per instance |
results/<task>_<model>_<pddl|direct>_val.csv |
Execution success per instance (plan_validation.py) |
Plans are step-aligned JSON: {"Left": [...], "Right": [...]}. Both lists always have the same length.
Step k of both hands is executed at the same time, and "wait" keeps a hand still.
Intermediate planner files (PDDL files, BFWS output) are written to ./tmp/ and deleted after each instance.
BFWS planner 'bfws' not found: setBFWS_BIN(see Installation), or plan with FMAP only using--use_bfws false. The check runs before any LLM call.Set OPENAI_API_KEY ...: export the API key for the model you use.UPNoRequestedEngineAvailableExceptionfor FMAP: the generated scripts run with the same Python as the calling script. Make sure that environment hasup-fmapinstalled and Java on itsPATH.ModuleNotFoundError: cycleik_pytorch: the default IK solver needs CycleIK. Install it (see Installation), or pick another solver with--ik(see Inverse kinematics).- No plan found after 4 trials: the LLM-generated problem may be unsolvable, for example a goal that cannot be reached from the initial state. Inspect
results/pddl_plans/<task>/llm_pddl_<i>.pyand run it directly withpythonto see the planners' output.
The robot side of this work builds on NICOL and its software from the Knowledge Technology group at the University of Hamburg. From the robot down to its arm kinematics:
- NICOL: the robot used in the experiments.
Paper: NICOL: A Neuro-inspired Collaborative Semi-humanoid Robot that Bridges Social Interaction and Reliable Manipulation (Kerzel, Allgeuer, Strahl, Frick, Habekost, Eppe and Wermter). - nicol_coppeliasim: the CoppeliaSim environment of NICOL, on which our simulation builds.
Authors: Lennart Clasmeier, Jan-Gerrit Habekost. - CycleIK: neural inverse kinematics for NICOL's arms. It solved the arm kinematics in the paper and is the default IK solver of
NICOL/nicol_sim.py.
Paper: CycleIK: Neuro-inspired Inverse Kinematics (Habekost, Strahl, Allgeuer, Kerzel and Wermter).
This project is released under the MIT License.