dobotkit 0.2.0__tar.gz → 0.2.2__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 (84) hide show
  1. {dobotkit-0.2.0 → dobotkit-0.2.2}/CHANGELOG.md +270 -210
  2. {dobotkit-0.2.0 → dobotkit-0.2.2}/PKG-INFO +2 -2
  3. dobotkit-0.2.2/src/dobotkit/_version.py +1 -0
  4. {dobotkit-0.2.0 → dobotkit-0.2.2}/src/dobotkit/arm/commands/_base.py +29 -19
  5. dobotkit-0.2.2/src/dobotkit/arm/commands/connection.py +60 -0
  6. {dobotkit-0.2.0 → dobotkit-0.2.2}/src/dobotkit/arm/magicianlite.py +329 -222
  7. dobotkit-0.2.2/tests/arm/test_magicianlite.py +217 -0
  8. dobotkit-0.2.0/src/dobotkit/_version.py +0 -1
  9. dobotkit-0.2.0/src/dobotkit/arm/commands/connection.py +0 -32
  10. dobotkit-0.2.0/tests/arm/test_magicianlite.py +0 -89
  11. {dobotkit-0.2.0 → dobotkit-0.2.2}/.gitignore +0 -0
  12. {dobotkit-0.2.0 → dobotkit-0.2.2}/.superpowers/sdd/.gitignore +0 -0
  13. {dobotkit-0.2.0 → dobotkit-0.2.2}/.superpowers/sdd/motion-wait-fix-report.md +0 -0
  14. {dobotkit-0.2.0 → dobotkit-0.2.2}/.superpowers/sdd/progress.md +0 -0
  15. {dobotkit-0.2.0 → dobotkit-0.2.2}/.superpowers/sdd/review-c203329..376ec44.diff +0 -0
  16. {dobotkit-0.2.0 → dobotkit-0.2.2}/.superpowers/sdd/review-c203329..674ed9a.diff +0 -0
  17. {dobotkit-0.2.0 → dobotkit-0.2.2}/.superpowers/sdd/review-fixes-report.md +0 -0
  18. {dobotkit-0.2.0 → dobotkit-0.2.2}/.superpowers/sdd/task-1-brief.md +0 -0
  19. {dobotkit-0.2.0 → dobotkit-0.2.2}/.superpowers/sdd/task-1-report.md +0 -0
  20. {dobotkit-0.2.0 → dobotkit-0.2.2}/.superpowers/sdd/task-2-brief.md +0 -0
  21. {dobotkit-0.2.0 → dobotkit-0.2.2}/.superpowers/sdd/task-2-report.md +0 -0
  22. {dobotkit-0.2.0 → dobotkit-0.2.2}/.superpowers/sdd/task-3-brief.md +0 -0
  23. {dobotkit-0.2.0 → dobotkit-0.2.2}/.superpowers/sdd/task-4-brief.md +0 -0
  24. {dobotkit-0.2.0 → dobotkit-0.2.2}/.superpowers/sdd/task-5-brief.md +0 -0
  25. {dobotkit-0.2.0 → dobotkit-0.2.2}/.superpowers/sdd/task-6-brief.md +0 -0
  26. {dobotkit-0.2.0 → dobotkit-0.2.2}/.superpowers/sdd/task-7-brief.md +0 -0
  27. {dobotkit-0.2.0 → dobotkit-0.2.2}/.superpowers/sdd/task-8-brief.md +0 -0
  28. {dobotkit-0.2.0 → dobotkit-0.2.2}/CONTEXT.md +0 -0
  29. {dobotkit-0.2.0 → dobotkit-0.2.2}/LICENSE +0 -0
  30. {dobotkit-0.2.0 → dobotkit-0.2.2}/README.md +0 -0
  31. {dobotkit-0.2.0 → dobotkit-0.2.2}/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
  32. {dobotkit-0.2.0 → dobotkit-0.2.2}/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
  33. {dobotkit-0.2.0 → dobotkit-0.2.2}/docs/VERIFICATION_NEEDED_ko.md +0 -0
  34. {dobotkit-0.2.0 → dobotkit-0.2.2}/docs/api/arm.md +0 -0
  35. {dobotkit-0.2.0 → dobotkit-0.2.2}/docs/api/go.md +0 -0
  36. {dobotkit-0.2.0 → dobotkit-0.2.2}/docs/cheatsheet_go.md +0 -0
  37. {dobotkit-0.2.0 → dobotkit-0.2.2}/docs/quickstart-ko.md +0 -0
  38. {dobotkit-0.2.0 → dobotkit-0.2.2}/docs/superpowers/plans/2026-06-30-dobotkit-implementation.md +0 -0
  39. {dobotkit-0.2.0 → dobotkit-0.2.2}/docs/superpowers/plans/2026-07-16-magicianlite-dobotlink-rewrite.md +0 -0
  40. {dobotkit-0.2.0 → dobotkit-0.2.2}/docs/superpowers/specs/2026-06-30-dobotkit-design.md +0 -0
  41. {dobotkit-0.2.0 → dobotkit-0.2.2}/docs/superpowers/specs/2026-07-16-magicbox-absent-graceful-handling-design.md +0 -0
  42. {dobotkit-0.2.0 → dobotkit-0.2.2}/docs/superpowers/specs/2026-07-16-magicianlite-dobotlink-rewrite-design.md +0 -0
  43. {dobotkit-0.2.0 → dobotkit-0.2.2}/examples/arm_magicianlite.py +0 -0
  44. {dobotkit-0.2.0 → dobotkit-0.2.2}/examples/go_discover.py +0 -0
  45. {dobotkit-0.2.0 → dobotkit-0.2.2}/examples/go_magicbox_sensor.py +0 -0
  46. {dobotkit-0.2.0 → dobotkit-0.2.2}/examples/go_teleop.py +0 -0
  47. {dobotkit-0.2.0 → dobotkit-0.2.2}/pyproject.toml +0 -0
  48. {dobotkit-0.2.0 → dobotkit-0.2.2}/src/dobotkit/__init__.py +0 -0
  49. {dobotkit-0.2.0 → dobotkit-0.2.2}/src/dobotkit/arm/__init__.py +0 -0
  50. {dobotkit-0.2.0 → dobotkit-0.2.2}/src/dobotkit/arm/commands/__init__.py +0 -0
  51. {dobotkit-0.2.0 → dobotkit-0.2.2}/src/dobotkit/arm/commands/effector_io.py +0 -0
  52. {dobotkit-0.2.0 → dobotkit-0.2.2}/src/dobotkit/arm/commands/motion.py +0 -0
  53. {dobotkit-0.2.0 → dobotkit-0.2.2}/src/dobotkit/arm/commands/sensors.py +0 -0
  54. {dobotkit-0.2.0 → dobotkit-0.2.2}/src/dobotkit/arm/groups.py +0 -0
  55. {dobotkit-0.2.0 → dobotkit-0.2.2}/src/dobotkit/enums.py +0 -0
  56. {dobotkit-0.2.0 → dobotkit-0.2.2}/src/dobotkit/exceptions.py +0 -0
  57. {dobotkit-0.2.0 → dobotkit-0.2.2}/src/dobotkit/go/__init__.py +0 -0
  58. {dobotkit-0.2.0 → dobotkit-0.2.2}/src/dobotkit/go/geometry.py +0 -0
  59. {dobotkit-0.2.0 → dobotkit-0.2.2}/src/dobotkit/go/groups.py +0 -0
  60. {dobotkit-0.2.0 → dobotkit-0.2.2}/src/dobotkit/go/magiciango.py +0 -0
  61. {dobotkit-0.2.0 → dobotkit-0.2.2}/src/dobotkit/go/navigation.py +0 -0
  62. {dobotkit-0.2.0 → dobotkit-0.2.2}/src/dobotkit/link.py +0 -0
  63. {dobotkit-0.2.0 → dobotkit-0.2.2}/src/dobotkit/py.typed +0 -0
  64. {dobotkit-0.2.0 → dobotkit-0.2.2}/tests/__init__.py +0 -0
  65. {dobotkit-0.2.0 → dobotkit-0.2.2}/tests/arm/__init__.py +0 -0
  66. {dobotkit-0.2.0 → dobotkit-0.2.2}/tests/arm/test_arm_groups.py +0 -0
  67. {dobotkit-0.2.0 → dobotkit-0.2.2}/tests/arm/test_commands_connection.py +0 -0
  68. {dobotkit-0.2.0 → dobotkit-0.2.2}/tests/arm/test_commands_effector_io.py +0 -0
  69. {dobotkit-0.2.0 → dobotkit-0.2.2}/tests/arm/test_commands_motion.py +0 -0
  70. {dobotkit-0.2.0 → dobotkit-0.2.2}/tests/arm/test_commands_sensors.py +0 -0
  71. {dobotkit-0.2.0 → dobotkit-0.2.2}/tests/conftest.py +0 -0
  72. {dobotkit-0.2.0 → dobotkit-0.2.2}/tests/go/__init__.py +0 -0
  73. {dobotkit-0.2.0 → dobotkit-0.2.2}/tests/go/conftest.py +0 -0
  74. {dobotkit-0.2.0 → dobotkit-0.2.2}/tests/go/test_client.py +0 -0
  75. {dobotkit-0.2.0 → dobotkit-0.2.2}/tests/go/test_geometry.py +0 -0
  76. {dobotkit-0.2.0 → dobotkit-0.2.2}/tests/go/test_groups.py +0 -0
  77. {dobotkit-0.2.0 → dobotkit-0.2.2}/tests/go/test_magiciango.py +0 -0
  78. {dobotkit-0.2.0 → dobotkit-0.2.2}/tests/go/test_magiciango_extended.py +0 -0
  79. {dobotkit-0.2.0 → dobotkit-0.2.2}/tests/go/test_navigation.py +0 -0
  80. {dobotkit-0.2.0 → dobotkit-0.2.2}/tests/test_enums.py +0 -0
  81. {dobotkit-0.2.0 → dobotkit-0.2.2}/tests/test_exceptions.py +0 -0
  82. {dobotkit-0.2.0 → dobotkit-0.2.2}/tests/test_integration.py +0 -0
  83. {dobotkit-0.2.0 → dobotkit-0.2.2}/tests/test_smoke.py +0 -0
  84. {dobotkit-0.2.0 → dobotkit-0.2.2}/tests/test_subpackage_api.py +0 -0
