added chat history exports
This commit is contained in:
+1973
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
import qi
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="Get or set a NAO robot's volume.")
|
||||
parser.add_argument("--ip", required=True, help="NAO IP address")
|
||||
parser.add_argument("--port", type=int, default=9559, help="NAOqi port (default: 9559)")
|
||||
parser.add_argument(
|
||||
"--set",
|
||||
type=int,
|
||||
metavar="VOLUME",
|
||||
help="Set volume (0-100)"
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
try:
|
||||
session = qi.Session()
|
||||
session.connect(f"tcp://{args.ip}:{args.port}")
|
||||
except RuntimeError as e:
|
||||
print(f"Failed to connect: {e}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
audio = session.service("ALAudioDevice")
|
||||
|
||||
if args.set is not None:
|
||||
volume = max(0, min(100, args.set))
|
||||
audio.setOutputVolume(volume)
|
||||
print(f"Volume set to {volume}%")
|
||||
|
||||
print(f"Current volume: {audio.getOutputVolume()}%")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
+21
-15
@@ -51,34 +51,40 @@ class NaoTeleop:
|
||||
return None
|
||||
|
||||
def wave_gesture(self):
|
||||
print("🤚 Waving...")
|
||||
print("🤚 Waving hello...")
|
||||
try:
|
||||
# Simple friendly wave with right arm
|
||||
self.motion.setStiffnesses("RArm", 1.0)
|
||||
|
||||
# Wave motion
|
||||
# Friendly high wave
|
||||
names = ["RShoulderPitch", "RShoulderRoll", "RElbowYaw", "RElbowRoll", "RWristYaw"]
|
||||
|
||||
# Better motion: arm raised higher + side-to-side wave
|
||||
angles = [
|
||||
[-0.3, -0.3, -0.3], # ShoulderPitch
|
||||
[0.0, 0.3, 0.0], # ShoulderRoll
|
||||
[0.0, 1.0, 0.0], # ElbowYaw
|
||||
[0.0, -1.0, 0.0], # ElbowRoll
|
||||
[0.0, 1.5, 0.0] # WristYaw
|
||||
[-1.0, -0.8, -1.0, -0.8, -1.0], # RShoulderPitch (raise arm high)
|
||||
[ 0.2, -0.5, 0.2, -0.5, 0.2], # RShoulderRoll
|
||||
[ 0.8, 1.2, 0.8, 1.2, 0.8], # RElbowYaw
|
||||
[-1.0, -0.3, -1.0, -0.3, -1.0], # RElbowRoll
|
||||
[ 0.0, 1.5, 0.0, -1.5, 0.0] # RWristYaw (hand wave)
|
||||
]
|
||||
times = [[1.0, 1.8, 2.6], [1.0, 1.8, 2.6], [1.0, 1.8, 2.6], [1.0, 1.8, 2.6], [1.0, 1.8, 2.6]]
|
||||
|
||||
times = [[0.5, 1.0, 1.5, 2.0, 2.5]] * 5
|
||||
|
||||
self.motion.angleInterpolation(names, angles, times, True)
|
||||
|
||||
# Return to neutral
|
||||
self.motion.setAngles("RArm", [0.0]*5, 0.4)
|
||||
# Strong return to neutral position
|
||||
self.motion.setAngles("RArm", [0.0] * 5, 0.6)
|
||||
time.sleep(0.8) # Give time to settle
|
||||
|
||||
print("✅ Better wave completed")
|
||||
|
||||
except Exception as e:
|
||||
print(f"Wave error: {e}")
|
||||
|
||||
def handle_head_movement(self):
|
||||
keys = pygame.key.get_pressed()
|
||||
speed = 0.3
|
||||
|
||||
changed = False
|
||||
|
||||
if keys[pygame.K_i]:
|
||||
self.head_pitch = max(self.head_pitch - speed, -0.5); changed = True
|
||||
if keys[pygame.K_k]:
|
||||
@@ -97,8 +103,8 @@ class NaoTeleop:
|
||||
|
||||
print("🎮 Controls:")
|
||||
print(" WASD / Arrows = Walk")
|
||||
print(" I J K L = Head movement")
|
||||
print(" 1 = Wave gesture")
|
||||
print(" I J K L = Head")
|
||||
print(" 1 = Wave")
|
||||
print(" ESC = Quit")
|
||||
|
||||
while self.running:
|
||||
@@ -108,7 +114,7 @@ class NaoTeleop:
|
||||
elif event.type == pygame.KEYDOWN:
|
||||
if event.key == pygame.K_ESCAPE:
|
||||
self.running = False
|
||||
elif event.key == pygame.K_1: # Number key 1
|
||||
elif event.key == pygame.K_1:
|
||||
self.wave_gesture()
|
||||
|
||||
# Walking
|
||||
|
||||
Reference in New Issue
Block a user