Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions examples/2_collect_teleop_data_with_neuracore.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ def log_to_neuracore_on_change_callback(
else:
print(f"\n⚠️ Unknown logging function: {name}")
except Exception as e:
print(f"\n⚠️ Failed to call {name} to Neuracore: {e}")
print(f"\n⚠️ Failed to call {name} to Neuracore. Exception: {e}")
print("Traceback:")
traceback.print_exc()


def on_button_a_pressed() -> None:
Expand Down Expand Up @@ -132,14 +134,18 @@ def on_button_rj_pressed() -> None:
nc.start_recording()
print("✓ 🔴 Recording started (Button RJ)")
except Exception as e:
print(f"✗ Failed to start recording: {e}")
print(f"✗ Failed to start recording. Exception: {e}")
print("Traceback:")
traceback.print_exc()
else:
# Stop recording
try:
nc.stop_recording()
print("✓ ⏹️ Recording stopped (Button RJ)")
except Exception as e:
print(f"✗ Failed to stop recording: {e}")
print(f"✗ Failed to stop recording. Exception: {e}")
print("Traceback:")
traceback.print_exc()


if __name__ == "__main__":
Expand Down Expand Up @@ -298,11 +304,9 @@ def on_button_rj_pressed() -> None:
except KeyboardInterrupt:
print("\n👋 Interrupt received - shutting down gracefully...")
except Exception as e:
print(f"\n❌ Demo error: {e}")
import traceback

print(f"\n❌ Demo error. Exception: {e}")
print("Traceback:")
traceback.print_exc()

# Cleanup
print("\n🧹 Cleaning up...")

Expand All @@ -313,7 +317,9 @@ def on_button_rj_pressed() -> None:
nc.cancel_recording()
print("✓ Recording cancelled")
except Exception as e:
print(f"⚠️ Error cancelling recording: {e}")
print(f"⚠️ Error cancelling recording. Exception: {e}")
print("Traceback:")
traceback.print_exc()

# shutdown threads
nc.logout()
Expand Down
3 changes: 2 additions & 1 deletion piper_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ def cleanup(self) -> None:
and self.piper is not None
and self.piper.get_connect_status()
):
self.graceful_stop() # this will disable the robot as well
if self.is_robot_enabled():
self.graceful_stop() # this will disable the robot as well
self.piper.DisconnectPort()
print("✓ Robot disconnected")

Expand Down