dobotkit 0.1.1__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.1 → dobotkit-0.2.0}/CHANGELOG.md +35 -12
  2. {dobotkit-0.1.1 → dobotkit-0.2.0}/PKG-INFO +1 -1
  3. dobotkit-0.2.0/src/dobotkit/_version.py +1 -0
  4. {dobotkit-0.1.1 → dobotkit-0.2.0}/src/dobotkit/arm/commands/effector_io.py +8 -2
  5. {dobotkit-0.1.1 → dobotkit-0.2.0}/src/dobotkit/arm/groups.py +16 -0
  6. {dobotkit-0.1.1 → dobotkit-0.2.0}/src/dobotkit/arm/magicianlite.py +20 -1
  7. {dobotkit-0.1.1 → dobotkit-0.2.0}/tests/arm/test_arm_groups.py +25 -2
  8. {dobotkit-0.1.1 → dobotkit-0.2.0}/tests/arm/test_commands_effector_io.py +4 -2
  9. {dobotkit-0.1.1 → dobotkit-0.2.0}/tests/arm/test_magicianlite.py +29 -0
  10. dobotkit-0.1.1/src/dobotkit/_version.py +0 -1
  11. {dobotkit-0.1.1 → dobotkit-0.2.0}/.gitignore +0 -0
  12. {dobotkit-0.1.1 → dobotkit-0.2.0}/.superpowers/sdd/.gitignore +0 -0
  13. {dobotkit-0.1.1 → dobotkit-0.2.0}/.superpowers/sdd/motion-wait-fix-report.md +0 -0
  14. {dobotkit-0.1.1 → dobotkit-0.2.0}/.superpowers/sdd/progress.md +0 -0
  15. {dobotkit-0.1.1 → dobotkit-0.2.0}/.superpowers/sdd/review-c203329..376ec44.diff +0 -0
  16. {dobotkit-0.1.1 → dobotkit-0.2.0}/.superpowers/sdd/review-c203329..674ed9a.diff +0 -0
  17. {dobotkit-0.1.1 → dobotkit-0.2.0}/.superpowers/sdd/review-fixes-report.md +0 -0
  18. {dobotkit-0.1.1 → dobotkit-0.2.0}/.superpowers/sdd/task-1-brief.md +0 -0
  19. {dobotkit-0.1.1 → dobotkit-0.2.0}/.superpowers/sdd/task-1-report.md +0 -0
  20. {dobotkit-0.1.1 → dobotkit-0.2.0}/.superpowers/sdd/task-2-brief.md +0 -0
  21. {dobotkit-0.1.1 → dobotkit-0.2.0}/.superpowers/sdd/task-2-report.md +0 -0
  22. {dobotkit-0.1.1 → dobotkit-0.2.0}/.superpowers/sdd/task-3-brief.md +0 -0
  23. {dobotkit-0.1.1 → dobotkit-0.2.0}/.superpowers/sdd/task-4-brief.md +0 -0
  24. {dobotkit-0.1.1 → dobotkit-0.2.0}/.superpowers/sdd/task-5-brief.md +0 -0
  25. {dobotkit-0.1.1 → dobotkit-0.2.0}/.superpowers/sdd/task-6-brief.md +0 -0
  26. {dobotkit-0.1.1 → dobotkit-0.2.0}/.superpowers/sdd/task-7-brief.md +0 -0
  27. {dobotkit-0.1.1 → dobotkit-0.2.0}/.superpowers/sdd/task-8-brief.md +0 -0
  28. {dobotkit-0.1.1 → dobotkit-0.2.0}/CONTEXT.md +0 -0
  29. {dobotkit-0.1.1 → dobotkit-0.2.0}/LICENSE +0 -0
  30. {dobotkit-0.1.1 → dobotkit-0.2.0}/README.md +0 -0
  31. {dobotkit-0.1.1 → 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
  32. {dobotkit-0.1.1 → 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
  33. {dobotkit-0.1.1 → dobotkit-0.2.0}/docs/VERIFICATION_NEEDED_ko.md +0 -0
  34. {dobotkit-0.1.1 → dobotkit-0.2.0}/docs/api/arm.md +0 -0
  35. {dobotkit-0.1.1 → dobotkit-0.2.0}/docs/api/go.md +0 -0
  36. {dobotkit-0.1.1 → dobotkit-0.2.0}/docs/cheatsheet_go.md +0 -0
  37. {dobotkit-0.1.1 → dobotkit-0.2.0}/docs/quickstart-ko.md +0 -0
  38. {dobotkit-0.1.1 → dobotkit-0.2.0}/docs/superpowers/plans/2026-06-30-dobotkit-implementation.md +0 -0
  39. {dobotkit-0.1.1 → dobotkit-0.2.0}/docs/superpowers/plans/2026-07-16-magicianlite-dobotlink-rewrite.md +0 -0
  40. {dobotkit-0.1.1 → dobotkit-0.2.0}/docs/superpowers/specs/2026-06-30-dobotkit-design.md +0 -0
  41. {dobotkit-0.1.1 → dobotkit-0.2.0}/docs/superpowers/specs/2026-07-16-magicbox-absent-graceful-handling-design.md +0 -0
  42. {dobotkit-0.1.1 → dobotkit-0.2.0}/docs/superpowers/specs/2026-07-16-magicianlite-dobotlink-rewrite-design.md +0 -0
  43. {dobotkit-0.1.1 → dobotkit-0.2.0}/examples/arm_magicianlite.py +0 -0
  44. {dobotkit-0.1.1 → dobotkit-0.2.0}/examples/go_discover.py +0 -0
  45. {dobotkit-0.1.1 → dobotkit-0.2.0}/examples/go_magicbox_sensor.py +0 -0
  46. {dobotkit-0.1.1 → dobotkit-0.2.0}/examples/go_teleop.py +0 -0
  47. {dobotkit-0.1.1 → dobotkit-0.2.0}/pyproject.toml +0 -0
  48. {dobotkit-0.1.1 → dobotkit-0.2.0}/src/dobotkit/__init__.py +0 -0
  49. {dobotkit-0.1.1 → dobotkit-0.2.0}/src/dobotkit/arm/__init__.py +0 -0
  50. {dobotkit-0.1.1 → dobotkit-0.2.0}/src/dobotkit/arm/commands/__init__.py +0 -0
  51. {dobotkit-0.1.1 → dobotkit-0.2.0}/src/dobotkit/arm/commands/_base.py +0 -0
  52. {dobotkit-0.1.1 → dobotkit-0.2.0}/src/dobotkit/arm/commands/connection.py +0 -0
  53. {dobotkit-0.1.1 → dobotkit-0.2.0}/src/dobotkit/arm/commands/motion.py +0 -0
  54. {dobotkit-0.1.1 → dobotkit-0.2.0}/src/dobotkit/arm/commands/sensors.py +0 -0
  55. {dobotkit-0.1.1 → dobotkit-0.2.0}/src/dobotkit/enums.py +0 -0
  56. {dobotkit-0.1.1 → dobotkit-0.2.0}/src/dobotkit/exceptions.py +0 -0
  57. {dobotkit-0.1.1 → dobotkit-0.2.0}/src/dobotkit/go/__init__.py +0 -0
  58. {dobotkit-0.1.1 → dobotkit-0.2.0}/src/dobotkit/go/geometry.py +0 -0
  59. {dobotkit-0.1.1 → dobotkit-0.2.0}/src/dobotkit/go/groups.py +0 -0
  60. {dobotkit-0.1.1 → dobotkit-0.2.0}/src/dobotkit/go/magiciango.py +0 -0
  61. {dobotkit-0.1.1 → dobotkit-0.2.0}/src/dobotkit/go/navigation.py +0 -0
  62. {dobotkit-0.1.1 → dobotkit-0.2.0}/src/dobotkit/link.py +0 -0
  63. {dobotkit-0.1.1 → dobotkit-0.2.0}/src/dobotkit/py.typed +0 -0
  64. {dobotkit-0.1.1 → dobotkit-0.2.0}/tests/__init__.py +0 -0
  65. {dobotkit-0.1.1 → dobotkit-0.2.0}/tests/arm/__init__.py +0 -0
  66. {dobotkit-0.1.1 → dobotkit-0.2.0}/tests/arm/test_commands_connection.py +0 -0
  67. {dobotkit-0.1.1 → dobotkit-0.2.0}/tests/arm/test_commands_motion.py +0 -0
  68. {dobotkit-0.1.1 → dobotkit-0.2.0}/tests/arm/test_commands_sensors.py +0 -0
  69. {dobotkit-0.1.1 → dobotkit-0.2.0}/tests/conftest.py +0 -0
  70. {dobotkit-0.1.1 → dobotkit-0.2.0}/tests/go/__init__.py +0 -0
  71. {dobotkit-0.1.1 → dobotkit-0.2.0}/tests/go/conftest.py +0 -0
  72. {dobotkit-0.1.1 → dobotkit-0.2.0}/tests/go/test_client.py +0 -0
  73. {dobotkit-0.1.1 → dobotkit-0.2.0}/tests/go/test_geometry.py +0 -0
  74. {dobotkit-0.1.1 → dobotkit-0.2.0}/tests/go/test_groups.py +0 -0
  75. {dobotkit-0.1.1 → dobotkit-0.2.0}/tests/go/test_magiciango.py +0 -0
  76. {dobotkit-0.1.1 → dobotkit-0.2.0}/tests/go/test_magiciango_extended.py +0 -0
  77. {dobotkit-0.1.1 → dobotkit-0.2.0}/tests/go/test_navigation.py +0 -0
  78. {dobotkit-0.1.1 → dobotkit-0.2.0}/tests/test_enums.py +0 -0
  79. {dobotkit-0.1.1 → dobotkit-0.2.0}/tests/test_exceptions.py +0 -0
  80. {dobotkit-0.1.1 → dobotkit-0.2.0}/tests/test_integration.py +0 -0
  81. {dobotkit-0.1.1 → dobotkit-0.2.0}/tests/test_smoke.py +0 -0
  82. {dobotkit-0.1.1 → dobotkit-0.2.0}/tests/test_subpackage_api.py +0 -0
@@ -5,19 +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
- ## [0.1.1] - 2026-07-19
9
-
10
- ### Removed
8
+ ## [0.2.0] - 2026-07-24
11
9
 
12
- - **`MagicianGO.running_state()` (`GetRunningState`).** The GO firmware never
13
- answers this call — a reproducible ~10 s `DobotTimeoutError` on the test unit
14
- — while every neighbouring read (`battery`, `ultrasonic`, `imu_angle`,
15
- `odometer`, `off_ground`, `stall_protection`, `magic_box_mode`/`num`,
16
- `get_alarm_info`) works. A method that only ever hangs has no place in the
17
- clean core, so it was dropped (hardware-verified 2026-07-19). Use
18
- `get_alarm_info()` / `stall_protection()` / `off_ground()` for GO status.
10
+ ### Added
19
11
 
20
- ## [Unreleased]
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
21
 
22
22
  ### Changed (BREAKING)
23
23
 
@@ -85,6 +85,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
85
85
 
86
86
  ### Fixed
87
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.
88
98
  - **`home()` always queues `SetHOMEParams`/`SetHOMECmd`.** Previously
89
99
  `queued=wait` meant `wait=False` sent them unqueued, which could desync the
90
100
  on-device queue index; `wait` now only controls whether `home()` blocks
@@ -124,6 +134,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
124
134
  battery read-back surfaces this immediately. **Power-cycle the car to
125
135
  recover.**
126
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
+
127
149
  ## [0.1.0] - 2026-06-30
128
150
 
129
151
  Initial release of `dobotkit` — a complete, pure-Python control library for the
@@ -183,5 +205,6 @@ Windows, macOS, or Linux.
183
205
  software with timeouts.
184
206
  - **GO closed-loop turn direction (yaw sign) needs on-hardware confirmation.**
185
207
 
186
- [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
187
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.1
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
@@ -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(
@@ -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):
@@ -1 +0,0 @@
1
- __version__ = "0.1.1"
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
File without changes
File without changes
File without changes
File without changes