Exemplo n.º 1
0
'''
A program to play a sound on Marty
'''

# See README.md for instructions on how to run this

# Import Marty from the martypy library
from martypy import Marty

# Connect to a Marty and# use the variable my_marty to refer to that Marty
# This assumes you are connecting via WiFi - check the documentation for other options
# You will need to set the ip_address variable with the IP address of your Marty
connection_method = "wifi"
ip_address = "192.168.86.18"
my_marty = Marty(connection_method, ip_address, blocking=True)

# Ask Marty to play a sound
my_marty.play_sound("no_way")

# Disconnect from Marty
my_marty.close()
Exemplo n.º 2
0
logger.info(f"Marty interface stats {json.dumps(mymarty.get_interface_stats())}")

testBoolCmd("Get ready", mymarty.get_ready())
testBoolCmd("Circle Dance", mymarty.circle_dance())
testBoolCmd("Eyes excited", mymarty.eyes('excited'))
testBoolCmd("Eyes wide", mymarty.eyes('wide'))
testBoolCmd("Eyes angry", mymarty.eyes('angry'))
testBoolCmd("Eyes normal", mymarty.eyes('normal'))
testBoolCmd("Kick left", mymarty.kick('left'))
testBoolCmd("Kick right", mymarty.kick('right'))
testBoolCmd("Stop", mymarty.stop())
testBoolCmd("Arms 45", mymarty.arms(45, 45, 500))
testBoolCmd("Arms 0", mymarty.arms(0, 0, 500))

testBoolCmd("Arms 0", mymarty.play_sound("disbelief"))
testBoolCmd("Arms 0", mymarty.play_sound("excited"))
testBoolCmd("Arms 0", mymarty.play_sound("screenfree"))

logger.info(f"Marty interface stats {json.dumps(mymarty.get_interface_stats())}")

for i in range(9): 
    testBoolCmd(f"Move joint {i}", mymarty.move_joint(i, i * 10, 500))
for jointName in jointNames: 
    testBoolCmd(f"Move joint {jointName}", mymarty.move_joint(jointName, 123, 500))

logger.info(f"Accelerometer x {mymarty.get_accelerometer('x')}")
logger.info(f"Accelerometer y { mymarty.get_accelerometer('y')}")
logger.info(f"Accelerometer z { mymarty.get_accelerometer('z')}")

if martyVersion2: