| name | waypoint-teaching |
| description | Use when adding, extending, or debugging Waypoint Teaching & Playback: saving robot poses as waypoints, sequencing them, playing/looping sequences, exporting/importing JSON, coroutine-based runner engine, or teaching UI integration. |
Trigger
์๋ ์์ฒญ์์ ์ฌ์ฉ:
์จ์ดํฌ์ธํธ ์ ์ฅ/์ฌ์
ํฐ์นญ ํ๋ ์ด๋ฐฑ
์ํ์ค ์ฌ์/๋ฃจํ/์ ์ง
ํฌ์ฆ ์ต์คํฌํธ/์ํฌํธ
์จ์ดํฌ์ธํธ ๋ฌ๋ ๋๋ฒ๊น
Teaching UI ํ์ฅ
Input Context
- ๋์ ๋ก๋ด์ ๊ด์ ์ (FR5 = 6์ถ)
- Mock/Live ๋ชจ๋ ์ฌ๋ถ
- ๊ธฐ์กด WaypointStore/WaypointCycleRunner ์ฝ๋ ์กด์ฌ ์ฌ๋ถ
Read First
Assets/Scripts/App/Fairino/WaypointStore.cs โ ๋ฐ์ดํฐ ๋ชจ๋ธ + JSON ์์
Assets/Scripts/App/Fairino/WaypointCycleRunner.cs โ ์ฝ๋ฃจํด ์ฌ์ ์์ง
Assets/Scripts/App/Fairino/PresetTransitionAnimator.cs โ ๋ณด๊ฐ ์ ๋๋ฉ์ดํฐ (Runner๊ฐ ์์กด)
Assets/Scripts/UI/FairinoJointControlPanel.cs โ Teaching ์น์
UI
Assets/Scripts/App/Fairino/RobotControlSceneCoordinator.cs โ ํตํฉ ํธ๋ค๋ฌ
Do
์ํคํ
์ฒ ๊ณ์ธต
WaypointStore (๋ฐ์ดํฐ)
Waypoint { name, jointsDeg[6], tcpMm[6], moveType, speedPreset, dwellSec }
WaypointSequence { name, created, waypoints[] }
Save/Load/Delete/Duplicate/Rename/Export/Import
โ
WaypointCycleRunner (์์ง, MonoBehaviour)
PlayOnce / PlayLoop / Stop
์ฝ๋ฃจํด ๊ธฐ๋ฐ ์์ฐจ ์คํ
PresetTransitionAnimator๋ก 3D ๋ณด๊ฐ
โ
JointControlPanel (UI)
Teaching ์น์
: Save Point / Play / Loop / Stop / Undo / Export / Import / Clear All
8๊ฐ ์ด๋ฒคํธ๋ก Coordinator์ ์์
โ
RobotControlSceneCoordinator (ํตํฉ)
์ด๋ฒคํธ ๋ฐ์ธ๋ฉ, FK TCP ๊ณ์ฐ, Runnerโ3D ๋ฏธ๋ฌ ์ฐ๊ฒฐ
์ฝ๋ฃจํด ์์ ๊ท์น (ํ์)
- StopAllCoroutines ์ฌ์ฉ:
StopCoroutine(activeCoroutine)๋ ์ค์ฒฉ ์ฝ๋ฃจํด(AnimateToWaypoint)์ ์ ์งํ์ง ์์. ๋ฐ๋์ StopAllCoroutines()๋ก ์ ์ฒด ์ ์ง.
- ์ด๋ฒคํธ ํธ๋ค๋ฌ ๋์ ๋ฐฉ์ง: AnimateToWaypoint์์
presetAnimator.OnTransitionComplete์ ๊ตฌ๋
ํ๋ ํธ๋ค๋ฌ๋ฅผ activeCompleteHandler ํ๋์ ์ ์ฅํ๊ณ , Stop ์ CleanupCompleteHandler()๋ก ํ์คํ ํด์ .
- ๋งค yield ํ ์ํ ์ฒดํฌ: ๋ชจ๋
yield return ์ดํ if (State != RunState.Running) yield break; ์ถ๊ฐ. Stop ์๋ต ์ง์ฐ ๋ฐฉ์ง.
- ๋น ์ํ์ค ๊ฐ์ง: do-while ๋ฃจํ ์์์์
waypoints.Length == 0 ์ฒดํฌ โ break. ๋น ์ง๋ฉด yield ์๋ ๋ฌดํ ๋ฃจํ๋ก Unity ํ๋ฆฌ์ฆ.
- ๋ฃจํ ์ฌ์ด yield null: do-while ๋งค ์ฌ์ดํด ๋์
yield return null ์ถ๊ฐ. UI ์ด๋ฒคํธ(Stop ๋ฒํผ) ์ฒ๋ฆฌ ๊ธฐํ ๋ณด์ฅ.
- OnSequenceComplete ํธ์ถ ์์น: do-while ๋ฃจํ ๋ฐ(์ต์ข
์๋ฃ ์)์์๋ง ํธ์ถ. ๋ฃจํ ์์์ ํธ์ถํ๋ฉด SetTeachingState(false)๋ก Stop ๋ฒํผ์ด ๋นํ์ฑํ๋จ.
ํ
๋ ํฌํธ ๋ฐฉ์ง ํจํด
private double[] lastCompletedAngles;
lastCompletedAngles = null;
var fromAngles = lastCompletedAngles ?? GetCurrentAnglesFromAnimator();
presetAnimator.StartTransition(fromAngles, wp.jointsDeg, duration);
lastCompletedAngles = (double[])wp.jointsDeg.Clone();
Clear All ์์ ํจํด
waypointRunner?.Stop();
WaypointStore.ClearWaypoints(currentSequence);
eeTrailRenderer?.Clear();
displacementArrow?.Clear();
jointControlPanel?.SetTeachingState(false);
JSON ์ ์ฅ ํ์
{
"name": "Pick-and-Place-A",
"created": "2026-03-15T14:30:00+09:00",
"waypoints": [
{
"name": "W1",
"jointsDeg": [10, -30, 15, -45, -80, 0],
"tcpMm": [320.1, 150.3, 480.5, 0.0, -90.0, 0.0],
"moveType": "MoveJ",
"speedPreset": "medium",
"dwellSec": 0.0
}
]
}
- ์ ์ฅ ๊ฒฝ๋ก:
Application.persistentDataPath/waypoints/{name}.json
- tcpMm: Save Point ์ FK ์๋ ๊ณ์ฐ (mโmm ๋ณํ + ZYX ์ค์ผ๋ฌ๊ฐ)
- moveType: "MoveJ" (๊ด์ ) ๋๋ "MoveL" (์ง๊ต)
- speedPreset: "slow" / "medium" / "fast"
UI ์ด๋ฒคํธ ๋ชฉ๋ก
| ์ด๋ฒคํธ | ํธ๋ฆฌ๊ฑฐ | Coordinator ํธ๋ค๋ฌ |
|---|
| OnSaveWaypointRequested | Save Point ํด๋ฆญ | ํ์ฌ ํฌ์ฆ+TCP+์๋ ์ ์ฅ |
| OnPlayRequested | โถ Play ํด๋ฆญ | PlayOnce ์คํ |
| OnLoopRequested | โณ Loop ํด๋ฆญ | PlayLoop ์คํ |
| OnTeachStopRequested | โ Stop ํด๋ฆญ | Runner.Stop + UI ์ด๊ธฐํ |
| OnExportRequested | Export ํด๋ฆญ | WaypointStore.Save |
| OnImportRequested | Import ํด๋ฆญ | WaypointStore.Load |
| OnUndoLastRequested | Undo ํด๋ฆญ | RemoveLast |
| OnClearAllRequested | Clear All ํด๋ฆญ | StopโClearโTrailโUI |
Do Not
StopCoroutine(activeCoroutine) ๋จ๋
์ฌ์ฉ ๊ธ์ง โ ๋ฐ๋์ StopAllCoroutines()
OnSequenceComplete๋ฅผ do-while ๋ด๋ถ์์ ํธ์ถ ๊ธ์ง
- AnimateToWaypoint์์
presetAnimator.OnFrameUpdated ๊ตฌ๋
๊ธ์ง โ Coordinator ์ง์ ๊ตฌ๋
๊ณผ ์ค๋ณต
GetCurrentAnglesFromAnimator()๋ฅผ ๋งค ์จ์ดํฌ์ธํธ ์์์ ์ผ๋ก ์ฌ์ฉ ๊ธ์ง โ lastCompletedAngles ํจํด ์ฌ์ฉ
- Clear All์์ Runner ์ ์ง ์์ด ๋ฐ์ดํฐ๋ง ์ญ์ ๊ธ์ง โ ๋น ๋ฐฐ์ด ๋ฌดํ ๋ฃจํ ๋ฐ์
Validation
- Save Point 3๊ฐ โ Play โ W1โW2โW3 ์์ ์ ์ด ํ์ธ (ํ
๋ ํฌํธ ์์)
- Loop โ ์ ์ฒด ์ํ ๋ฐ๋ณต ํ์ธ (๋ง์ง๋ง๋ง ๋ฐ๋ณต ์๋)
- Loop ์ค โ Stop โ ์ฆ์ ์ ์ง ํ์ธ
- Loop ์ค Clear All โ ํ๋ฆฌ์ฆ ์์ด ์ ์ง+์ด๊ธฐํ ํ์ธ
- Clear All ํ ์ ํฌ์ธํธ ์ ์ฅ โ Play โ ์ ๋ฐ์ดํฐ๋ง ์ฌ์ ํ์ธ (์ด์ ๋ฐ์ดํฐ ์์กด ์์)
- Export โ
persistentDataPath/waypoints/ JSON ํ์ผ ์์ฑ ํ์ธ
- Import โ ์ ์ฅ๋ ์ํ์ค ๋ก๋ + UI ๋ฆฌ์คํธ ๊ฐฑ์ ํ์ธ
Output Template
## Waypoint Teaching ๋ณ๊ฒฝ ์์ฝ
- ๋ณ๊ฒฝ ํ์ผ: {ํ์ผ ๋ชฉ๋ก}
- ์ถ๊ฐ/์์ ๊ธฐ๋ฅ: {๊ธฐ๋ฅ ์ค๋ช
}
- ์ฝ๋ฃจํด ์์ ์ฒดํฌ: StopAllCoroutines โ / ํธ๋ค๋ฌ ํด์ โ / ๋น ์ํ์ค ๊ฐ์ง โ
- ํ
์คํธ: {Validation ์ฒดํฌ๋ฆฌ์คํธ ๊ฒฐ๊ณผ}