dobotkit 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. dobotkit-0.1.0/.gitignore +9 -0
  2. dobotkit-0.1.0/.superpowers/sdd/.gitignore +1 -0
  3. dobotkit-0.1.0/.superpowers/sdd/motion-wait-fix-report.md +119 -0
  4. dobotkit-0.1.0/.superpowers/sdd/progress.md +45 -0
  5. dobotkit-0.1.0/.superpowers/sdd/review-c203329..376ec44.diff +833 -0
  6. dobotkit-0.1.0/.superpowers/sdd/review-c203329..674ed9a.diff +12330 -0
  7. dobotkit-0.1.0/.superpowers/sdd/review-fixes-report.md +178 -0
  8. dobotkit-0.1.0/.superpowers/sdd/task-1-brief.md +43 -0
  9. dobotkit-0.1.0/.superpowers/sdd/task-1-report.md +180 -0
  10. dobotkit-0.1.0/.superpowers/sdd/task-2-brief.md +97 -0
  11. dobotkit-0.1.0/.superpowers/sdd/task-2-report.md +129 -0
  12. dobotkit-0.1.0/.superpowers/sdd/task-3-brief.md +90 -0
  13. dobotkit-0.1.0/.superpowers/sdd/task-4-brief.md +86 -0
  14. dobotkit-0.1.0/.superpowers/sdd/task-5-brief.md +81 -0
  15. dobotkit-0.1.0/.superpowers/sdd/task-6-brief.md +152 -0
  16. dobotkit-0.1.0/.superpowers/sdd/task-7-brief.md +168 -0
  17. dobotkit-0.1.0/.superpowers/sdd/task-8-brief.md +40 -0
  18. dobotkit-0.1.0/CHANGELOG.md +168 -0
  19. dobotkit-0.1.0/CONTEXT.md +41 -0
  20. dobotkit-0.1.0/LICENSE +21 -0
  21. dobotkit-0.1.0/PKG-INFO +322 -0
  22. dobotkit-0.1.0/README.md +286 -0
  23. dobotkit-0.1.0/docs/GO_SDK_/354/273/244/353/262/204/353/246/254/354/247/200_/353/246/254/355/217/254/355/212/270.docx +0 -0
  24. dobotkit-0.1.0/docs/GO_/352/262/200/354/246/235/355/225/204/354/232/224/355/225/255/353/252/251_/353/246/254/355/217/254/355/212/270.docx +0 -0
  25. dobotkit-0.1.0/docs/VERIFICATION_NEEDED_ko.md +49 -0
  26. dobotkit-0.1.0/docs/api/arm.md +266 -0
  27. dobotkit-0.1.0/docs/api/go.md +446 -0
  28. dobotkit-0.1.0/docs/cheatsheet_go.md +112 -0
  29. dobotkit-0.1.0/docs/quickstart-ko.md +102 -0
  30. dobotkit-0.1.0/docs/superpowers/plans/2026-06-30-dobotkit-implementation.md +966 -0
  31. dobotkit-0.1.0/docs/superpowers/plans/2026-07-16-magicianlite-dobotlink-rewrite.md +802 -0
  32. dobotkit-0.1.0/docs/superpowers/specs/2026-06-30-dobotkit-design.md +308 -0
  33. dobotkit-0.1.0/docs/superpowers/specs/2026-07-16-magicbox-absent-graceful-handling-design.md +144 -0
  34. dobotkit-0.1.0/docs/superpowers/specs/2026-07-16-magicianlite-dobotlink-rewrite-design.md +121 -0
  35. dobotkit-0.1.0/examples/arm_magicianlite.py +67 -0
  36. dobotkit-0.1.0/examples/go_discover.py +95 -0
  37. dobotkit-0.1.0/examples/go_magicbox_sensor.py +59 -0
  38. dobotkit-0.1.0/examples/go_teleop.py +185 -0
  39. dobotkit-0.1.0/pyproject.toml +64 -0
  40. dobotkit-0.1.0/src/dobotkit/__init__.py +112 -0
  41. dobotkit-0.1.0/src/dobotkit/_version.py +1 -0
  42. dobotkit-0.1.0/src/dobotkit/arm/__init__.py +46 -0
  43. dobotkit-0.1.0/src/dobotkit/arm/commands/__init__.py +21 -0
  44. dobotkit-0.1.0/src/dobotkit/arm/commands/_base.py +19 -0
  45. dobotkit-0.1.0/src/dobotkit/arm/commands/connection.py +32 -0
  46. dobotkit-0.1.0/src/dobotkit/arm/commands/effector_io.py +114 -0
  47. dobotkit-0.1.0/src/dobotkit/arm/commands/motion.py +60 -0
  48. dobotkit-0.1.0/src/dobotkit/arm/commands/sensors.py +38 -0
  49. dobotkit-0.1.0/src/dobotkit/arm/groups.py +162 -0
  50. dobotkit-0.1.0/src/dobotkit/arm/magicianlite.py +203 -0
  51. dobotkit-0.1.0/src/dobotkit/enums.py +69 -0
  52. dobotkit-0.1.0/src/dobotkit/exceptions.py +36 -0
  53. dobotkit-0.1.0/src/dobotkit/go/__init__.py +56 -0
  54. dobotkit-0.1.0/src/dobotkit/go/geometry.py +105 -0
  55. dobotkit-0.1.0/src/dobotkit/go/groups.py +164 -0
  56. dobotkit-0.1.0/src/dobotkit/go/magiciango.py +511 -0
  57. dobotkit-0.1.0/src/dobotkit/go/navigation.py +364 -0
  58. dobotkit-0.1.0/src/dobotkit/link.py +209 -0
  59. dobotkit-0.1.0/src/dobotkit/py.typed +0 -0
  60. dobotkit-0.1.0/tests/__init__.py +0 -0
  61. dobotkit-0.1.0/tests/arm/__init__.py +0 -0
  62. dobotkit-0.1.0/tests/arm/test_arm_groups.py +137 -0
  63. dobotkit-0.1.0/tests/arm/test_commands_connection.py +20 -0
  64. dobotkit-0.1.0/tests/arm/test_commands_effector_io.py +91 -0
  65. dobotkit-0.1.0/tests/arm/test_commands_motion.py +40 -0
  66. dobotkit-0.1.0/tests/arm/test_commands_sensors.py +67 -0
  67. dobotkit-0.1.0/tests/arm/test_magicianlite.py +60 -0
  68. dobotkit-0.1.0/tests/conftest.py +134 -0
  69. dobotkit-0.1.0/tests/go/__init__.py +0 -0
  70. dobotkit-0.1.0/tests/go/conftest.py +186 -0
  71. dobotkit-0.1.0/tests/go/test_client.py +239 -0
  72. dobotkit-0.1.0/tests/go/test_geometry.py +153 -0
  73. dobotkit-0.1.0/tests/go/test_groups.py +130 -0
  74. dobotkit-0.1.0/tests/go/test_magiciango.py +478 -0
  75. dobotkit-0.1.0/tests/go/test_magiciango_extended.py +76 -0
  76. dobotkit-0.1.0/tests/go/test_navigation.py +341 -0
  77. dobotkit-0.1.0/tests/test_enums.py +22 -0
  78. dobotkit-0.1.0/tests/test_exceptions.py +20 -0
  79. dobotkit-0.1.0/tests/test_integration.py +135 -0
  80. dobotkit-0.1.0/tests/test_smoke.py +4 -0
  81. dobotkit-0.1.0/tests/test_subpackage_api.py +47 -0
