async def play_action(self, **kwargs): ''' https://web.ubtrobot.com/mini-python-sdk/additional.html#id2 https://web.ubtrobot.com/mini-python-sdk/additional.html#id3 010 打招呼 011 点头 012 俯卧撑 013 武术 014 太极 027 坐下 031 蹲下 017 举双手 015 欢迎 037 摇头 Surveillance_001 打招呼 Surveillance_004 飞吻 Surveillance_006 卖萌 action_016 再见 action_014 邀请 action_005 点赞 ''' self._ensure_connect() block: PlayAction = PlayAction(**kwargs) # response: PlayActionResponse (resultType, response) = await block.execute() return response
async def test_play_action1(): # action_name: 动作文件名, 可以通过GetActionList获取机器人支持的动作 block: PlayAction = PlayAction(action_name='random_short4') #挥左手 block1: PlayAction = PlayAction(action_name='random_short3') #挥右手 # response: PlayActionResponse (resultType, response) = await block.execute() (resultType, response) = await block1.execute() await asyncio.sleep(2) print(f'test_play_action result:{response}') assert resultType == MiniApiResultType.Success, 'test_play_action timetout' assert response is not None and isinstance( response, PlayActionResponse), 'test_play_action result unavailable' assert response.isSuccess, 'play_action failed'
async def test_play_action4(): # action_name: 动作文件名, 可以通过GetActionList获取机器人支持的动作 block: PlayAction = PlayAction(action_name='037_1_1') #摇头循环 # response: PlayActionResponse (resultType, response) = await block.execute() print(f'test_play_action result:{response}') assert resultType == MiniApiResultType.Success, 'test_play_action timetout' assert response is not None and isinstance( response, PlayActionResponse), 'test_play_action result unavailable' assert response.isSuccess, 'play_action failed'
async def test_play_action(): """执行一个动作demo 控制机器人执行一个指定名称的本地(内置/自定义)动作,并等待执行结果回复 动作名称可用GetActionList获取 #PlayActionResponse.isSuccess : 是否成功 #PlayActionResponse.resultCode : 返回码 """ # action_name: 动作文件名, 可以通过GetActionList获取机器人支持的动作 block: PlayAction = PlayAction(action_name='018') # response: PlayActionResponse (resultType, response) = await block.execute() print(f'test_play_action result:{response}') assert resultType == MiniApiResultType.Success, 'test_play_action timetout' assert response is not None and isinstance(response, PlayActionResponse), 'test_play_action result unavailable' assert response.isSuccess, 'play_action failed'