added 6 7 gesture to slot 3
This commit is contained in:
+50
-1
@@ -280,6 +280,53 @@ class NaoTeleop:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Cena gesture error: {e}")
|
print(f"Cena gesture error: {e}")
|
||||||
|
|
||||||
|
def six_seven_gesture(self):
|
||||||
|
if self.typing_mode: return
|
||||||
|
print("🖐️ SIX... SEVEN...")
|
||||||
|
try:
|
||||||
|
self.tts.say("Six, seven")
|
||||||
|
|
||||||
|
self.motion.setStiffnesses(["RArm", "LArm"], 1.0)
|
||||||
|
|
||||||
|
# Lock both arms up in front of the body, hands held out like a scale.
|
||||||
|
# ElbowYaw is rotated ~90° off zero here - that's what points the elbow's
|
||||||
|
# bend axis so flexing tips the forearm forward/down instead of curling
|
||||||
|
# it in across the chest. These joints don't move again until the return.
|
||||||
|
hold_names = [
|
||||||
|
"RShoulderPitch", "RShoulderRoll", "RElbowYaw", "RWristYaw", "RHand",
|
||||||
|
"LShoulderPitch", "LShoulderRoll", "LElbowYaw", "LWristYaw", "LHand"
|
||||||
|
]
|
||||||
|
hold_angles = [
|
||||||
|
0.2, -0.2, 1.4, 1.57, 0.6,
|
||||||
|
0.2, 0.2, -1.4, -1.57, 0.6
|
||||||
|
]
|
||||||
|
self.motion.angleInterpolationWithSpeed(hold_names, hold_angles, 0.25)
|
||||||
|
|
||||||
|
# Only the elbows seesaw now - a small tip back and forth, one arm
|
||||||
|
# rising while the other falls, like weighing something in each hand
|
||||||
|
# ("six... seven..."). Small amplitude so it stays a wobble, not a fold.
|
||||||
|
elbow_names = ["RElbowRoll", "LElbowRoll"]
|
||||||
|
r_low, r_high = 0.6, 1.0
|
||||||
|
l_low, l_high = -0.6, -1.0
|
||||||
|
|
||||||
|
elbow_angles = [
|
||||||
|
[r_low, r_high, r_low, r_high, r_low, r_high],
|
||||||
|
[l_high, l_low, l_high, l_low, l_high, l_low],
|
||||||
|
]
|
||||||
|
times = [[0.35, 0.7, 1.05, 1.4, 1.75, 2.1]] * 2
|
||||||
|
self.motion.angleInterpolation(elbow_names, elbow_angles, times, True)
|
||||||
|
|
||||||
|
# Return everything to neutral
|
||||||
|
neutral_names = hold_names + elbow_names
|
||||||
|
neutral = [1.5, -0.15, 1.2, 0.0, 0.0,
|
||||||
|
1.5, 0.15, -1.2, 0.0, 0.0,
|
||||||
|
0.5, -0.5]
|
||||||
|
self.motion.angleInterpolationWithSpeed(neutral_names, neutral, 0.3)
|
||||||
|
# Relaxed stiffness after completion
|
||||||
|
self.motion.setStiffnesses(["RArm", "LArm"], 0.3)
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Six seven gesture error: {e}")
|
||||||
|
|
||||||
def handle_head_movement(self):
|
def handle_head_movement(self):
|
||||||
if self.typing_mode or self.music_search_mode: return
|
if self.typing_mode or self.music_search_mode: return
|
||||||
keys = pygame.key.get_pressed()
|
keys = pygame.key.get_pressed()
|
||||||
@@ -340,7 +387,7 @@ class NaoTeleop:
|
|||||||
self._safe("moveInit", self.motion.moveInit)
|
self._safe("moveInit", self.motion.moveInit)
|
||||||
print("🦶 Walk engine ready")
|
print("🦶 Walk engine ready")
|
||||||
|
|
||||||
print("\n🎮 Controls: WASD/Arrows=Walk | [/]=Speed | IJKL=Head | SPACE=Reset head | 1=Wave | 2=Cena | M=Music search | X=Stop | -/==Volume | T=TTS | ESC=Quit")
|
print("\n🎮 Controls: WASD/Arrows=Walk | [/]=Speed | IJKL=Head | SPACE=Reset head | 1=Wave | 2=Cena | 3=6-7 | M=Music search | X=Stop | -/==Volume | T=TTS | ESC=Quit")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
while self.running:
|
while self.running:
|
||||||
@@ -420,6 +467,8 @@ class NaoTeleop:
|
|||||||
self.wave_gesture()
|
self.wave_gesture()
|
||||||
elif event.key == pygame.K_2:
|
elif event.key == pygame.K_2:
|
||||||
self.cena_gesture()
|
self.cena_gesture()
|
||||||
|
elif event.key == pygame.K_3:
|
||||||
|
self.six_seven_gesture()
|
||||||
elif event.key == pygame.K_SPACE:
|
elif event.key == pygame.K_SPACE:
|
||||||
self.reset_head()
|
self.reset_head()
|
||||||
elif event.key == pygame.K_m:
|
elif event.key == pygame.K_m:
|
||||||
|
|||||||
Reference in New Issue
Block a user