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
|
return None
|
||||||
|
|
||||||
def wave_gesture(self):
|
def wave_gesture(self):
|
||||||
print("🤚 Waving...")
|
print("🤚 Waving hello...")
|
||||||
try:
|
try:
|
||||||
# Simple friendly wave with right arm
|
|
||||||
self.motion.setStiffnesses("RArm", 1.0)
|
self.motion.setStiffnesses("RArm", 1.0)
|
||||||
|
|
||||||
# Wave motion
|
# Friendly high wave
|
||||||
names = ["RShoulderPitch", "RShoulderRoll", "RElbowYaw", "RElbowRoll", "RWristYaw"]
|
names = ["RShoulderPitch", "RShoulderRoll", "RElbowYaw", "RElbowRoll", "RWristYaw"]
|
||||||
|
|
||||||
|
# Better motion: arm raised higher + side-to-side wave
|
||||||
angles = [
|
angles = [
|
||||||
[-0.3, -0.3, -0.3], # ShoulderPitch
|
[-1.0, -0.8, -1.0, -0.8, -1.0], # RShoulderPitch (raise arm high)
|
||||||
[0.0, 0.3, 0.0], # ShoulderRoll
|
[ 0.2, -0.5, 0.2, -0.5, 0.2], # RShoulderRoll
|
||||||
[0.0, 1.0, 0.0], # ElbowYaw
|
[ 0.8, 1.2, 0.8, 1.2, 0.8], # RElbowYaw
|
||||||
[0.0, -1.0, 0.0], # ElbowRoll
|
[-1.0, -0.3, -1.0, -0.3, -1.0], # RElbowRoll
|
||||||
[0.0, 1.5, 0.0] # WristYaw
|
[ 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)
|
self.motion.angleInterpolation(names, angles, times, True)
|
||||||
|
|
||||||
# Return to neutral
|
# Strong return to neutral position
|
||||||
self.motion.setAngles("RArm", [0.0]*5, 0.4)
|
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:
|
except Exception as e:
|
||||||
print(f"Wave error: {e}")
|
print(f"Wave error: {e}")
|
||||||
|
|
||||||
def handle_head_movement(self):
|
def handle_head_movement(self):
|
||||||
keys = pygame.key.get_pressed()
|
keys = pygame.key.get_pressed()
|
||||||
speed = 0.3
|
speed = 0.3
|
||||||
|
|
||||||
changed = False
|
changed = False
|
||||||
|
|
||||||
if keys[pygame.K_i]:
|
if keys[pygame.K_i]:
|
||||||
self.head_pitch = max(self.head_pitch - speed, -0.5); changed = True
|
self.head_pitch = max(self.head_pitch - speed, -0.5); changed = True
|
||||||
if keys[pygame.K_k]:
|
if keys[pygame.K_k]:
|
||||||
@@ -97,8 +103,8 @@ class NaoTeleop:
|
|||||||
|
|
||||||
print("🎮 Controls:")
|
print("🎮 Controls:")
|
||||||
print(" WASD / Arrows = Walk")
|
print(" WASD / Arrows = Walk")
|
||||||
print(" I J K L = Head movement")
|
print(" I J K L = Head")
|
||||||
print(" 1 = Wave gesture")
|
print(" 1 = Wave")
|
||||||
print(" ESC = Quit")
|
print(" ESC = Quit")
|
||||||
|
|
||||||
while self.running:
|
while self.running:
|
||||||
@@ -108,7 +114,7 @@ class NaoTeleop:
|
|||||||
elif event.type == pygame.KEYDOWN:
|
elif event.type == pygame.KEYDOWN:
|
||||||
if event.key == pygame.K_ESCAPE:
|
if event.key == pygame.K_ESCAPE:
|
||||||
self.running = False
|
self.running = False
|
||||||
elif event.key == pygame.K_1: # Number key 1
|
elif event.key == pygame.K_1:
|
||||||
self.wave_gesture()
|
self.wave_gesture()
|
||||||
|
|
||||||
# Walking
|
# Walking
|
||||||
|
|||||||
Reference in New Issue
Block a user