Skip to content

Commit c777793

Browse files
committed
make robot calls async
1 parent 6a85cd4 commit c777793

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

doggo.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,15 @@ async def act(self, params):
6060
async def call_robot(self, api_id, params=None):
6161
args = {'api_id': api_id}
6262
if params:
63-
args['parameter'] = params
64-
await self.dog.maybe_reconnect()
65-
await self.dog.robot.datachannel.pub_sub.publish_request_new(
66-
RTC_TOPIC["SPORT_MOD"], args
67-
)
63+
args["parameter"] = params
64+
65+
async def _call():
66+
await self.dog.maybe_reconnect()
67+
await self.dog.robot.datachannel.pub_sub.publish_request_new(
68+
RTC_TOPIC["SPORT_MOD"], args
69+
)
70+
71+
asyncio.create_task(_call())
6872

6973
def tool(self):
7074
return Tool(

0 commit comments

Comments
 (0)