@@ -1,210 +1,270 @@
1
- # Changelog
2
-
3
- All notable changes to this project are documented in this file.
4
-
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
-
8
- ## [0.2.0] - 2026-07-24
9
-
10
- ### Added
11
-
12
- - **`pump_off()` on the arm** — `MagicianLite.pump_off()` (and
13
- `effector.pump_off()`). Cuts power to the shared air pump (`enable=False` on
14
- both the suction cup and the gripper) so it stops running and goes quiet.
15
- `suck(False)` / `grip(False)` only flip the valve to *release* and leave the
16
- pump running (so a re-grab is instant); `pump_off()` powers it down. It runs
17
- on the motion queue, so it sequences after any pending `suck`/`grip`.
18
- `disconnect()` / `with`-block teardown now calls it automatically
19
- (immediately, bypassing the queue), so the pump never keeps running after a
20
- program ends.
21
-
22
- ### Changed (BREAKING)
23
-
24
- - **The arm is rewritten on DobotLink; the serial stack is gone.**
25
- `dobotkit.Magician` (`pyserial`-based) is replaced by
26
- `dobotkit.arm.magicianlite.MagicianLite` (exported as `dobotkit.MagicianLite`),
27
- which speaks the arm's `Magician.*` RPC surface through the same DobotLink
28
- JSON-RPC bridge (`ws://localhost:9090`) already used by the GO. **DobotLink.exe
29
- is now required to drive the arm** — there is no more direct serial
30
- connection. `pyserial` is dropped from `dependencies`; `websockets` is now
31
- the library's only runtime dependency.
32
-
33
- The old serial-only surface is gone entirely: `arm.lowlevel` / `LowLevelArm`,
34
- `arm/protocol.py`, `arm/ids.py`, `arm/structures/`, `arm/transport.py`,
35
- `arm/queue.py`, and `arm/alarms.py` no longer exist, and neither does the
36
- `check_alarms=` motion-call argument. The now-dead serial test
37
- infrastructure (`tests/conftest.py`'s `oracle` fixture/`_load_oracle` helper
38
- and the `FakeSerial` double, plus the tests that exercised them) is removed.
39
-
40
- `MagicianLite`'s high-level surface keeps the same shape as before:
41
- `connect`/`disconnect`, context-manager teardown, `home`, `move_to`,
42
- `move_relative`, `pick_and_place`, `set_speed`, `get_pose`, `suck`, `grip`,
43
- and the `effector` / `sensors` / `io` device groups (see `groups.py`).
44
-
45
- - **MagicBox-routed peripheral calls degrade gracefully when the MagicBox is
46
- absent.** `sensors.adc/di/color/infrared/distance/temp/light/rgb` and
47
- `io.get_di`/`io.get_adc` catch a missing MagicBox (or its attached sensor)
48
- answering with `DobotTimeoutError` / `DobotProtocolError`, emit a
49
- `RuntimeWarning`, and return `None` instead of crashing teaching code.
50
- Arm-native calls (motion, `effector.suck`/`grip`/`servo`,
51
- `io.set_do`/`set_pwm`/`set_multiplexing`) and a genuine
52
- `DobotConnectionError` are **not** swallowed.
53
-
54
- - **The Magician GO stack is trimmed to a clean core and now reads its MagicBox
55
- peripherals.** `MagicianGO` keeps continuous drive (`move`/`forward`/
56
- `backward`/`strafe`/`spin`/`stop`/`drive_for`/`emergency_stop`),
57
- `clearance_ok`, native sensors (`ultrasonic`/`ultrasonic_raw`/`odometer`/
58
- `set_odometer`/`battery`/`imu_angle`), `rgb`/`buzzer`, alarms/state
59
- (`get_alarm_info`/`clean_alarm_info`/`stall_protection`/`off_ground`), and
60
- `magic_box_mode`/`magic_box_num`. **New:** `go.sensors`
61
- (`GoSensorGroup`) and `go.io` (`GoIOGroup`) read the GO's MagicBox on the
62
- DobotLink `MagicBox.*` namespace over the *same* `MagicianGO` connection —
63
- ADC/DI/DO/PWM address an **EIO pin (1..26)**, color/infrared/Seeed address a
64
- **Grove connector (1..6)** — and every `go.sensors` read degrades to `None` +
65
- a `RuntimeWarning` when the MagicBox/sensor is absent (hardware-verified
66
- 2026-07-16: the teaching-kit potentiometer on Grove connector 4 reads on EIO
67
- pin 22 via `go.sensors.adc(22)`).
68
-
69
- Removed (BREAKING): all firmware closed-loop / queued motion
70
- (`rotate`/`move_dist`/`arc_rad`/`arc_cent`/`coord_closed_loop`/
71
- `increment_closed_loop` and their `unsafe_` variants, `unsafe_move_pos`,
72
- `move_speed_time`, `set_origin_point`, `move_direct`, `set_running_mode`);
73
- line-tracing (`auto_trace`/`trace_speed`/`trace_pid`/`trace_angle`/
74
- `line_error`/`firmware_trace_angle`/`set_trace_line_info`); cameras
75
- (`car_camera_*`/`arm_camera_*`/`camera_calibration_data`); firmware
76
- command-queue internals; MagicBox stop-point RPCs; device-management RPCs
77
- (`product_name`, fw versions, `device_id`, name/SN, `device_time`,
78
- `device_reboot`, `heartbeat`); `set_running_state`; `set_light_prompt`;
79
- `imu_speed`; `get_move_speed`; `get_running_mode`. The `WaypointNav`
80
- navigation class is removed — `PreciseMover` (continuous move + odometer/IMU
81
- feedback) remains for precise motion. `MagicianGO.__exit__` teardown is
82
- simplified to `emergency_stop` + a confirming `stop` (+ socket close when it
83
- owns the client). Examples `go_line_trace.py`/`go_waypoint_nav.py` are
84
- removed; `go_magicbox_sensor.py` is added.
85
-
86
- ### Fixed
87
-
88
- - **The suction cup and gripper now actually actuate.** The DobotLink parameter
89
- for pump power is `enable` (bool), not the Dobot SDK's `enableCtrl` — DobotLink
90
- silently ignores the unknown key (the RPC returns success but the pump never
91
- powers), so `suck`/`grip` did nothing on hardware. `set_suction_cup` /
92
- `set_gripper` now send `enable`, so `arm.suck(True)` / `arm.grip(True)` grip as
93
- expected (the `on` state key was already correct). Verified live via the
94
- `GetEndEffectorSuctionCup` / `GetEndEffectorGripper` readback
95
- (`enable=True, on=True → {isEnabled: True, isOn: True}`). The FakeClient unit
96
- tests only asserted the *sent* params, so they could not catch a key that
97
- DobotLink does not accept.
98
- - **`home()` always queues `SetHOMEParams`/`SetHOMECmd`.** Previously
99
- `queued=wait` meant `wait=False` sent them unqueued, which could desync the
100
- on-device queue index; `wait` now only controls whether `home()` blocks
101
- until the queue catches up, matching `move_to`'s always-queued behavior.
102
- - **Motion blocks on DobotLink's `isWaitForFinish`, not client-side polling.**
103
- `move_to` / `move_relative` / `home` / `pick_and_place` with `wait=True` send
104
- `isWaitForFinish=true` (with a generous per-call timeout) so DobotLink blocks
105
- until the move physically completes — matching DobotLab. This replaced an
106
- unreliable queued-command-index poll that returned before the move finished,
107
- which let moves overlap and made DobotLink report `action timeout` (verified
108
- on hardware). `pick_and_place` now runs its eight steps sequentially this way.
109
- - **Context-manager teardown (`__exit__`) no longer lets a `disconnect()`
110
- failure escape.** Both `queue_stop()` and `disconnect()` are now
111
- independently best-effort during teardown, so neither can mask the `with`
112
- body's original exception.
113
- - **`DobotTimeoutError` messages are device-neutral.** They used to say "GO
114
- power/wireless link may be down" even when raised for the arm; the shared
115
- `DobotLinkClient` now says the device may be unresponsive or DobotLink lost
116
- the link.
117
-
118
- ### Known limitations
119
-
120
- - **A controller alarm silently blocks arm motion.** If the Magician Lite
121
- controller has an active alarm (`GetAlarmsState` non-zero — observed as a
122
- recurring `byte12` fault on the test unit), DobotLink accepts motion commands
123
- (returns success) but the arm does not move; sensors / IO / effector still
124
- work. The alarm is **not reliably clearable in software** (issuing
125
- `ClearAllAlarmsState` was observed to *trigger* it on the test unit), so the
126
- library does not call it automatically. **Power-cycle the arm to clear it.**
127
- Motion is reliable once the controller is alarm-free and targets stay within
128
- the workspace (a target that drives a joint near its travel limit can fault).
129
-
130
- - **A GO left powered on for a long time drops its wireless link.**
131
- `ConnectDobot` then returns a *false success* (`{firmwareName: "Dobot",
132
- firmwareVersion: "", productName: ""}` — the empty version/name is the tell)
133
- and every subsequent read times out. `MagicianGO.open`/`connect`'s built-in
134
- battery read-back surfaces this immediately. **Power-cycle the car to
135
- recover.**
136
-
137
- ## [0.1.1] - 2026-07-19
138
-
139
- ### Removed
140
-
141
- - **`MagicianGO.running_state()` (`GetRunningState`).** The GO firmware never
142
- answers this call — a reproducible ~10 s `DobotTimeoutError` on the test unit
143
- — while every neighbouring read (`battery`, `ultrasonic`, `imu_angle`,
144
- `odometer`, `off_ground`, `stall_protection`, `magic_box_mode`/`num`,
145
- `get_alarm_info`) works. A method that only ever hangs has no place in the
146
- clean core, so it was dropped (hardware-verified 2026-07-19). Use
147
- `get_alarm_info()` / `stall_protection()` / `off_ground()` for GO status.
148
-
149
- ## [0.1.0] - 2026-06-30
150
-
151
- Initial release of `dobotkit` — a complete, pure-Python control library for the
152
- Dobot Magician Lite robotic arm (serial) and the Dobot Magician GO mobile robot
153
- (DobotLink WebSocket). No DLLs, no native binaries: `pip install` and run on
154
- Windows, macOS, or Linux.
155
-
156
- ### Added
157
-
158
- - **Full arm SDK coverage** — all **203/203** official Dobot arm SDK functions
159
- are mapped 1:1 to a `LowLevelArm` method, proven by
160
- `tests/arm/test_coverage.py`. The arm speaks the Dobot serial framing
161
- (`[0xAA 0xAA][len][id][ctrl][params][checksum]`) directly over `pyserial`;
162
- there is no dependency on `DobotDll`, `DobotRPC`, or any native code.
163
- - **High-level `Magician` API** — ergonomic arm control: `connect`/`disconnect`
164
- and context-manager teardown, `home`, `move_to`, `move_relative`,
165
- `pick_and_place`, `set_speed`, pose access, and `.io` / `.sensors` /
166
- `.effector` / `.lowlevel` groups. Includes pydobot-compatible aliases
167
- (`suck`, `grip`, `speed`, `wait`, `pose`, `get_eio`, `set_eio`, `move_to`) so
168
- existing pydobot scripts port with minimal changes. Optional alarm guards on
169
- motion raise `DobotAlarmError`.
170
- - **Full Magician GO support** — the complete DobotLink `MagicianGO.*` surface
171
- via a JSON-RPC `DobotLinkClient` over `websockets`, wrapped by a high-level
172
- `MagicianGO` API: continuous drive (forward/backward/strafe/spin/move),
173
- closed-loop commands, ultrasonic / IMU / odometer sensors, RGB LEDs, buzzer,
174
- line-tracing, and camera object/tag detection.
175
- - **GO sensor-feedback navigation** — `PreciseMover` and `WaypointNav` provide
176
- closed-loop motion built on odometer/IMU feedback with absolute wall-clock
177
- timeouts and pre-move clearance checks, as a safer alternative to the
178
- hang-prone built-in closed-loop commands.
179
- - **Golden-oracle struct verification** — every wire structure's packed
180
- byte-layout is byte-compared against the official `DobotDllType` ctypes
181
- structs (loaded offline in tests only, never at runtime), guaranteeing the
182
- little-endian packed encodings match the vendor SDK exactly.
183
- - **Shared foundation** — a `DobotError` exception hierarchy, an `enums` module
184
- (`PTPMode`, `JOGMode`, `ContinuousPathMode`, `GPIOType`, `EndEffectorType`,
185
- `ColorPort`, `LEDChannel`), full type hints, and a shipped `py.typed` marker.
186
- - **Lazy device imports** — `import dobotkit` pulls in neither `pyserial` nor
187
- `websockets`; each device's dependencies load only when that device class is
188
- first accessed.
189
- - Runnable `examples/` for both devices: arm (pick-and-place, sensors, full API
190
- tour) and GO (`go_teleop`, `go_waypoint_nav`, `go_line_trace`), plus
191
- `README.md` and `docs/api/` reference (`arm.md`, `go.md`).
192
-
193
- ### Known limitations / caveats
194
-
195
- - **A few protocol command IDs remain unverified.** 14 remain tagged
196
- `# unverified`: DLL-name-only calls with no public wire ID
197
- (motor-mode, speed-ratio, restart-magic-box, fw-ready) and the MagicBox/Seeed
198
- Grove sensor extensions. Confirm these on hardware or against MagicBox-specific
199
- docs before relying on them. (Struct **byte-layouts** are independently
200
- verified offline against `DobotDllType` by the golden-oracle tests — this
201
- caveat applies to *command-ID values*, not to packing.)
202
- - **GO built-in closed-loop commands can hang.** The device-side closed-loop
203
- commands (`rotate`, `move_dist`, `arc_*`, `*_closed_loop`) may block
204
- indefinitely; prefer `PreciseMover` / `WaypointNav`, which close the loop in
205
- software with timeouts.
206
- - **GO closed-loop turn direction (yaw sign) needs on-hardware confirmation.**
207
-
208
- [0.2.0]: https://example.com/dobotkit/compare/v0.1.1...v0.2.0
209
- [0.1.1]: https://example.com/dobotkit/compare/v0.1.0...v0.1.1
210
- [0.1.0]: https://example.com/dobotkit/releases/tag/v0.1.0
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.2.2] - 2026-11-05
9
+
10
+ ### Fixed
11
+
12
+ - **`home()` 이 홈 설정을 매번 덮어쓰던 문제.** x/y/z/r 기본값이 `200, 0, 0, 0` 이라
13
+ `home()` 을 부를 때마다 `SetHOMEParams` 로 홈을 그 좌표로 다시 썼다. 그래서 선생님이
14
+ 코디니에서 초기 위치를 따로 지정해도 **수업 중 첫 `home()` 한 번에 풀렸다**
15
+ (현장 메모 2026-11-01: "초기 위치를 특정 좌표로 재지정하려 했으나 설정이 유지되지 않고 풀림.
16
+ 두봇 키트가 시작 시 공장 초기 위치를 강제 호출하는 것으로 추정").
17
+
18
+ - 좌표를 **하나도 주지 않으면** 홈 설정을 건드리지 않고 원점복귀만 한다 →
19
+ 컨트롤러에 저장된(선생님이 지정한) 홈이 그대로 유지된다.
20
+ - 좌표를 주면 그때만 홈을 바꾼다. 값은 컨트롤러에 남아 다음 `home()` 부터 적용된다.
21
+
22
+ ### Added
23
+
24
+ - **`MagicianLite.set_home(x=None, y=None, z=None, r=None)`** — 원점복귀가 찾아갈 홈
25
+ 좌표를 바꾼다. 주지 않은 축은 **지금 자리 값**으로 채운다(0 으로 덮이지 않게).
26
+ 공장 기본값으로 되돌리려면 `set_home(200, 0, 0, 0)`.
27
+
28
+ ## [0.2.1] - 2026-11-01
29
+
30
+ ### Fixed
31
+
32
+ - **큐에 넣은 동작이 잘려 나가는 문제 — "집게가 작동 안 함" 의 정체.**
33
+ `move_to` / `suck` / `grip` 은 모두 명령을 모션 큐에 넣고 **즉시 반환**한다
34
+ (`home` 만 예외로 기다렸다). 그래서
35
+
36
+ ```python
37
+ 팔.grip(True)
38
+ 팔.grip(False)
39
+ 팔.pump_off()
40
+ ```
41
+
42
+ 같은 코드는 세 명령이 큐에 들어간 채 스크립트가 끝나고, 뒷정리(`__exit__` →
43
+ `queue_stop()`, `disconnect()` → `pump_off(queued=False)`)가 아직 실행되지 않은
44
+ 동작을 **잘라 먹었다**. 집게가 아예 움직이지 않는 것처럼 보였다.
45
+ 0.2.0 의 `pump_off()` 문서가 "큐에 올라가 pending suck/grip 뒤에 실행된다"고
46
+ 적어 둔 것과 실제 동작이 어긋나 있었다.
47
+
48
+ - `MagicianLite.pump_off(*, wait=True)` — 기본값이 **큐가 빌 때까지 기다린 뒤**
49
+ 펌프를 끈다. 수업 코드는 모두 `pump_off()` 로 끝나므로, 학생 코드를 한 글자도
50
+ 고치지 않고 이 부류의 버그가 사라진다. 비상정지처럼 즉시 멈춰야 하는 경로는
51
+ `pump_off(wait=False)`.
52
+ - `MagicianLite.wait(timeout=30.0)` / `ArmCommands.wait_until_idle()` — 큐에 넣은
53
+ 동작이 실제로 실행될 때까지 기다린다(타임아웃이 있어 영원히 매달리지 않는다).
54
+ - `suck(on, *, wait=False)` · `grip(on, *, wait=False)` — 필요할 때 명시적으로 기다릴 수 있다.
55
+ - `__exit__` 은 **정상 종료일 때만** 큐를 비운 뒤 멈춘다. 예외로 빠져나갈 때는
56
+ 기다리지 않고 즉시 멈춘다(그게 안전하다).
57
+
58
+ - **`port="auto"` 가 아무 포트나 집던 문제.** `search()` 결과의 `ports[0]` 을 그냥
59
+ 썼다. 교실 PC 에는 팔 외에 Magic Box · Magician Go 같은 장치가 함께 꽂혀 있어서
60
+ 첫 번째가 팔이 아니면 엉뚱한 포트로 연결을 시도했다. 이제 장치 이름으로
61
+ Magician(Lite) 을 먼저 고르고, 가릴 수 없을 때만 예전처럼 첫 번째를 쓴다.
62
+
63
+ ### Internal
64
+
65
+ - `_Base._call()` 이 응답의 `queuedCmdIndex` 를 한곳에서 추적한다(`_last_queued`).
66
+ `wait_until_idle()` 이 `GetQueuedCmdCurrentIndex` 와 비교하는 기준값이다.
67
+
68
+ ## [0.2.0] - 2026-07-24
69
+
70
+ ### Added
71
+
72
+ - **`pump_off()` on the arm** — `MagicianLite.pump_off()` (and
73
+ `effector.pump_off()`). Cuts power to the shared air pump (`enable=False` on
74
+ both the suction cup and the gripper) so it stops running and goes quiet.
75
+ `suck(False)` / `grip(False)` only flip the valve to *release* and leave the
76
+ pump running (so a re-grab is instant); `pump_off()` powers it down. It runs
77
+ on the motion queue, so it sequences after any pending `suck`/`grip`.
78
+ `disconnect()` / `with`-block teardown now calls it automatically
79
+ (immediately, bypassing the queue), so the pump never keeps running after a
80
+ program ends.
81
+
82
+ ### Changed (BREAKING)
83
+
84
+ - **The arm is rewritten on DobotLink; the serial stack is gone.**
85
+ `dobotkit.Magician` (`pyserial`-based) is replaced by
86
+ `dobotkit.arm.magicianlite.MagicianLite` (exported as `dobotkit.MagicianLite`),
87
+ which speaks the arm's `Magician.*` RPC surface through the same DobotLink
88
+ JSON-RPC bridge (`ws://localhost:9090`) already used by the GO. **DobotLink.exe
89
+ is now required to drive the arm** — there is no more direct serial
90
+ connection. `pyserial` is dropped from `dependencies`; `websockets` is now
91
+ the library's only runtime dependency.
92
+
93
+ The old serial-only surface is gone entirely: `arm.lowlevel` / `LowLevelArm`,
94
+ `arm/protocol.py`, `arm/ids.py`, `arm/structures/`, `arm/transport.py`,
95
+ `arm/queue.py`, and `arm/alarms.py` no longer exist, and neither does the
96
+ `check_alarms=` motion-call argument. The now-dead serial test
97
+ infrastructure (`tests/conftest.py`'s `oracle` fixture/`_load_oracle` helper
98
+ and the `FakeSerial` double, plus the tests that exercised them) is removed.
99
+
100
+ `MagicianLite`'s high-level surface keeps the same shape as before:
101
+ `connect`/`disconnect`, context-manager teardown, `home`, `move_to`,
102
+ `move_relative`, `pick_and_place`, `set_speed`, `get_pose`, `suck`, `grip`,
103
+ and the `effector` / `sensors` / `io` device groups (see `groups.py`).
104
+
105
+ - **MagicBox-routed peripheral calls degrade gracefully when the MagicBox is
106
+ absent.** `sensors.adc/di/color/infrared/distance/temp/light/rgb` and
107
+ `io.get_di`/`io.get_adc` catch a missing MagicBox (or its attached sensor)
108
+ answering with `DobotTimeoutError` / `DobotProtocolError`, emit a
109
+ `RuntimeWarning`, and return `None` instead of crashing teaching code.
110
+ Arm-native calls (motion, `effector.suck`/`grip`/`servo`,
111
+ `io.set_do`/`set_pwm`/`set_multiplexing`) and a genuine
112
+ `DobotConnectionError` are **not** swallowed.
113
+
114
+ - **The Magician GO stack is trimmed to a clean core and now reads its MagicBox
115
+ peripherals.** `MagicianGO` keeps continuous drive (`move`/`forward`/
116
+ `backward`/`strafe`/`spin`/`stop`/`drive_for`/`emergency_stop`),
117
+ `clearance_ok`, native sensors (`ultrasonic`/`ultrasonic_raw`/`odometer`/
118
+ `set_odometer`/`battery`/`imu_angle`), `rgb`/`buzzer`, alarms/state
119
+ (`get_alarm_info`/`clean_alarm_info`/`stall_protection`/`off_ground`), and
120
+ `magic_box_mode`/`magic_box_num`. **New:** `go.sensors`
121
+ (`GoSensorGroup`) and `go.io` (`GoIOGroup`) read the GO's MagicBox on the
122
+ DobotLink `MagicBox.*` namespace over the *same* `MagicianGO` connection —
123
+ ADC/DI/DO/PWM address an **EIO pin (1..26)**, color/infrared/Seeed address a
124
+ **Grove connector (1..6)** — and every `go.sensors` read degrades to `None` +
125
+ a `RuntimeWarning` when the MagicBox/sensor is absent (hardware-verified
126
+ 2026-07-16: the teaching-kit potentiometer on Grove connector 4 reads on EIO
127
+ pin 22 via `go.sensors.adc(22)`).
128
+
129
+ Removed (BREAKING): all firmware closed-loop / queued motion
130
+ (`rotate`/`move_dist`/`arc_rad`/`arc_cent`/`coord_closed_loop`/
131
+ `increment_closed_loop` and their `unsafe_` variants, `unsafe_move_pos`,
132
+ `move_speed_time`, `set_origin_point`, `move_direct`, `set_running_mode`);
133
+ line-tracing (`auto_trace`/`trace_speed`/`trace_pid`/`trace_angle`/
134
+ `line_error`/`firmware_trace_angle`/`set_trace_line_info`); cameras
135
+ (`car_camera_*`/`arm_camera_*`/`camera_calibration_data`); firmware
136
+ command-queue internals; MagicBox stop-point RPCs; device-management RPCs
137
+ (`product_name`, fw versions, `device_id`, name/SN, `device_time`,
138
+ `device_reboot`, `heartbeat`); `set_running_state`; `set_light_prompt`;
139
+ `imu_speed`; `get_move_speed`; `get_running_mode`. The `WaypointNav`
140
+ navigation class is removed — `PreciseMover` (continuous move + odometer/IMU
141
+ feedback) remains for precise motion. `MagicianGO.__exit__` teardown is
142
+ simplified to `emergency_stop` + a confirming `stop` (+ socket close when it
143
+ owns the client). Examples `go_line_trace.py`/`go_waypoint_nav.py` are
144
+ removed; `go_magicbox_sensor.py` is added.
145
+
146
+ ### Fixed
147
+
148
+ - **The suction cup and gripper now actually actuate.** The DobotLink parameter
149
+ for pump power is `enable` (bool), not the Dobot SDK's `enableCtrl` — DobotLink
150
+ silently ignores the unknown key (the RPC returns success but the pump never
151
+ powers), so `suck`/`grip` did nothing on hardware. `set_suction_cup` /
152
+ `set_gripper` now send `enable`, so `arm.suck(True)` / `arm.grip(True)` grip as
153
+ expected (the `on` state key was already correct). Verified live via the
154
+ `GetEndEffectorSuctionCup` / `GetEndEffectorGripper` readback
155
+ (`enable=True, on=True → {isEnabled: True, isOn: True}`). The FakeClient unit
156
+ tests only asserted the *sent* params, so they could not catch a key that
157
+ DobotLink does not accept.
158
+ - **`home()` always queues `SetHOMEParams`/`SetHOMECmd`.** Previously
159
+ `queued=wait` meant `wait=False` sent them unqueued, which could desync the
160
+ on-device queue index; `wait` now only controls whether `home()` blocks
161
+ until the queue catches up, matching `move_to`'s always-queued behavior.
162
+ - **Motion blocks on DobotLink's `isWaitForFinish`, not client-side polling.**
163
+ `move_to` / `move_relative` / `home` / `pick_and_place` with `wait=True` send
164
+ `isWaitForFinish=true` (with a generous per-call timeout) so DobotLink blocks
165
+ until the move physically completes — matching DobotLab. This replaced an
166
+ unreliable queued-command-index poll that returned before the move finished,
167
+ which let moves overlap and made DobotLink report `action timeout` (verified
168
+ on hardware). `pick_and_place` now runs its eight steps sequentially this way.
169
+ - **Context-manager teardown (`__exit__`) no longer lets a `disconnect()`
170
+ failure escape.** Both `queue_stop()` and `disconnect()` are now
171
+ independently best-effort during teardown, so neither can mask the `with`
172
+ body's original exception.
173
+ - **`DobotTimeoutError` messages are device-neutral.** They used to say "GO
174
+ power/wireless link may be down" even when raised for the arm; the shared
175
+ `DobotLinkClient` now says the device may be unresponsive or DobotLink lost
176
+ the link.
177
+
178
+ ### Known limitations
179
+
180
+ - **A controller alarm silently blocks arm motion.** If the Magician Lite
181
+ controller has an active alarm (`GetAlarmsState` non-zero — observed as a
182
+ recurring `byte12` fault on the test unit), DobotLink accepts motion commands
183
+ (returns success) but the arm does not move; sensors / IO / effector still
184
+ work. The alarm is **not reliably clearable in software** (issuing
185
+ `ClearAllAlarmsState` was observed to *trigger* it on the test unit), so the
186
+ library does not call it automatically. **Power-cycle the arm to clear it.**
187
+ Motion is reliable once the controller is alarm-free and targets stay within
188
+ the workspace (a target that drives a joint near its travel limit can fault).
189
+
190
+ - **A GO left powered on for a long time drops its wireless link.**
191
+ `ConnectDobot` then returns a *false success* (`{firmwareName: "Dobot",
192
+ firmwareVersion: "", productName: ""}` — the empty version/name is the tell)
193
+ and every subsequent read times out. `MagicianGO.open`/`connect`'s built-in
194
+ battery read-back surfaces this immediately. **Power-cycle the car to
195
+ recover.**
196
+
197
+ ## [0.1.1] - 2026-07-19
198
+
199
+ ### Removed
200
+
201
+ - **`MagicianGO.running_state()` (`GetRunningState`).** The GO firmware never
202
+ answers this call — a reproducible ~10 s `DobotTimeoutError` on the test unit
203
+ — while every neighbouring read (`battery`, `ultrasonic`, `imu_angle`,
204
+ `odometer`, `off_ground`, `stall_protection`, `magic_box_mode`/`num`,
205
+ `get_alarm_info`) works. A method that only ever hangs has no place in the
206
+ clean core, so it was dropped (hardware-verified 2026-07-19). Use
207
+ `get_alarm_info()` / `stall_protection()` / `off_ground()` for GO status.
208
+
209
+ ## [0.1.0] - 2026-06-30
210
+
211
+ Initial release of `dobotkit` — a complete, pure-Python control library for the
212
+ Dobot Magician Lite robotic arm (serial) and the Dobot Magician GO mobile robot
213
+ (DobotLink WebSocket). No DLLs, no native binaries: `pip install` and run on
214
+ Windows, macOS, or Linux.
215
+
216
+ ### Added
217
+
218
+ - **Full arm SDK coverage** — all **203/203** official Dobot arm SDK functions
219
+ are mapped 1:1 to a `LowLevelArm` method, proven by
220
+ `tests/arm/test_coverage.py`. The arm speaks the Dobot serial framing
221
+ (`[0xAA 0xAA][len][id][ctrl][params][checksum]`) directly over `pyserial`;
222
+ there is no dependency on `DobotDll`, `DobotRPC`, or any native code.
223
+ - **High-level `Magician` API** — ergonomic arm control: `connect`/`disconnect`
224
+ and context-manager teardown, `home`, `move_to`, `move_relative`,
225
+ `pick_and_place`, `set_speed`, pose access, and `.io` / `.sensors` /
226
+ `.effector` / `.lowlevel` groups. Includes pydobot-compatible aliases
227
+ (`suck`, `grip`, `speed`, `wait`, `pose`, `get_eio`, `set_eio`, `move_to`) so
228
+ existing pydobot scripts port with minimal changes. Optional alarm guards on
229
+ motion raise `DobotAlarmError`.
230
+ - **Full Magician GO support** — the complete DobotLink `MagicianGO.*` surface
231
+ via a JSON-RPC `DobotLinkClient` over `websockets`, wrapped by a high-level
232
+ `MagicianGO` API: continuous drive (forward/backward/strafe/spin/move),
233
+ closed-loop commands, ultrasonic / IMU / odometer sensors, RGB LEDs, buzzer,
234
+ line-tracing, and camera object/tag detection.
235
+ - **GO sensor-feedback navigation** — `PreciseMover` and `WaypointNav` provide
236
+ closed-loop motion built on odometer/IMU feedback with absolute wall-clock
237
+ timeouts and pre-move clearance checks, as a safer alternative to the
238
+ hang-prone built-in closed-loop commands.
239
+ - **Golden-oracle struct verification** — every wire structure's packed
240
+ byte-layout is byte-compared against the official `DobotDllType` ctypes
241
+ structs (loaded offline in tests only, never at runtime), guaranteeing the
242
+ little-endian packed encodings match the vendor SDK exactly.
243
+ - **Shared foundation** — a `DobotError` exception hierarchy, an `enums` module
244
+ (`PTPMode`, `JOGMode`, `ContinuousPathMode`, `GPIOType`, `EndEffectorType`,
245
+ `ColorPort`, `LEDChannel`), full type hints, and a shipped `py.typed` marker.
246
+ - **Lazy device imports** — `import dobotkit` pulls in neither `pyserial` nor
247
+ `websockets`; each device's dependencies load only when that device class is
248
+ first accessed.
249
+ - Runnable `examples/` for both devices: arm (pick-and-place, sensors, full API
250
+ tour) and GO (`go_teleop`, `go_waypoint_nav`, `go_line_trace`), plus
251
+ `README.md` and `docs/api/` reference (`arm.md`, `go.md`).
252
+
253
+ ### Known limitations / caveats
254
+
255
+ - **A few protocol command IDs remain unverified.** 14 remain tagged
256
+ `# unverified`: DLL-name-only calls with no public wire ID
257
+ (motor-mode, speed-ratio, restart-magic-box, fw-ready) and the MagicBox/Seeed
258
+ Grove sensor extensions. Confirm these on hardware or against MagicBox-specific
259
+ docs before relying on them. (Struct **byte-layouts** are independently
260
+ verified offline against `DobotDllType` by the golden-oracle tests — this
261
+ caveat applies to *command-ID values*, not to packing.)
262
+ - **GO built-in closed-loop commands can hang.** The device-side closed-loop
263
+ commands (`rotate`, `move_dist`, `arc_*`, `*_closed_loop`) may block
264
+ indefinitely; prefer `PreciseMover` / `WaypointNav`, which close the loop in
265
+ software with timeouts.
266
+ - **GO closed-loop turn direction (yaw sign) needs on-hardware confirmation.**
267
+
268
+ [0.2.0]: https://example.com/dobotkit/compare/v0.1.1...v0.2.0
269
+ [0.1.1]: https://example.com/dobotkit/compare/v0.1.0...v0.1.1
270
+ [0.1.0]: https://example.com/dobotkit/releases/tag/v0.1.0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: dobotkit
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: Complete pure-Python control library for Dobot Magician Lite (arm) and Magician GO (car) over DobotLink
5
5
  Project-URL: Homepage, https://github.com/mslopgk/dobotkit
6
6
  Project-URL: Repository, https://github.com/mslopgk/dobotkit
@@ -0,0 +1 @@
1
+ __version__ = "0.2.2"
@@ -1,19 +1,29 @@
1
- """Shared base for the arm's DobotLink RPC command mixins."""
2
- from __future__ import annotations
3
- from typing import Any, Optional
4
- from dobotkit.link import DobotLinkClient
5
-
6
-
7
- class _Base:
8
- """Connection state and the shared ``_call`` / ``_queued_index`` primitives."""
9
-
10
- def __init__(self, client: DobotLinkClient, port_name: str) -> None:
11
- self._client = client
12
- self.port_name = port_name
13
-
14
- def _call(self, func: str, *, call_timeout: Optional[float] = None, **params: Any) -> Any:
15
- params["portName"] = self.port_name
16
- return self._client.call(f"Magician.{func}", call_timeout=call_timeout, **params)
17
-
18
- def _queued_index(self, resp: Any) -> int:
19
- return int(resp.get("queuedCmdIndex", 0)) if isinstance(resp, dict) else int(resp or 0)
1
+ """Shared base for the arm's DobotLink RPC command mixins."""
2
+ from __future__ import annotations
3
+ from typing import Any, Optional
4
+ from dobotkit.link import DobotLinkClient
5
+
6
+
7
+ class _Base:
8
+ """Connection state and the shared ``_call`` / ``_queued_index`` primitives."""
9
+
10
+ def __init__(self, client: DobotLinkClient, port_name: str) -> None:
11
+ self._client = client
12
+ self.port_name = port_name
13
+ # 마지막으로 큐에 들어간 명령의 인덱스. 큐가 어디까지 실행됐는지 비교하는 기준이다
14
+ # (wait_until_idle). 큐에 올라간 명령은 응답에 queuedCmdIndex 를 담아 준다.
15
+ self._last_queued = 0
16
+
17
+ def _call(self, func: str, *, call_timeout: Optional[float] = None, **params: Any) -> Any:
18
+ params["portName"] = self.port_name
19
+ resp = self._client.call(f"Magician.{func}", call_timeout=call_timeout, **params)
20
+ # 큐에 올라간 명령이면 인덱스를 기억해 둔다. 한 곳에서 잡아야 빠짐이 없다.
21
+ if isinstance(resp, dict) and "queuedCmdIndex" in resp:
22
+ try:
23
+ self._last_queued = max(self._last_queued, int(resp["queuedCmdIndex"]))
24
+ except (TypeError, ValueError):
25
+ pass
26
+ return resp
27
+
28
+ def _queued_index(self, resp: Any) -> int:
29
+ return int(resp.get("queuedCmdIndex", 0)) if isinstance(resp, dict) else int(resp or 0)