dobotkit 0.1.0__tar.gz → 0.2.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 (82) hide show
  1. {dobotkit-0.1.0 → dobotkit-0.2.0}/CHANGELOG.md +46 -4
  2. {dobotkit-0.1.0 → dobotkit-0.2.0}/PKG-INFO +3 -5
  3. {dobotkit-0.1.0 → dobotkit-0.2.0}/README.md +2 -4
  4. {dobotkit-0.1.0 → dobotkit-0.2.0}/docs/VERIFICATION_NEEDED_ko.md +0 -1
  5. {dobotkit-0.1.0 → dobotkit-0.2.0}/docs/api/go.md +0 -1
  6. {dobotkit-0.1.0 → dobotkit-0.2.0}/docs/cheatsheet_go.md +1 -2
  7. {dobotkit-0.1.0 → dobotkit-0.2.0}/docs/quickstart-ko.md +1 -3
  8. dobotkit-0.2.0/src/dobotkit/_version.py +1 -0
  9. {dobotkit-0.1.0 → dobotkit-0.2.0}/src/dobotkit/arm/commands/effector_io.py +8 -2
  10. {dobotkit-0.1.0 → dobotkit-0.2.0}/src/dobotkit/arm/groups.py +16 -0
  11. {dobotkit-0.1.0 → dobotkit-0.2.0}/src/dobotkit/arm/magicianlite.py +20 -1
  12. {dobotkit-0.1.0 → dobotkit-0.2.0}/src/dobotkit/go/magiciango.py +0 -4
  13. {dobotkit-0.1.0 → dobotkit-0.2.0}/tests/arm/test_arm_groups.py +25 -2
  14. {dobotkit-0.1.0 → dobotkit-0.2.0}/tests/arm/test_commands_effector_io.py +4 -2
  15. {dobotkit-0.1.0 → dobotkit-0.2.0}/tests/arm/test_magicianlite.py +29 -0
  16. {dobotkit-0.1.0 → dobotkit-0.2.0}/tests/go/test_magiciango_extended.py +0 -6
  17. dobotkit-0.1.0/src/dobotkit/_version.py +0 -1
  18. {dobotkit-0.1.0 → dobotkit-0.2.0}/.gitignore +0 -0
  19. {dobotkit-0.1.0 → dobotkit-0.2.0}/.superpowers/sdd/.gitignore +0 -0
  20. {dobotkit-0.1.0 → dobotkit-0.2.0}/.superpowers/sdd/motion-wait-fix-report.md +0 -0
  21. {dobotkit-0.1.0 → dobotkit-0.2.0}/.superpowers/sdd/progress.md +0 -0
  22. {dobotkit-0.1.0 → dobotkit-0.2.0}/.superpowers/sdd/review-c203329..376ec44.diff +0 -0
  23. {dobotkit-0.1.0 → dobotkit-0.2.0}/.superpowers/sdd/review-c203329..674ed9a.diff +0 -0
  24. {dobotkit-0.1.0 → dobotkit-0.2.0}/.superpowers/sdd/review-fixes-report.md +0 -0
  25. {dobotkit-0.1.0 → dobotkit-0.2.0}/.superpowers/sdd/task-1-brief.md +0 -0
  26. {dobotkit-0.1.0 → dobotkit-0.2.0}/.superpowers/sdd/task-1-report.md +0 -0
  27. {dobotkit-0.1.0 → dobotkit-0.2.0}/.superpowers/sdd/task-2-brief.md +0 -0
  28. {dobotkit-0.1.0 → dobotkit-0.2.0}/.superpowers/sdd/task-2-report.md +0 -0
  29. {dobotkit-0.1.0 → dobotkit-0.2.0}/.superpowers/sdd/task-3-brief.md +0 -0
  30. {dobotkit-0.1.0 → dobotkit-0.2.0}/.superpowers/sdd/task-4-brief.md +0 -0
  31. {dobotkit-0.1.0 → dobotkit-0.2.0}/.superpowers/sdd/task-5-brief.md +0 -0
  32. {dobotkit-0.1.0 → dobotkit-0.2.0}/.superpowers/sdd/task-6-brief.md +0 -0
  33. {dobotkit-0.1.0 → dobotkit-0.2.0}/.superpowers/sdd/task-7-brief.md +0 -0
  34. {dobotkit-0.1.0 → dobotkit-0.2.0}/.superpowers/sdd/task-8-brief.md +0 -0
  35. {dobotkit-0.1.0 → dobotkit-0.2.0}/CONTEXT.md +0 -0
  36. {dobotkit-0.1.0 → dobotkit-0.2.0}/LICENSE +0 -0
  37. {dobotkit-0.1.0 → dobotkit-0.2.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
  38. {dobotkit-0.1.0 → dobotkit-0.2.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
  39. {dobotkit-0.1.0 → dobotkit-0.2.0}/docs/api/arm.md +0 -0
  40. {dobotkit-0.1.0 → dobotkit-0.2.0}/docs/superpowers/plans/2026-06-30-dobotkit-implementation.md +0 -0
  41. {dobotkit-0.1.0 → dobotkit-0.2.0}/docs/superpowers/plans/2026-07-16-magicianlite-dobotlink-rewrite.md +0 -0
  42. {dobotkit-0.1.0 → dobotkit-0.2.0}/docs/superpowers/specs/2026-06-30-dobotkit-design.md +0 -0
  43. {dobotkit-0.1.0 → dobotkit-0.2.0}/docs/superpowers/specs/2026-07-16-magicbox-absent-graceful-handling-design.md +0 -0
  44. {dobotkit-0.1.0 → dobotkit-0.2.0}/docs/superpowers/specs/2026-07-16-magicianlite-dobotlink-rewrite-design.md +0 -0
  45. {dobotkit-0.1.0 → dobotkit-0.2.0}/examples/arm_magicianlite.py +0 -0
  46. {dobotkit-0.1.0 → dobotkit-0.2.0}/examples/go_discover.py +0 -0
  47. {dobotkit-0.1.0 → dobotkit-0.2.0}/examples/go_magicbox_sensor.py +0 -0
  48. {dobotkit-0.1.0 → dobotkit-0.2.0}/examples/go_teleop.py +0 -0
  49. {dobotkit-0.1.0 → dobotkit-0.2.0}/pyproject.toml +0 -0
  50. {dobotkit-0.1.0 → dobotkit-0.2.0}/src/dobotkit/__init__.py +0 -0
  51. {dobotkit-0.1.0 → dobotkit-0.2.0}/src/dobotkit/arm/__init__.py +0 -0
  52. {dobotkit-0.1.0 → dobotkit-0.2.0}/src/dobotkit/arm/commands/__init__.py +0 -0
  53. {dobotkit-0.1.0 → dobotkit-0.2.0}/src/dobotkit/arm/commands/_base.py +0 -0
  54. {dobotkit-0.1.0 → dobotkit-0.2.0}/src/dobotkit/arm/commands/connection.py +0 -0
  55. {dobotkit-0.1.0 → dobotkit-0.2.0}/src/dobotkit/arm/commands/motion.py +0 -0
  56. {dobotkit-0.1.0 → dobotkit-0.2.0}/src/dobotkit/arm/commands/sensors.py +0 -0
  57. {dobotkit-0.1.0 → dobotkit-0.2.0}/src/dobotkit/enums.py +0 -0
  58. {dobotkit-0.1.0 → dobotkit-0.2.0}/src/dobotkit/exceptions.py +0 -0
  59. {dobotkit-0.1.0 → dobotkit-0.2.0}/src/dobotkit/go/__init__.py +0 -0
  60. {dobotkit-0.1.0 → dobotkit-0.2.0}/src/dobotkit/go/geometry.py +0 -0
  61. {dobotkit-0.1.0 → dobotkit-0.2.0}/src/dobotkit/go/groups.py +0 -0
  62. {dobotkit-0.1.0 → dobotkit-0.2.0}/src/dobotkit/go/navigation.py +0 -0
  63. {dobotkit-0.1.0 → dobotkit-0.2.0}/src/dobotkit/link.py +0 -0
  64. {dobotkit-0.1.0 → dobotkit-0.2.0}/src/dobotkit/py.typed +0 -0
  65. {dobotkit-0.1.0 → dobotkit-0.2.0}/tests/__init__.py +0 -0
  66. {dobotkit-0.1.0 → dobotkit-0.2.0}/tests/arm/__init__.py +0 -0
  67. {dobotkit-0.1.0 → dobotkit-0.2.0}/tests/arm/test_commands_connection.py +0 -0
  68. {dobotkit-0.1.0 → dobotkit-0.2.0}/tests/arm/test_commands_motion.py +0 -0
  69. {dobotkit-0.1.0 → dobotkit-0.2.0}/tests/arm/test_commands_sensors.py +0 -0
  70. {dobotkit-0.1.0 → dobotkit-0.2.0}/tests/conftest.py +0 -0
  71. {dobotkit-0.1.0 → dobotkit-0.2.0}/tests/go/__init__.py +0 -0
  72. {dobotkit-0.1.0 → dobotkit-0.2.0}/tests/go/conftest.py +0 -0
  73. {dobotkit-0.1.0 → dobotkit-0.2.0}/tests/go/test_client.py +0 -0
  74. {dobotkit-0.1.0 → dobotkit-0.2.0}/tests/go/test_geometry.py +0 -0
  75. {dobotkit-0.1.0 → dobotkit-0.2.0}/tests/go/test_groups.py +0 -0
  76. {dobotkit-0.1.0 → dobotkit-0.2.0}/tests/go/test_magiciango.py +0 -0
  77. {dobotkit-0.1.0 → dobotkit-0.2.0}/tests/go/test_navigation.py +0 -0
  78. {dobotkit-0.1.0 → dobotkit-0.2.0}/tests/test_enums.py +0 -0
  79. {dobotkit-0.1.0 → dobotkit-0.2.0}/tests/test_exceptions.py +0 -0
  80. {dobotkit-0.1.0 → dobotkit-0.2.0}/tests/test_integration.py +0 -0
  81. {dobotkit-0.1.0 → dobotkit-0.2.0}/tests/test_smoke.py +0 -0
  82. {dobotkit-0.1.0 → dobotkit-0.2.0}/tests/test_subpackage_api.py +0 -0
@@ -5,7 +5,19 @@ All notable changes to this project are documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
- ## [Unreleased]
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.
9
21
 
10
22
  ### Changed (BREAKING)
11
23
 
@@ -44,8 +56,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
44
56
  `backward`/`strafe`/`spin`/`stop`/`drive_for`/`emergency_stop`),
45
57
  `clearance_ok`, native sensors (`ultrasonic`/`ultrasonic_raw`/`odometer`/
46
58
  `set_odometer`/`battery`/`imu_angle`), `rgb`/`buzzer`, alarms/state
47
- (`get_alarm_info`/`clean_alarm_info`/`running_state`/`stall_protection`/
48
- `off_ground`), and `magic_box_mode`/`magic_box_num`. **New:** `go.sensors`
59
+ (`get_alarm_info`/`clean_alarm_info`/`stall_protection`/`off_ground`), and
60
+ `magic_box_mode`/`magic_box_num`. **New:** `go.sensors`
49
61
  (`GoSensorGroup`) and `go.io` (`GoIOGroup`) read the GO's MagicBox on the
50
62
  DobotLink `MagicBox.*` namespace over the *same* `MagicianGO` connection —
51
63
  ADC/DI/DO/PWM address an **EIO pin (1..26)**, color/infrared/Seeed address a
@@ -73,6 +85,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
73
85
 
74
86
  ### Fixed
75
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.
76
98
  - **`home()` always queues `SetHOMEParams`/`SetHOMECmd`.** Previously
77
99
  `queued=wait` meant `wait=False` sent them unqueued, which could desync the
78
100
  on-device queue index; `wait` now only controls whether `home()` blocks
@@ -105,6 +127,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
105
127
  Motion is reliable once the controller is alarm-free and targets stay within
106
128
  the workspace (a target that drives a joint near its travel limit can fault).
107
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
+
108
149
  ## [0.1.0] - 2026-06-30
109
150
 
110
151
  Initial release of `dobotkit` — a complete, pure-Python control library for the
@@ -164,5 +205,6 @@ Windows, macOS, or Linux.
164
205
  software with timeouts.
165
206
  - **GO closed-loop turn direction (yaw sign) needs on-hardware confirmation.**
166
207
 
167
- [Unreleased]: https://example.com/dobotkit/compare/v0.1.0...HEAD
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
168
210
  [0.1.0]: https://example.com/dobotkit/releases/tag/v0.1.0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dobotkit
3
- Version: 0.1.0
3
+ Version: 0.2.0
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
@@ -83,16 +83,14 @@ with dobotkit.MagicianLite(port="auto") as arm:
83
83
 
84
84
  ## Installation
85
85
 
86
- > **Not yet published to PyPI** — install from a local checkout for now:
87
-
88
86
  ```bash
89
- pip install -e path/to/dobotkit
87
+ pip install dobotkit
90
88
  ```
91
89
 
92
90
  For development (editable install with the test/lint toolchain):
93
91
 
94
92
  ```bash
95
- git clone <repo-url> dobotkit
93
+ git clone https://github.com/mslopgk/dobotkit
96
94
  cd dobotkit
97
95
  pip install -e ".[dev]"
98
96
  ```
@@ -47,16 +47,14 @@ with dobotkit.MagicianLite(port="auto") as arm:
47
47
 
48
48
  ## Installation
49
49
 
50
- > **Not yet published to PyPI** — install from a local checkout for now:
51
-
52
50
  ```bash
53
- pip install -e path/to/dobotkit
51
+ pip install dobotkit
54
52
  ```
55
53
 
56
54
  For development (editable install with the test/lint toolchain):
57
55
 
58
56
  ```bash
59
- git clone <repo-url> dobotkit
57
+ git clone https://github.com/mslopgk/dobotkit
60
58
  cd dobotkit
61
59
  pip install -e ".[dev]"
62
60
  ```
@@ -38,7 +38,6 @@
38
38
  |---|---|---|
39
39
  | `get_alarm_info()` | `GetAlarmInfo` | `{"warning": [...]}` |
40
40
  | `clean_alarm_info()` | `CleanAlarmInfo` | (알람 해제) |
41
- | `running_state()` | `GetRunningState` | `{"runningState": int}` |
42
41
  | `stall_protection()` | `GetStallProtection` | `{"isHappened": int}` |
43
42
  | `off_ground()` | `GetOffGround` | `{"isHappened": int}` |
44
43
 
@@ -230,7 +230,6 @@ bat = go.battery() # 링크 검증
230
230
  |---|---|---|
231
231
  | `get_alarm_info()` | `GetAlarmInfo` | 활성 알람/경고 목록. 예상 형태 `{"warning": [...]}` — 방어적으로 읽으세요 |
232
232
  | `clean_alarm_info()` | `CleanAlarmInfo` | 활성 알람 소거 |
233
- | `running_state()` | `GetRunningState` | `{"runningState": int}` — 방어적으로 읽으세요 |
234
233
  | `stall_protection()` | `GetStallProtection` | `{"isHappened": int}` — 모터 스톨 발생 여부 |
235
234
  | `off_ground()` | `GetOffGround` | `{"isHappened": int}` — 바퀴 들림 감지 |
236
235
  | `magic_box_mode()` | `GetMagicBoxMode` | `{"mode": int}`. ⚠️ 이름과 달리 **`MagicianGO.*` 네임스페이스**(MagicBox 자체 RPC 아님) |
@@ -51,8 +51,7 @@ with MagicianGO.open(port_name="COM5") as go: # DobotLink 연결+링크검증,
51
51
  ## MagicianGO — 진단/알람/MagicBox 상태
52
52
 
53
53
  `get_alarm_info()` → `{warning:[...]}` · `clean_alarm_info()` ·
54
- `running_state()` → `{runningState:int}` · `stall_protection()` → `{isHappened:int}` ·
55
- `off_ground()` → `{isHappened:int}` ·
54
+ `stall_protection()` → `{isHappened:int}` · `off_ground()` → `{isHappened:int}` ·
56
55
  `magic_box_mode()` / `magic_box_num()` — ⚠️ 이름과 달리 `MagicianGO.*` 네임스페이스(MagicBox 자체 RPC 아님).
57
56
 
58
57
  ## MagicBox 주변장치 — `go.sensors` / `go.io` (🆕 신규, 하드웨어 검증 2026-07-16)
@@ -7,10 +7,8 @@
7
7
 
8
8
  ## 설치
9
9
 
10
- 아직 PyPI에 게시되지 않았습니다. 로컬 체크아웃에서 설치하세요:
11
-
12
10
  ```bash
13
- pip install -e path/to/dobotkit # 예: pip install -e C:/Users/user/dobot-main/dobotkit
11
+ pip install dobotkit
14
12
  ```
15
13
 
16
14
  ## 연결 3단계
@@ -0,0 +1 @@
1
+ __version__ = "0.2.0"
@@ -19,8 +19,12 @@ class EffectorIoMixin(_Base):
19
19
  Returns:
20
20
  Queued command index.
21
21
  """
22
+ # DobotLink's param for pump power is `enable` (bool), NOT the SDK's `enableCtrl`.
23
+ # Sending `enableCtrl` is silently ignored (RPC returns True, pump never powers → the
24
+ # cup never actuates). Verified live on COM8 via GetEndEffectorSuctionCup readback:
25
+ # enable=True,on=True -> {isEnabled:True,isOn:True}; enableCtrl was a no-op. `on` is correct.
22
26
  return self._queued_index(self._call(
23
- "SetEndEffectorSuctionCup", enableCtrl=bool(enable_ctrl), on=bool(on), isQueued=queued))
27
+ "SetEndEffectorSuctionCup", enable=bool(enable_ctrl), on=bool(on), isQueued=queued))
24
28
 
25
29
  def set_gripper(self, enable_ctrl: bool, on: bool, queued: bool = True) -> int:
26
30
  """Set gripper state.
@@ -33,8 +37,10 @@ class EffectorIoMixin(_Base):
33
37
  Returns:
34
38
  Queued command index.
35
39
  """
40
+ # DobotLink's param for pump power is `enable` (bool), NOT the SDK's `enableCtrl` — see
41
+ # set_suction_cup. Verified live: enable=True,on=True -> {isEnabled:True,isOn:True} (close).
36
42
  return self._queued_index(self._call(
37
- "SetEndEffectorGripper", enableCtrl=bool(enable_ctrl), on=bool(on), isQueued=queued))
43
+ "SetEndEffectorGripper", enable=bool(enable_ctrl), on=bool(on), isQueued=queued))
38
44
 
39
45
  def set_servo_angle(self, index: int, angle: float, queued: bool = True) -> int:
40
46
  """Set servo angle.
@@ -76,6 +76,22 @@ class EffectorGroup(_Group):
76
76
  """Set the angle of servo ``index`` on the end effector."""
77
77
  return self.cmds.set_servo_angle(index, angle, queued=queued)
78
78
 
79
+ def pump_off(self, *, queued: bool = True) -> None:
80
+ """Cut power to the air pump so it stops running (and goes quiet).
81
+
82
+ ``suck(False)`` / ``grip(False)`` only flip the valve to *release* — the
83
+ pump keeps running (``enable`` stays on) so a re-grab is instant. This
84
+ turns the pump itself OFF (``enable=False``). The arm has a single pump
85
+ shared by the suction cup and the gripper, so both are powered down
86
+ regardless of which effector is attached. Called automatically on
87
+ :meth:`~dobotkit.arm.magicianlite.MagicianLite.disconnect`.
88
+
89
+ Pass ``queued=False`` to stop the pump immediately (bypassing the motion
90
+ queue) — used by teardown, where the queue is already being stopped.
91
+ """
92
+ self.cmds.set_suction_cup(False, False, queued=queued)
93
+ self.cmds.set_gripper(False, False, queued=queued)
94
+
79
95
 
80
96
  class SensorGroup(_Group):
81
97
  """Ergonomic accessors for the arm's sensors.
@@ -95,7 +95,16 @@ class MagicianLite:
95
95
  self.cmds.queue_start()
96
96
 
97
97
  def disconnect(self) -> None:
98
- """Disconnect the arm and, if this instance owns it, close the client."""
98
+ """Turn the pump off, disconnect the arm, and (if owned) close the client.
99
+
100
+ The pump is stopped immediately (``queued=False``) so it never keeps
101
+ running after the arm is released -- ``suck(False)``/``grip(False)`` only
102
+ open the valve, they do not power the pump down.
103
+ """
104
+ try:
105
+ self.effector.pump_off(queued=False)
106
+ except Exception: # pragma: no cover - teardown must not mask the disconnect
107
+ pass
99
108
  try:
100
109
  self.cmds.disconnect()
101
110
  finally:
@@ -172,6 +181,16 @@ class MagicianLite:
172
181
  """Close the gripper (``on=True``) or open it."""
173
182
  return self.effector.grip(bool(on))
174
183
 
184
+ def pump_off(self) -> None:
185
+ """Stop the air pump so it goes quiet (see :meth:`EffectorGroup.pump_off`).
186
+
187
+ ``suck(False)``/``grip(False)`` release the object but leave the pump
188
+ running; call this to power the pump down. Runs on the motion queue so
189
+ it sequences after any pending ``suck``/``grip``. (Disconnecting stops
190
+ the pump automatically.)
191
+ """
192
+ self.effector.pump_off()
193
+
175
194
  # -- pick and place --------------------------------------------------------
176
195
 
177
196
  def pick_and_place(
@@ -484,10 +484,6 @@ class MagicianGO:
484
484
  """Clear the active alarms (``CleanAlarmInfo``)."""
485
485
  return self._call("CleanAlarmInfo")
486
486
 
487
- def running_state(self) -> Any:
488
- """Read the running state (``GetRunningState``); shape ``{"runningState": int}`` — read defensively."""
489
- return self._call("GetRunningState")
490
-
491
487
  def stall_protection(self) -> Any:
492
488
  """Read the stall-protection flag (``GetStallProtection``); ``{"isHappened": int}``."""
493
489
  return self._call("GetStallProtection")
@@ -21,14 +21,37 @@ def test_suck_delegates():
21
21
  c = FakeClient(results={"Magician.SetEndEffectorSuctionCup": {"queuedCmdIndex": 1}})
22
22
  EffectorGroup(ArmCommands(c, "COM8")).suck(True)
23
23
  _, p = c.find_call("Magician.SetEndEffectorSuctionCup")
24
- assert p == {"portName": "COM8", "enableCtrl": True, "on": True, "isQueued": True}
24
+ # `enable` is the hardware-verified DobotLink pump-power key (not the SDK's `enableCtrl`).
25
+ assert p == {"portName": "COM8", "enable": True, "on": True, "isQueued": True}
25
26
 
26
27
 
27
28
  def test_grip_delegates():
28
29
  c = FakeClient(results={"Magician.SetEndEffectorGripper": {"queuedCmdIndex": 2}})
29
30
  EffectorGroup(ArmCommands(c, "COM8")).grip(False, enable=False, queued=False)
30
31
  _, p = c.find_call("Magician.SetEndEffectorGripper")
31
- assert p == {"portName": "COM8", "enableCtrl": False, "on": False, "isQueued": False}
32
+ assert p == {"portName": "COM8", "enable": False, "on": False, "isQueued": False}
33
+
34
+
35
+ def test_pump_off_powers_down_both_effectors():
36
+ """pump_off() cuts pump power (enable=False) on BOTH suction cup and gripper
37
+ -- the arm shares one pump, so this stops it regardless of the attached tool."""
38
+ c = FakeClient()
39
+ EffectorGroup(ArmCommands(c, "COM8")).pump_off()
40
+ _, sc = c.find_call("Magician.SetEndEffectorSuctionCup")
41
+ _, gr = c.find_call("Magician.SetEndEffectorGripper")
42
+ assert sc == {"portName": "COM8", "enable": False, "on": False, "isQueued": True}
43
+ assert gr == {"portName": "COM8", "enable": False, "on": False, "isQueued": True}
44
+
45
+
46
+ def test_pump_off_immediate_bypasses_queue():
47
+ """pump_off(queued=False) sends isQueued=False so the pump stops now
48
+ (used at teardown, where the motion queue is already being stopped)."""
49
+ c = FakeClient()
50
+ EffectorGroup(ArmCommands(c, "COM8")).pump_off(queued=False)
51
+ _, sc = c.find_call("Magician.SetEndEffectorSuctionCup")
52
+ _, gr = c.find_call("Magician.SetEndEffectorGripper")
53
+ assert sc["isQueued"] is False
54
+ assert gr["isQueued"] is False
32
55
 
33
56
 
34
57
  def test_servo_delegates():
@@ -13,7 +13,9 @@ def test_suction_cup_maps():
13
13
  c = FakeClient(results={"Magician.SetEndEffectorSuctionCup": {"queuedCmdIndex": 1}})
14
14
  result = _Cmds(c, "COM8").set_suction_cup(True, True, queued=True)
15
15
  _, p = c.find_call("Magician.SetEndEffectorSuctionCup")
16
- assert p == {"portName": "COM8", "enableCtrl": True, "on": True, "isQueued": True}
16
+ # `enable` is the hardware-verified DobotLink key for pump power (NOT the SDK's `enableCtrl`,
17
+ # which DobotLink silently ignores). Do not "correct" this back — see effector_io.py.
18
+ assert p == {"portName": "COM8", "enable": True, "on": True, "isQueued": True}
17
19
  assert result == 1
18
20
 
19
21
 
@@ -37,7 +39,7 @@ def test_gripper_maps():
37
39
  c = FakeClient(results={"Magician.SetEndEffectorGripper": {"queuedCmdIndex": 2}})
38
40
  result = _Cmds(c, "COM8").set_gripper(False, True, queued=True)
39
41
  _, p = c.find_call("Magician.SetEndEffectorGripper")
40
- assert p == {"portName": "COM8", "enableCtrl": False, "on": True, "isQueued": True}
42
+ assert p == {"portName": "COM8", "enable": False, "on": True, "isQueued": True}
41
43
  assert result == 2
42
44
 
43
45
 
@@ -47,6 +47,35 @@ def test_context_manager_disconnects():
47
47
  assert c.find_call("Magician.DisconnectDobot") is not None
48
48
 
49
49
 
50
+ def test_disconnect_stops_the_pump_immediately():
51
+ """disconnect() must power the pump down (enable=False), immediately
52
+ (isQueued=False), so it never keeps running after the arm is released."""
53
+ c = FakeClient()
54
+ arm = MagicianLite(port="COM8", auto_connect=False, _client=c)
55
+ arm.disconnect()
56
+ _, sc = c.find_call("Magician.SetEndEffectorSuctionCup")
57
+ assert sc["enable"] is False and sc["on"] is False
58
+ assert sc["isQueued"] is False
59
+
60
+
61
+ def test_context_manager_stops_pump_on_exit():
62
+ """Leaving a `with` block stops the pump (via disconnect())."""
63
+ c = FakeClient()
64
+ with MagicianLite(port="COM8", auto_connect=False, _client=c):
65
+ pass
66
+ assert c.find_call("Magician.SetEndEffectorSuctionCup") is not None
67
+
68
+
69
+ def test_high_level_pump_off_sequences_on_queue():
70
+ """In-program arm.pump_off() queues (isQueued=True) so it runs after any
71
+ pending suck/grip, unlike the immediate teardown stop."""
72
+ c = FakeClient()
73
+ arm = MagicianLite(port="COM8", auto_connect=False, _client=c)
74
+ arm.pump_off()
75
+ _, sc = c.find_call("Magician.SetEndEffectorSuctionCup")
76
+ assert sc["isQueued"] is True
77
+
78
+
50
79
  def test_exit_swallows_disconnect_error_without_masking():
51
80
  """__exit__ must not let a disconnect() failure escape and mask teardown."""
52
81
  class Boom(FakeClient):
@@ -37,12 +37,6 @@ def test_clean_alarm_info():
37
37
  assert fc.calls[0] == ("MagicianGO.CleanAlarmInfo", {"portName": "COM5"})
38
38
 
39
39
 
40
- def test_running_state():
41
- go, fc = make_go(results={"MagicianGO.GetRunningState": {"runningState": 1}})
42
- assert go.running_state() == {"runningState": 1}
43
- assert fc.calls[0] == ("MagicianGO.GetRunningState", {"portName": "COM5"})
44
-
45
-
46
40
  def test_stall_protection():
47
41
  go, fc = make_go(results={"MagicianGO.GetStallProtection": {"isHappened": 0}})
48
42
  assert go.stall_protection() == {"isHappened": 0}
@@ -1 +0,0 @@
1
- __version__ = "0.1.0"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes