|
17 | 17 | import functools |
18 | 18 | import threading |
19 | 19 | import time |
20 | | -from typing import TypeAlias |
| 20 | +from typing import Any, TypeAlias |
21 | 21 |
|
22 | 22 | import numpy as np |
23 | 23 | from numpy.typing import NDArray |
|
34 | 34 | WebRTCConnectionMethod, |
35 | 35 | ) |
36 | 36 |
|
37 | | -from dimos.core import rpc |
38 | 37 | from dimos.core.resource import Resource |
39 | 38 | from dimos.msgs.geometry_msgs import Pose, Transform, Twist |
40 | 39 | from dimos.msgs.sensor_msgs import Image, PointCloud2 |
@@ -228,7 +227,7 @@ def run_unsubscription() -> None: |
228 | 227 | ) |
229 | 228 |
|
230 | 229 | # Generic sync API call (we jump into the client thread) |
231 | | - def publish_request(self, topic: str, data: dict): # type: ignore[no-untyped-def, type-arg] |
| 230 | + def publish_request(self, topic: str, data: dict[Any, Any]) -> Any: |
232 | 231 | future = asyncio.run_coroutine_threadsafe( |
233 | 232 | self.conn.datachannel.pub_sub.publish_request_new(topic, data), self.loop |
234 | 233 | ) |
@@ -275,33 +274,20 @@ def video_stream(self) -> Observable[Image]: |
275 | 274 | def lowstate_stream(self) -> Observable[LowStateMsg]: |
276 | 275 | return backpressure(self.unitree_sub_stream(RTC_TOPIC["LOW_STATE"])) |
277 | 276 |
|
278 | | - def standup_ai(self) -> bool: |
279 | | - return self.publish_request(RTC_TOPIC["SPORT_MOD"], {"api_id": SPORT_CMD["BalanceStand"]}) # type: ignore[no-any-return] |
280 | | - |
281 | | - def standup_normal(self) -> bool: |
282 | | - self.publish_request(RTC_TOPIC["SPORT_MOD"], {"api_id": SPORT_CMD["StandUp"]}) |
283 | | - time.sleep(0.5) |
284 | | - self.publish_request(RTC_TOPIC["SPORT_MOD"], {"api_id": SPORT_CMD["RecoveryStand"]}) |
285 | | - return True |
286 | | - |
287 | | - @rpc |
288 | 277 | def standup(self) -> bool: |
289 | | - if self.mode == "ai": |
290 | | - return self.standup_ai() |
291 | | - else: |
292 | | - return self.standup_normal() |
| 278 | + return bool(self.publish_request(RTC_TOPIC["SPORT_MOD"], {"api_id": SPORT_CMD["StandUp"]})) |
293 | 279 |
|
294 | | - @rpc |
295 | 280 | def liedown(self) -> bool: |
296 | | - return self.publish_request(RTC_TOPIC["SPORT_MOD"], {"api_id": SPORT_CMD["StandDown"]}) # type: ignore[no-any-return] |
| 281 | + return bool( |
| 282 | + self.publish_request(RTC_TOPIC["SPORT_MOD"], {"api_id": SPORT_CMD["StandDown"]}) |
| 283 | + ) |
297 | 284 |
|
298 | 285 | async def handstand(self): # type: ignore[no-untyped-def] |
299 | 286 | return self.publish_request( |
300 | 287 | RTC_TOPIC["SPORT_MOD"], |
301 | 288 | {"api_id": SPORT_CMD["Standup"], "parameter": {"data": True}}, |
302 | 289 | ) |
303 | 290 |
|
304 | | - @rpc |
305 | 291 | def color(self, color: VUI_COLOR = VUI_COLOR.RED, colortime: int = 60) -> bool: |
306 | 292 | return self.publish_request( # type: ignore[no-any-return] |
307 | 293 | RTC_TOPIC["VUI"], |
|
0 commit comments