Skip to content

Commit 59fca17

Browse files
a few new tricks
1 parent d95d620 commit 59fca17

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

doggo.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
"drill_seargent": "DGzg6RaUqxGRTHSBjfgF",
2929
"knox": "dPah2VEoifKnZT37774q",
3030
"pirate": "PPzYpIqttlTYA83688JI",
31-
"michael": "ldTgmMTsxAK2Vs3NZO03"
31+
"michael": "ldTgmMTsxAK2Vs3NZO03",
32+
"scottish": "y6p0SvBlfEe2MH4XN7BP"
3233
}
3334

3435
class Tool:
@@ -121,13 +122,37 @@ async def act(self, params):
121122
)
122123
return "Doggo is now stopping"
123124

125+
class Dance(Trick):
126+
def __init__(self, dog):
127+
super().__init__(dog, "dance", "Make the dog dance", "tools/empty.json")
128+
129+
async def act(self, params):
130+
await self.dog.maybe_reconnect()
131+
await self.dog.robot.datachannel.pub_sub.publish_request_new(
132+
RTC_TOPIC["SPORT_MOD"], {"api_id": SPORT_CMD["Dance"]}
133+
)
134+
return "Doggo is now dancing"
135+
136+
class Jump(Trick):
137+
def __init__(self, dog):
138+
super().__init__(dog, "jump", "Make the dog jump", "tools/empty.json")
139+
140+
async def act(self, params):
141+
await self.dog.maybe_reconnect()
142+
await self.dog.robot.datachannel.pub_sub.publish_request_new(
143+
RTC_TOPIC["SPORT_MOD"], {"api_id": SPORT_CMD["FrontJump"]}
144+
)
145+
return "Doggo is now jumping"
146+
124147
def trick_tools(dog):
125148
tricks = [
126149
StandUp(dog),
127150
Damp(dog),
128151
Hello(dog),
129152
Move(dog),
130153
Stop(dog),
154+
Dance(dog),
155+
Jump(dog),
131156
]
132157
return [trick.tool() for trick in tricks]
133158

0 commit comments

Comments
 (0)