MCPcopy Create free account
hub / github.com/NeuracoreAI/example_agilex / cleanup

Method cleanup

piper_controller.py:130–145  ·  view source on GitHub ↗

Cleanup resources and disconnect from robot.

(self)

Source from the content-addressed store, hash-verified

128 self.cleanup()
129
130 def cleanup(self) -> None:
131 """Cleanup resources and disconnect from robot."""
132 print("🧹 Cleaning up robot controller...")
133 self.stop_control_loop()
134
135 if (
136 hasattr(self, "piper")
137 and self.piper is not None
138 and self.piper.get_connect_status()
139 ):
140 if self.is_robot_enabled():
141 self.graceful_stop() # this will disable the robot as well
142 self.piper.DisconnectPort()
143 print("✓ Robot disconnected")
144
145 print("✓ Robot controller cleanup completed")
146
147 def is_robot_enabled(self) -> bool:
148 """Check if robot is enabled and ready to accept commands.

Calls 3

stop_control_loopMethod · 0.95
is_robot_enabledMethod · 0.95
graceful_stopMethod · 0.95

Tested by

no test coverage detected