RemiFabre commited on
Commit
607e191
·
1 Parent(s): 744c3d7

Salty commit

Browse files
marionette/assets/click_the_gear.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7c1529545e5cb5105bb520986a5f529103bd8b93c951269bc2b8c594a41f8557
3
+ size 221406
marionette/main.py CHANGED
@@ -27,6 +27,16 @@ from reachy_mini.utils.interpolation import distance_between_poses
27
 
28
  from marionette.motion_models import MotionModelRegistry
29
 
 
 
 
 
 
 
 
 
 
 
30
  try:
31
  import soundfile as sf
32
  except Exception: # pragma: no cover - optional dependency
@@ -537,6 +547,37 @@ class Marionette(ReachyMiniApp):
537
  # Graceful torque off - move to sleep pose first
538
  self._goto_sleep_and_release(reachy_mini)
539
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
540
  while not stop_event.is_set():
541
  job_type: str | None = None
542
  payload: RecordingRequest | str | None = None
 
27
 
28
  from marionette.motion_models import MotionModelRegistry
29
 
30
+ # Semi-awaken pose: identity rotation, same XY as sleep, Z raised 1.5cm
31
+ SEMI_AWAKEN_POSE = np.array(
32
+ [
33
+ [1.0, 0.0, 0.0, -0.021],
34
+ [0.0, 1.0, 0.0, 0.001],
35
+ [0.0, 0.0, 1.0, -0.029],
36
+ [0.0, 0.0, 0.0, 1.0],
37
+ ]
38
+ )
39
+
40
  try:
41
  import soundfile as sf
42
  except Exception: # pragma: no cover - optional dependency
 
547
  # Graceful torque off - move to sleep pose first
548
  self._goto_sleep_and_release(reachy_mini)
549
 
550
+ # "Click the gear" sequence - brief wake-up after sleep
551
+ click_gear_path = Path(__file__).parent / "assets" / "click_the_gear.wav"
552
+ if click_gear_path.exists():
553
+ time.sleep(0.7) # Wait 700ms after torque off
554
+ self._safe_enable_motors(reachy_mini)
555
+
556
+ # Go to semi-awaken pose (identity rotation, Z raised 1.5cm from sleep)
557
+ antenna_angle = np.deg2rad(15)
558
+ reachy_mini.goto_target(
559
+ SEMI_AWAKEN_POSE,
560
+ antennas=[-antenna_angle, antenna_angle],
561
+ duration=0.3,
562
+ )
563
+
564
+ # Play the click_the_gear sound
565
+ click_gear_duration = 0.0
566
+ if sf is not None:
567
+ try:
568
+ info = sf.info(str(click_gear_path))
569
+ click_gear_duration = float(info.duration)
570
+ except Exception:
571
+ click_gear_duration = 2.0 # fallback
572
+ else:
573
+ click_gear_duration = 2.0 # fallback
574
+
575
+ reachy_mini.media.play_sound(str(click_gear_path))
576
+ time.sleep(click_gear_duration)
577
+
578
+ # Disable torque again
579
+ reachy_mini.disable_motors()
580
+
581
  while not stop_event.is_set():
582
  job_type: str | None = None
583
  payload: RecordingRequest | str | None = None