{
 "assets": {
  "named_locations": [],
  "target_maps": [
   {
    "diagram": {
     "height_px": 300,
     "note": "示意圖像素只用來顯示與點選；機器人座標由板座標＋定位結果計算",
     "shapes": [
      {
       "h": 300.0,
       "kind": "outline",
       "label": "DEMO-PCB-A",
       "w": 480.0,
       "x": 0,
       "y": 0
      },
      {
       "h": 19.2,
       "kind": "rect",
       "label": "J1",
       "w": 125.9,
       "x": 110.4,
       "y": 50.4
      },
      {
       "h": 19.2,
       "kind": "rect",
       "label": "J2",
       "w": 64.9,
       "x": 290.4,
       "y": 218.4
      }
     ],
     "width_px": 480
    },
    "frame": {
     "id": "board",
     "origin": "板子左下角定位孔中心",
     "unit": "mm",
     "x_axis": "沿板長邊向右",
     "y_axis": "沿板短邊向上",
     "z_axis": "板面法向朝上（元件面）"
    },
    "groups": [
     {
      "aliases": [
       "j1"
      ],
      "id": "J1",
      "kind": "component",
      "label": "J1 接頭（8 pin）"
     },
     {
      "aliases": [
       "j2"
      ],
      "id": "J2",
      "kind": "component",
      "label": "J2 接頭（4 pin）"
     }
    ],
    "id": "demo_pcb_a",
    "known_limitations": [
     "焊點位置是示範資料，不是量測值",
     "沒有板子翹曲、元件高度的資料"
    ],
    "label": "DEMO-PCB-A",
    "localization_subject": "board",
    "revision": "rev1.0",
    "targets": [
     {
      "attributes": {
       "component": "J1",
       "pin": 1
      },
      "display": {
       "r_px": 6,
       "x_px": 120.0,
       "y_px": 60.0
      },
      "group": "J1",
      "id": "demo_pcb_a.J1.1",
      "label": "J1 第 1 腳",
      "local": {
       "x": 20.0,
       "y": 40.0,
       "z": 0.0
      }
     },
     {
      "attributes": {
       "component": "J1",
       "pin": 2
      },
      "display": {
       "r_px": 6,
       "x_px": 135.2,
       "y_px": 60.0
      },
      "group": "J1",
      "id": "demo_pcb_a.J1.2",
      "label": "J1 第 2 腳",
      "local": {
       "x": 22.54,
       "y": 40.0,
       "z": 0.0
      }
     },
     {
      "attributes": {
       "component": "J1",
       "pin": 3
      },
      "display": {
       "r_px": 6,
       "x_px": 150.5,
       "y_px": 60.0
      },
      "group": "J1",
      "id": "demo_pcb_a.J1.3",
      "label": "J1 第 3 腳",
      "local": {
       "x": 25.08,
       "y": 40.0,
       "z": 0.0
      }
     },
     {
      "attributes": {
       "component": "J1",
       "pin": 4
      },
      "display": {
       "r_px": 6,
       "x_px": 165.7,
       "y_px": 60.0
      },
      "group": "J1",
      "id": "demo_pcb_a.J1.4",
      "label": "J1 第 4 腳",
      "local": {
       "x": 27.62,
       "y": 40.0,
       "z": 0.0
      }
     },
     {
      "attributes": {
       "component": "J1",
       "pin": 5
      },
      "display": {
       "r_px": 6,
       "x_px": 181.0,
       "y_px": 60.0
      },
      "group": "J1",
      "id": "demo_pcb_a.J1.5",
      "label": "J1 第 5 腳",
      "local": {
       "x": 30.16,
       "y": 40.0,
       "z": 0.0
      }
     },
     {
      "attributes": {
       "component": "J1",
       "pin": 6
      },
      "display": {
       "r_px": 6,
       "x_px": 196.2,
       "y_px": 60.0
      },
      "group": "J1",
      "id": "demo_pcb_a.J1.6",
      "label": "J1 第 6 腳",
      "local": {
       "x": 32.7,
       "y": 40.0,
       "z": 0.0
      }
     },
     {
      "attributes": {
       "component": "J1",
       "pin": 7
      },
      "display": {
       "r_px": 6,
       "x_px": 211.4,
       "y_px": 60.0
      },
      "group": "J1",
      "id": "demo_pcb_a.J1.7",
      "label": "J1 第 7 腳",
      "local": {
       "x": 35.24,
       "y": 40.0,
       "z": 0.0
      }
     },
     {
      "attributes": {
       "component": "J1",
       "pin": 8
      },
      "display": {
       "r_px": 6,
       "x_px": 226.7,
       "y_px": 60.0
      },
      "group": "J1",
      "id": "demo_pcb_a.J1.8",
      "label": "J1 第 8 腳",
      "local": {
       "x": 37.78,
       "y": 40.0,
       "z": 0.0
      }
     },
     {
      "attributes": {
       "component": "J2",
       "pin": 1
      },
      "display": {
       "r_px": 6,
       "x_px": 300.0,
       "y_px": 228.0
      },
      "group": "J2",
      "id": "demo_pcb_a.J2.1",
      "label": "J2 第 1 腳",
      "local": {
       "x": 50.0,
       "y": 12.0,
       "z": 0.0
      }
     },
     {
      "attributes": {
       "component": "J2",
       "pin": 2
      },
      "display": {
       "r_px": 6,
       "x_px": 315.2,
       "y_px": 228.0
      },
      "group": "J2",
      "id": "demo_pcb_a.J2.2",
      "label": "J2 第 2 腳",
      "local": {
       "x": 52.54,
       "y": 12.0,
       "z": 0.0
      }
     },
     {
      "attributes": {
       "component": "J2",
       "pin": 3
      },
      "display": {
       "r_px": 6,
       "x_px": 330.5,
       "y_px": 228.0
      },
      "group": "J2",
      "id": "demo_pcb_a.J2.3",
      "label": "J2 第 3 腳",
      "local": {
       "x": 55.08,
       "y": 12.0,
       "z": 0.0
      }
     },
     {
      "attributes": {
       "component": "J2",
       "pin": 4
      },
      "display": {
       "r_px": 6,
       "x_px": 345.7,
       "y_px": 228.0
      },
      "group": "J2",
      "id": "demo_pcb_a.J2.4",
      "label": "J2 第 4 腳",
      "local": {
       "x": 57.62,
       "y": 12.0,
       "z": 0.0
      }
     }
    ]
   },
   {
    "diagram": {
     "height_px": 240,
     "note": "示意圖像素只用來顯示與點選；機器人座標由板座標＋定位結果計算",
     "shapes": [
      {
       "h": 240.0,
       "kind": "outline",
       "label": "DEMO-PCB-B",
       "w": 360.0,
       "x": 0,
       "y": 0
      },
      {
       "h": 19.2,
       "kind": "rect",
       "label": "J1",
       "w": 95.4,
       "x": 62.4,
       "y": 50.4
      },
      {
       "h": 19.2,
       "kind": "rect",
       "label": "J2",
       "w": 49.7,
       "x": 206.4,
       "y": 170.4
      }
     ],
     "width_px": 360
    },
    "frame": {
     "id": "board",
     "origin": "板子左下角定位孔中心",
     "unit": "mm",
     "x_axis": "沿板長邊向右",
     "y_axis": "沿板短邊向上",
     "z_axis": "板面法向朝上（元件面）"
    },
    "groups": [
     {
      "aliases": [
       "j1"
      ],
      "id": "J1",
      "kind": "component",
      "label": "J1 接頭（6 pin）"
     },
     {
      "aliases": [
       "j2"
      ],
      "id": "J2",
      "kind": "component",
      "label": "J2 接頭（3 pin）"
     }
    ],
    "id": "demo_pcb_b",
    "known_limitations": [
     "焊點位置是示範資料，不是量測值",
     "沒有板子翹曲、元件高度的資料"
    ],
    "label": "DEMO-PCB-B",
    "localization_subject": "board",
    "revision": "rev2.1",
    "targets": [
     {
      "attributes": {
       "component": "J1",
       "pin": 1
      },
      "display": {
       "r_px": 6,
       "x_px": 72.0,
       "y_px": 60.0
      },
      "group": "J1",
      "id": "demo_pcb_b.J1.1",
      "label": "J1 第 1 腳",
      "local": {
       "x": 12.0,
       "y": 30.0,
       "z": 0.0
      }
     },
     {
      "attributes": {
       "component": "J1",
       "pin": 2
      },
      "display": {
       "r_px": 6,
       "x_px": 87.2,
       "y_px": 60.0
      },
      "group": "J1",
      "id": "demo_pcb_b.J1.2",
      "label": "J1 第 2 腳",
      "local": {
       "x": 14.54,
       "y": 30.0,
       "z": 0.0
      }
     },
     {
      "attributes": {
       "component": "J1",
       "pin": 3
      },
      "display": {
       "r_px": 6,
       "x_px": 102.5,
       "y_px": 60.0
      },
      "group": "J1",
      "id": "demo_pcb_b.J1.3",
      "label": "J1 第 3 腳",
      "local": {
       "x": 17.08,
       "y": 30.0,
       "z": 0.0
      }
     },
     {
      "attributes": {
       "component": "J1",
       "pin": 4
      },
      "display": {
       "r_px": 6,
       "x_px": 117.7,
       "y_px": 60.0
      },
      "group": "J1",
      "id": "demo_pcb_b.J1.4",
      "label": "J1 第 4 腳",
      "local": {
       "x": 19.62,
       "y": 30.0,
       "z": 0.0
      }
     },
     {
      "attributes": {
       "component": "J1",
       "pin": 5
      },
      "display": {
       "r_px": 6,
       "x_px": 133.0,
       "y_px": 60.0
      },
      "group": "J1",
      "id": "demo_pcb_b.J1.5",
      "label": "J1 第 5 腳",
      "local": {
       "x": 22.16,
       "y": 30.0,
       "z": 0.0
      }
     },
     {
      "attributes": {
       "component": "J1",
       "pin": 6
      },
      "display": {
       "r_px": 6,
       "x_px": 148.2,
       "y_px": 60.0
      },
      "group": "J1",
      "id": "demo_pcb_b.J1.6",
      "label": "J1 第 6 腳",
      "local": {
       "x": 24.7,
       "y": 30.0,
       "z": 0.0
      }
     },
     {
      "attributes": {
       "component": "J2",
       "pin": 1
      },
      "display": {
       "r_px": 6,
       "x_px": 216.0,
       "y_px": 180.0
      },
      "group": "J2",
      "id": "demo_pcb_b.J2.1",
      "label": "J2 第 1 腳",
      "local": {
       "x": 36.0,
       "y": 10.0,
       "z": 0.0
      }
     },
     {
      "attributes": {
       "component": "J2",
       "pin": 2
      },
      "display": {
       "r_px": 6,
       "x_px": 231.2,
       "y_px": 180.0
      },
      "group": "J2",
      "id": "demo_pcb_b.J2.2",
      "label": "J2 第 2 腳",
      "local": {
       "x": 38.54,
       "y": 10.0,
       "z": 0.0
      }
     },
     {
      "attributes": {
       "component": "J2",
       "pin": 3
      },
      "display": {
       "r_px": 6,
       "x_px": 246.5,
       "y_px": 180.0
      },
      "group": "J2",
      "id": "demo_pcb_b.J2.3",
      "label": "J2 第 3 腳",
      "local": {
       "x": 41.08,
       "y": 10.0,
       "z": 0.0
      }
     }
    ]
   }
  ]
 },
 "compatibility": {
  "camera_requirements": {
   "note": "v1 用 MOCK 治具定位；未來真實定位需要相機與板上定位標記",
   "required": false
  },
  "required_capabilities": [
   "mock_motion",
   "mock_fixture_localization"
  ],
  "robot_profiles": [
   "ras_6dof_mock_v1"
  ],
  "runtime_requirements": {
   "min_platform_version": 1
  },
  "tool_profile": "solder_probe_mock_v1"
 },
 "constraints": {
  "allowed_modes": [
   "mock"
  ],
  "required_settings": [
   {
    "kind": "tool_mounted",
    "tool_profile": "solder_probe_mock_v1"
   },
   {
    "kind": "localized",
    "subject": "board"
   }
  ],
  "tool_limits": {
   "heating": "forbidden",
   "max_height_mm": 50,
   "min_height_mm": 10,
   "solder_feed": "forbidden"
  }
 },
 "interaction": {
  "confirmation": {
   "highlight_steps": [
    "hover"
   ],
   "required": true,
   "text": "確認後，MOCK 執行端會依序移到下列焊點上方。這是模擬：不加熱、不送錫，也不會碰觸板子。"
  },
  "fields": [
   {
    "default": "demo_pcb_a",
    "id": "board_id",
    "label": "板型",
    "maps": [
     "demo_pcb_a",
     "demo_pcb_b"
    ],
    "required": true,
    "type": "target_map_choice"
   },
   {
    "choices": [
     {
      "label": "使用預設任務",
      "value": "preset"
     },
     {
      "label": "自選焊點",
      "value": "custom"
     }
    ],
    "default": "preset",
    "id": "selection_mode",
    "label": "選擇方式",
    "required": true,
    "type": "single_choice"
   },
   {
    "id": "preset_id",
    "label": "預設任務",
    "required": true,
    "type": "preset_choice",
    "visible_when": {
     "equals": "preset",
     "field": "selection_mode"
    }
   },
   {
    "id": "target_ids",
    "label": "焊點",
    "map_field": "board_id",
    "max_items": 16,
    "min_items": 1,
    "required": true,
    "selection": {
     "diagram": true,
     "group_select": true,
     "list": true
    },
    "type": "target_select",
    "visible_when": {
     "equals": "custom",
     "field": "selection_mode"
    }
   },
   {
    "choices": [
     {
      "aliases": [
       "上方等待",
       "等待"
      ],
      "label": "移到焊點上方等待位置",
      "value": "hover_wait"
     },
     {
      "aliases": [
       "模擬定位",
       "定位"
      ],
      "label": "執行模擬定位流程",
      "value": "mock_localize"
     }
    ],
    "default": "hover_wait",
    "id": "assist_mode",
    "label": "協助模式",
    "required": true,
    "type": "single_choice"
   },
   {
    "default": 20,
    "id": "hover_height_mm",
    "label": "等待高度（焊點上方）",
    "max": 50,
    "min": 10,
    "required": true,
    "step": 1,
    "type": "number",
    "unit": "mm"
   },
   {
    "default": 1,
    "id": "dwell_s",
    "label": "每點停留時間",
    "max": 5,
    "min": 0,
    "required": true,
    "step": 0.5,
    "type": "number",
    "unit": "s"
   }
  ],
  "steps": [
   {
    "fields": [
     "board_id"
    ],
    "help": "確認治具上的板子型號與版本",
    "id": "board",
    "kind": "fields",
    "title": "選擇板型"
   },
   {
    "fields": [
     "selection_mode"
    ],
    "id": "mode",
    "kind": "fields",
    "title": "預設任務或自選焊點"
   },
   {
    "fields": [
     "preset_id",
     "target_ids"
    ],
    "help": "可以點示意圖上的焊點，或從清單選整個接頭",
    "id": "targets",
    "kind": "fields",
    "title": "選擇焊點"
   },
   {
    "fields": [
     "assist_mode",
     "hover_height_mm",
     "dwell_s"
    ],
    "id": "assist",
    "kind": "fields",
    "title": "協助模式"
   },
   {
    "id": "review",
    "kind": "summary",
    "title": "檢查目標與摘要"
   }
  ],
  "text_commands": {
   "language": "zh-TW",
   "prefixes": [
    "請",
    "幫我",
    "選擇",
    "選"
   ],
   "rules": [
    {
     "action": {
      "attribute": "pin",
      "into_field": "target_ids",
      "kind": "select_target_by_attribute",
      "set": {
       "selection_mode": "custom"
      }
     },
     "id": "pin",
     "pattern": "{group} 第 {pin} 腳",
     "slots": {
      "group": "group",
      "pin": "integer"
     }
    },
    {
     "action": {
      "attribute": "pin",
      "into_field": "target_ids",
      "kind": "select_target_by_attribute",
      "set": {
       "selection_mode": "custom"
      }
     },
     "id": "pin_short",
     "pattern": "{group} pin {pin}",
     "slots": {
      "group": "group",
      "pin": "integer"
     }
    },
    {
     "action": {
      "into_field": "target_ids",
      "kind": "select_group",
      "set": {
       "selection_mode": "custom"
      }
     },
     "id": "group_all",
     "pattern": "{group} 全部焊點",
     "slots": {
      "group": "group"
     }
    },
    {
     "action": {
      "into_field": "preset_id",
      "kind": "select_preset",
      "set": {
       "selection_mode": "preset"
      }
     },
     "id": "preset",
     "pattern": "預設 {preset}",
     "slots": {
      "preset": "preset"
     }
    },
    {
     "action": {
      "into_field": "assist_mode",
      "kind": "set_choice"
     },
     "choice_field": "assist_mode",
     "id": "mode",
     "pattern": "模式 {mode}",
     "slots": {
      "mode": "choice"
     }
    }
   ]
  }
 },
 "metadata": {
  "author": {
   "contact": null,
   "name": "RAS 範例技能"
  },
  "description": "選擇板型與焊點，讓手臂移到焊點上方的等待位置，或跑一次模擬定位流程。只有 MOCK：不加熱、不送錫、不碰觸板子，也不控制烙鐵。",
  "execution_modes": [
   "mock"
  ],
  "license": "MIT",
  "skill_id": "ras.pcb_solder_assist",
  "tags": [
   "PCB",
   "焊接輔助",
   "示範",
   "MOCK"
  ],
  "title": "指定電路板焊接輔助（MOCK）",
  "version": "0.1.0"
 },
 "perception": {
  "notes": [
   "辨識到 PCB 不等於知道焊點位置：焊點來自板型資料（target_maps），定位只提供板子在機器人基座座標的位置",
   "定位是 MOCK：治具位置是編造的工作站設定，不是量測"
  ],
  "subjects": [
   {
    "id": "board",
    "input": {
     "kind": "operator_confirmation",
     "note": "操作員確認板子已放進 MOCK 治具"
    },
    "max_age_s": 900,
    "method": "mock_fixture",
    "on_missing": "refuse",
    "on_stale": "refuse",
    "on_untrusted": "refuse",
    "output": {
     "frame": "robot_base",
     "pose_of": "board",
     "unit": "m"
    },
    "what": "固定在治具上的電路板（板子的位置與方向）"
   }
  ]
 },
 "presets": [
  {
   "aliases": [
    "J1全部"
   ],
   "description": "DEMO-PCB-A 的 J1 八個焊點，依腳位順序",
   "editable_fields": [
    "hover_height_mm",
    "dwell_s"
   ],
   "id": "a_j1_all",
   "label": "J1 全部焊點",
   "params": {
    "assist_mode": "hover_wait",
    "dwell_s": 1,
    "hover_height_mm": 20
   },
   "target_groups": [
    "J1"
   ],
   "target_map": "demo_pcb_a"
  },
  {
   "aliases": [
    "J2檢查"
   ],
   "description": "DEMO-PCB-A 的 J2 四個焊點，逐點跑模擬定位",
   "editable_fields": [
    "dwell_s"
   ],
   "id": "a_j2_check",
   "label": "J2 模擬定位檢查",
   "params": {
    "assist_mode": "mock_localize",
    "dwell_s": 0.5,
    "hover_height_mm": 15
   },
   "target_groups": [
    "J2"
   ],
   "target_map": "demo_pcb_a"
  },
  {
   "editable_fields": [
    "assist_mode",
    "hover_height_mm",
    "dwell_s"
   ],
   "id": "a_power_pins",
   "label": "電源腳（J1-1、J2-1）",
   "params": {
    "assist_mode": "hover_wait",
    "dwell_s": 2,
    "hover_height_mm": 25
   },
   "target_ids": [
    "demo_pcb_a.J1.1",
    "demo_pcb_a.J2.1"
   ],
   "target_map": "demo_pcb_a"
  },
  {
   "editable_fields": [
    "hover_height_mm",
    "dwell_s"
   ],
   "id": "b_j1_all",
   "label": "J1 全部焊點",
   "params": {
    "assist_mode": "hover_wait",
    "dwell_s": 1,
    "hover_height_mm": 20
   },
   "target_groups": [
    "J1"
   ],
   "target_map": "demo_pcb_b"
  }
 ],
 "schema_version": 1,
 "target_mapping": {
  "rules": [
   {
    "from": "preset",
    "preset_field": "preset_id",
    "when": {
     "equals": "preset",
     "field": "selection_mode"
    }
   },
   {
    "field": "target_ids",
    "from": "field_ids",
    "map_field": "board_id",
    "when": {
     "equals": "custom",
     "field": "selection_mode"
    }
   }
  ]
 },
 "testing": {
  "author_provided_only": true,
  "known_limitations": [
   "沒有真機焊接、加熱或送錫",
   "焊點位置是示範資料",
   "定位只有 MOCK 治具"
  ],
  "modes_tested": [
   "mock"
  ],
  "scenarios": [
   {
    "description": "DEMO-PCB-A J1 全部焊點，上方等待，MOCK 執行成功",
    "id": "j1_all_hover"
   },
   {
    "description": "自選 J1 第 3 腳，模擬定位",
    "id": "custom_pin"
   }
  ]
 },
 "workflow": {
  "steps": [
   {
    "id": "check_board",
    "label": "確認板子已定位（MOCK）",
    "subject": "board",
    "type": "require_localization"
   },
   {
    "id": "per_target",
    "label": "逐點",
    "steps": [
     {
      "height_mm": {
       "param": "hover_height_mm"
      },
      "id": "hover",
      "label": "移到焊點上方",
      "on_failure": "abort",
      "retry": {
       "max_attempts": 1
      },
      "timeout_s": 10,
      "type": "move_above_target"
     },
     {
      "id": "localize",
      "label": "模擬定位",
      "on_failure": "skip_target",
      "retry": {
       "max_attempts": 2
      },
      "timeout_s": 5,
      "type": "mock_localize_target",
      "when": {
       "equals": "mock_localize",
       "param": "assist_mode"
      }
     },
     {
      "id": "wait",
      "label": "停留",
      "seconds": {
       "param": "dwell_s"
      },
      "timeout_s": 10,
      "type": "dwell"
     }
    ],
    "type": "for_each_target"
   },
   {
    "id": "finish",
    "label": "回到安全位置",
    "timeout_s": 10,
    "type": "return_to_safe"
   }
  ]
 }
}