adjusted walk for carpet to minimize falls
This commit is contained in:
+21
-7
@@ -131,9 +131,21 @@ class NaoTeleop:
|
|||||||
self.motion.wakeUp()
|
self.motion.wakeUp()
|
||||||
self.posture.goToPosture("StandInit", 0.5)
|
self.posture.goToPosture("StandInit", 0.5)
|
||||||
|
|
||||||
# Turn natural arm swinging back on so his walk looks normal!
|
# 1. SETTLE DELAY: Let his internal gyroscopes adapt to the squishy carpet
|
||||||
|
time.sleep(1.0)
|
||||||
|
|
||||||
self.motion.setMoveArmsEnabled(True, True)
|
self.motion.setMoveArmsEnabled(True, True)
|
||||||
|
|
||||||
|
# 2. CARPET GAIT CONFIGURATION
|
||||||
|
# StepHeight: Lifts the foot 2.8cm (higher than default) to clear fibers
|
||||||
|
# MaxStepFrequency: 0.6 slows the step rhythm down for better balance
|
||||||
|
# TorsoWy: 0.05 leans his torso just slightly forward for better momentum
|
||||||
|
carpet_config = [
|
||||||
|
["StepHeight", 0.028],
|
||||||
|
["MaxStepFrequency", 0.6],
|
||||||
|
["TorsoWy", 0.05]
|
||||||
|
]
|
||||||
|
|
||||||
print("🎮 Controls:")
|
print("🎮 Controls:")
|
||||||
print(" WASD / Arrows = Walk")
|
print(" WASD / Arrows = Walk")
|
||||||
print(" I J K L = Head")
|
print(" I J K L = Head")
|
||||||
@@ -141,7 +153,6 @@ class NaoTeleop:
|
|||||||
print(" ESC = Quit")
|
print(" ESC = Quit")
|
||||||
|
|
||||||
while self.running:
|
while self.running:
|
||||||
# Zero-impact battery checker
|
|
||||||
self.check_battery()
|
self.check_battery()
|
||||||
|
|
||||||
for event in pygame.event.get():
|
for event in pygame.event.get():
|
||||||
@@ -156,13 +167,16 @@ class NaoTeleop:
|
|||||||
# Walking
|
# Walking
|
||||||
keys = pygame.key.get_pressed()
|
keys = pygame.key.get_pressed()
|
||||||
x = y = theta = 0.0
|
x = y = theta = 0.0
|
||||||
if keys[pygame.K_w] or keys[pygame.K_UP]: x = 0.9
|
|
||||||
if keys[pygame.K_s] or keys[pygame.K_DOWN]: x = -0.9
|
# 3. SAFER TOP SPEED: Dropped from 0.9 (sprinting) to 0.6 (safe walking)
|
||||||
if keys[pygame.K_a] or keys[pygame.K_LEFT]: theta = 0.7
|
if keys[pygame.K_w] or keys[pygame.K_UP]: x = 0.6
|
||||||
if keys[pygame.K_d] or keys[pygame.K_RIGHT]: theta = -0.7
|
if keys[pygame.K_s] or keys[pygame.K_DOWN]: x = -0.6
|
||||||
|
if keys[pygame.K_a] or keys[pygame.K_LEFT]: theta = 0.5
|
||||||
|
if keys[pygame.K_d] or keys[pygame.K_RIGHT]: theta = -0.5
|
||||||
|
|
||||||
if abs(x) > 0.1 or abs(theta) > 0.1:
|
if abs(x) > 0.1 or abs(theta) > 0.1:
|
||||||
self.motion.moveToward(x, y, theta)
|
# Pass the custom carpet gait to the walk engine
|
||||||
|
self.motion.moveToward(x, y, theta, carpet_config)
|
||||||
else:
|
else:
|
||||||
self.motion.stopMove()
|
self.motion.stopMove()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user