コード例 #1
0
from martypy import Marty
my_marty = Marty("wifi", "192.168.86.11")
my_marty.dance()
コード例 #2
0
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:
    testBoolCmd("Dance", mymarty.dance())
    testBoolCmd("Eyes wiggle", mymarty.eyes('wiggle'))
    testBoolCmd("Hold position", mymarty.hold_position(6000))
    testBoolCmd("is_moving", mymarty.is_moving())
    logger.info("Joint positions: ", [mymarty.get_joint_position(pos) for pos in range(9)])

time.sleep(5)

mymarty.close()