def test_circle_dance() -> None: marty = Marty("test", "", subscribeRateHz=0) marty.circle_dance() testOutput = marty.get_test_output() testExpected = { "buf": [ bytearray(b'\x01\x02\x00v\x00'), bytearray(b'\x02\x02\x00hwstatus\x00'), bytearray(b'\x03\x02\x00traj/circle?side=0&moveTime=1500\x00') ] } assert (testOutput == testExpected)
logger.info(f"Calibration flag {mymarty.is_calibrated()}") testBoolCmd("Calibration flag clear", mymarty.clear_calibration()) if martyVersion2: logger.info(f"Calibration flag should be False ... {mymarty.is_calibrated()}") assert not mymarty.is_calibrated() testBoolCmd("Calibration flag set", mymarty.save_calibration()) if martyVersion2: logger.info(f"Calibration flag should be True ... {mymarty.is_calibrated()}") time.sleep(0.1) if martyVersion2: assert mymarty.is_calibrated() 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())}")
import logging import pathlib cur_path = pathlib.Path(__file__).parent.resolve() sys.path.insert(0, str(cur_path.parent.parent.resolve())) from martypy import Marty import time # Setup logging logging.basicConfig(format='%(levelname)s: %(asctime)s %(funcName)s(%(lineno)d) -- %(message)s', level=logging.DEBUG) logger = logging.getLogger("testBaudRateSelection") mm = Marty("usb") # try: # mm = Marty("wifi://192.168.86.81") # except Exception as excp: # print(f"Couldn't connect to marty") # exit() # mm.eyes(100) # mm.eyes(0) logger.info(f"RIC version info 1: {mm.get_system_info()}") mm.circle_dance() logger.info(f"RIC version info 2: {mm.get_system_info()}") time.sleep(5) logger.info(f"RIC version info 3: {mm.get_system_info()}") mm.close()