@@ -0,0 +1,9 @@
1
+ __pycache__/
2
+ *.pyc
3
+ *.egg-info/
4
+ dist/
5
+ build/
6
+ .venv/
7
+ .pytest_cache/
8
+ .mypy_cache/
9
+ .ruff_cache/
@@ -0,0 +1 @@
1
+ *
@@ -0,0 +1,119 @@
1
+ # Motion-completion hardening: isWaitForFinish instead of queue-index polling
2
+
3
+ ## Problem
4
+
5
+ Live testing on the real Magician Lite proved `_wait_for`'s queue-index
6
+ polling (`GetQueuedCmdCurrentIndex`) returns **before** a move physically
7
+ finishes. Moves therefore overlapped and DobotLink returned
8
+ `code 160 "action timeout"`. DobotLab itself never polls — it sends
9
+ `SetPTPCmd(Object.assign(point, {isQueued:true, isWaitForFinish:true}))` and
10
+ lets DobotLink block server-side until the move completes. This change
11
+ replicates that behaviour and removes all client-side polling.
12
+
13
+ ## Per-file changes
14
+
15
+ ### `src/dobotkit/link.py`
16
+ `DobotLinkClient.call` gained a keyword-only `call_timeout: Optional[float] =
17
+ None` parameter, placed **before** `**params` so it can never collide with an
18
+ RPC param literally named `timeout` (e.g. `SetWAITCmd`). Effective timeout
19
+ `eff = call_timeout if call_timeout is not None else self._timeout` is used
20
+ both for the deadline computation and in the two `DobotTimeoutError` messages
21
+ (previously hardcoded to `self._timeout`). `notify()` untouched. `Optional`
22
+ was already imported.
23
+
24
+ ### `src/dobotkit/arm/commands/_base.py`
25
+ `_call` gained the same keyword-only `call_timeout: Optional[float] = None`
26
+ and forwards it: `self._client.call(f"Magician.{func}", call_timeout=call_timeout, **params)`.
27
+ Added `Optional` to the `typing` import.
28
+
29
+ ### `src/dobotkit/arm/commands/motion.py`
30
+ - `set_ptp_cmd(..., wait_finish: bool = False)`: sends
31
+ `isWaitForFinish=wait_finish` alongside the existing PTP params; when
32
+ `wait_finish` is `True` passes `call_timeout=20.0` to `_call` (else default
33
+ client timeout). Still returns `_queued_index(resp)`.
34
+ - `set_home_cmd(..., wait_finish: bool = False)`: sends
35
+ `isWaitForFinish=wait_finish`; when `True` passes `call_timeout=40.0`
36
+ (homing is slow, ~15-20s observed live). Still returns `_queued_index(resp)`.
37
+ - No other methods touched.
38
+
39
+ ### `src/dobotkit/arm/magicianlite.py`
40
+ - Deleted `_wait_for` entirely (the polling loop, its `time.monotonic`/`sleep`
41
+ usage, and its `DobotTimeoutError` raise). Dropped the now-unused `import
42
+ time` and `DobotTimeoutError` import (kept `DobotConnectionError`, still
43
+ used by `connect()`).
44
+ - `move_to(..., wait=False)`: `return self.cmds.set_ptp_cmd(mode, x, y, z, r,
45
+ queued=True, wait_finish=wait)` — returns the queued index directly; when
46
+ `wait=True` DobotLink blocks server-side via `isWaitForFinish`.
47
+ - `move_relative(..., wait=False)`: same pattern with `PTPMode.MOVL_XYZ_INC`.
48
+ - `home(..., wait=True)`: `set_home_params(...)` then `return
49
+ self.cmds.set_home_cmd(queued=True, wait_finish=wait)`.
50
+ - `pick_and_place`: all 8 `set_ptp_cmd` steps now pass `wait_finish=True` so
51
+ each move blocks (via DobotLink) until physically complete before the next
52
+ step is queued — no more overlap. Removed the trailing `_wait_for` call
53
+ (the last move already blocks). `set_wait_cmd`/`set_suction_cup` calls
54
+ unchanged.
55
+ - Updated the "Queued motion" docstring bullet to describe blocking via
56
+ DobotLink's `isWaitForFinish`, not client-side polling.
57
+
58
+ ### `tests/conftest.py` (enabling change, not explicitly requested but required)
59
+ `FakeClient.call` gained the matching keyword-only `call_timeout: Optional[float]
60
+ = None`, deliberately **excluded** from the recorded `params` dict — mirroring
61
+ the real `DobotLinkClient.call` contract (`call_timeout` is call metadata, not
62
+ an RPC param). Without this, `call_timeout=None` would have leaked into every
63
+ recorded `params` dict for every `_call`-based method across the whole arm
64
+ suite (motion, effector/IO, sensors — anything going through `_base._call`),
65
+ breaking every test that asserts full-dict equality on `params`
66
+ (`test_set_ptp_cmd_maps_params_and_returns_index`,
67
+ `test_set_wait_cmd_maps_timeout`, `test_suck_delegates`,
68
+ `test_grip_delegates`, `test_servo_delegates`, etc.). This keeps the fix
69
+ scoped to exactly the params the spec calls for (`isWaitForFinish`) with no
70
+ incidental leakage.
71
+
72
+ ### Tests
73
+ `tests/arm/test_magicianlite.py`:
74
+ - `test_move_to_sends_ptp_no_wait`: kept, added assertion
75
+ `p["isWaitForFinish"] is False`.
76
+ - `test_move_to_wait_polls_current_index` → replaced with
77
+ `test_move_to_wait_sends_is_wait_for_finish`: asserts `wait=True` sends
78
+ `isWaitForFinish=True` on `SetPTPCmd` and that
79
+ `Magician.GetQueuedCmdCurrentIndex` is never called.
80
+ - `test_move_to_wait_timeout_raises`: deleted (the `_wait_for` polling
81
+ deadline it exercised no longer exists; client-level timeout behaviour is
82
+ already covered in `tests/go/test_client.py`).
83
+ - `test_home_always_queues_params_and_cmd_even_without_wait`: kept, added
84
+ assertion `cmd_call["isWaitForFinish"] is False`.
85
+ - Removed the now-unused `import pytest` and `DobotTimeoutError` import.
86
+
87
+ `tests/arm/test_commands_motion.py`:
88
+ - `test_set_ptp_cmd_maps_params_and_returns_index`: full-dict assertion
89
+ updated to include `"isWaitForFinish": False`.
90
+ - Added `test_set_ptp_cmd_wait_finish_sends_is_wait_for_finish`: asserts
91
+ `set_ptp_cmd(..., wait_finish=True)` sends `isWaitForFinish=True` and still
92
+ returns the queued index.
93
+ - `test_set_wait_cmd_maps_timeout` untouched (unaffected — `SetWAITCmd` isn't
94
+ part of this change).
95
+
96
+ ## Verification output
97
+
98
+ ```
99
+ PYTHONPATH=src python -m pytest
100
+ 264 passed in 1.43s
101
+
102
+ MYPYPATH=src python -m mypy
103
+ Success: no issues found in 18 source files
104
+
105
+ python -m ruff check src tests
106
+ All checks passed!
107
+ ```
108
+
109
+ Test count is unchanged at 264 (net: -1 deleted `_wait_for` timeout test,
110
+ +1 new `wait_finish` PTP test, 1 test renamed/rewritten in place).
111
+
112
+ ## Concern
113
+
114
+ None outstanding. `pick_and_place`'s 8 sequential `wait_finish=True` PTP calls
115
+ now each carry a 20s per-call timeout (up from the previous default 10s
116
+ client timeout), so a slow real arm has more headroom before the whole
117
+ sequence times out client-side; this was verified against the "home is
118
+ ~15-20s" and general move-duration facts in the brief, not against live
119
+ hardware (this task was explicitly unit-test-only, no hardware access).
@@ -0,0 +1,45 @@
1
+ # SDD Progress — MagicianLite DobotLink rewrite
2
+
3
+ Branch: magicianlite-dobotlink
4
+ Plan: docs/superpowers/plans/2026-07-16-magicianlite-dobotlink-rewrite.md
5
+ Base (branch start): c203329
6
+
7
+ ## Tasks
8
+ - Task 1 (promote DobotLinkClient + fakes): complete (commits 376ec44..2fc75ea, review clean after fixes — full centralization, shim removed, refs repointed). 514 passed/50 skipped, mypy+ruff clean.
9
+ - Task 2 (commands: connection/queue): complete
10
+ - Task 3 (commands: motion): complete
11
+ - Task 4 (commands: effector/servo/IO): complete
12
+ - Task 5 (commands: sensors/alarms): complete
13
+ - Task 6 (groups): complete (commit b975da2). 605 total (555 passed/50 skipped), mypy+ruff clean.
14
+ Note: the old LowLevelArm-based groups.py content was moved verbatim to a new
15
+ private `arm/_legacy_groups.py` (not in the original brief) so the still-live
16
+ serial `arm/magician.py` + its tests (`test_groups.py`,
17
+ `test_groups_magicbox_absent.py`, `test_magician.py`) keep passing until
18
+ Task 8 deletes the serial stack. Task 8 should additionally `git rm
19
+ src/dobotkit/arm/_legacy_groups.py tests/arm/test_groups_magicbox_absent.py`
20
+ (the latter wasn't on its original deletion list).
21
+ - Task 7 (MagicianLite high-level): complete (commit 5278ff4).
22
+ - Task 8 (exports + remove serial): complete (commit 674ed9a). Serial stack + _legacy_groups.py + serial tests deleted, pyserial dropped, MagicianLite exported, old Magician removed. Stale empty lowlevel/structures dirs cleaned by controller.
23
+ VERIFIED by controller (not self-report): 261 passed / 0 skipped, mypy Success (18 files), ruff clean, git clean, no dangling serial refs.
24
+ - Task 9 (docs + live RPC verify): PARTIAL — live smoke ran vs real DobotLink: RPC names recognized (no unknown-method errors) + sensor _guard degrades timeouts to None+warn correctly, BUT the arm/DobotLink is in the unresponsive stuck state again (QueuedCmdClear/GetPose time out), so real sensor VALUE verification is BLOCKED pending a device reset (reboot / reconnect in DobotLab), same as the earlier reboot fix. Docs (README/quickstart/CHANGELOG) rewrite still TODO.
25
+
26
+ ## Final review
27
+ - Whole-branch review (c203329..674ed9a, opus): DONE — verdict "With fixes", Critical 0.
28
+ All Important + worthwhile Minor items applied in commits f2f785b (code) + 604524d (docs):
29
+ home always-queued, _wait_for raises DobotTimeoutError on deadline, __exit__ guards disconnect,
30
+ dropped unused queued param, reuse PTPMode/GPIOType enums, removed dead oracle/FakeSerial infra,
31
+ device-neutral link.py msgs; README/docs/api/arm.md/CHANGELOG rewritten for MagicianLite,
32
+ 3 serial examples replaced by examples/arm_magicianlite.py.
33
+ Independently verified: 264 passed/0 skipped, mypy Success (18 files), ruff clean,
34
+ no dobotkit.Magician(/pyserial refs. => BRANCH IS MERGE-READY pending only Task 9 live value check.
35
+ - Task 9 live value check: DONE (device reset by user). Live vs real DobotLink+arm:
36
+ * 가변저항 reads REAL value through MagicianLite: sensors.adc(24)=3584, get_io_adc(24)={port,value}. ✅
37
+ * get_pose ✅, get_io_di(1)={level,port} (groups read "level" — correct) ✅, get_alarms_state={state:[...]} ✅,
38
+ Seeed reads GetSeeedDistance/Temp/LightSensor + color/infrared RPC names all RECOGNIZED. ✅
39
+ * ONE bug found+fixed (commit ef32a5e): set_seeed_rgb name SetSeeedRGBLED -> SetSeeedRGBLed
40
+ (verified against DobotLink MagicDevicePlugin.dll string table). 264 passed, mypy+ruff green.
41
+ * (set_seeed_rgb end-to-end not exercised — no physical RGB LED connected; name now matches the DLL registry.)
42
+
43
+ ## STATUS: all 9 tasks complete. 264 passed/0 skipped, mypy Success(18), ruff clean, live-verified.
44
+ ## Branch magicianlite-dobotlink is READY TO MERGE into master. Awaiting user go-ahead for merge.
45
+ - Deviation from plan (intentional): ArmCommands built as arm/commands/ mixin PACKAGE (not single commands.py) to enable parallel authoring + mirror old lowlevel pattern. Public import unchanged.