-
Notifications
You must be signed in to change notification settings - Fork 156
fix(unitree-go2): minor issues #1307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,7 +17,7 @@ | |
| import functools | ||
| import threading | ||
| import time | ||
| from typing import TypeAlias | ||
| from typing import Any, TypeAlias | ||
|
|
||
| import numpy as np | ||
| from numpy.typing import NDArray | ||
|
|
@@ -34,7 +34,6 @@ | |
| WebRTCConnectionMethod, | ||
| ) | ||
|
|
||
| from dimos.core import rpc | ||
| from dimos.core.resource import Resource | ||
| from dimos.msgs.geometry_msgs import Pose, Transform, Twist | ||
| from dimos.msgs.sensor_msgs import Image, PointCloud2 | ||
|
|
@@ -228,7 +227,7 @@ def run_unsubscription() -> None: | |
| ) | ||
|
|
||
| # Generic sync API call (we jump into the client thread) | ||
| def publish_request(self, topic: str, data: dict): # type: ignore[no-untyped-def, type-arg] | ||
| def publish_request(self, topic: str, data: dict[Any, Any]) -> Any: | ||
| future = asyncio.run_coroutine_threadsafe( | ||
| self.conn.datachannel.pub_sub.publish_request_new(topic, data), self.loop | ||
| ) | ||
|
|
@@ -275,33 +274,20 @@ def video_stream(self) -> Observable[Image]: | |
| def lowstate_stream(self) -> Observable[LowStateMsg]: | ||
| return backpressure(self.unitree_sub_stream(RTC_TOPIC["LOW_STATE"])) | ||
|
|
||
| def standup_ai(self) -> bool: | ||
| return self.publish_request(RTC_TOPIC["SPORT_MOD"], {"api_id": SPORT_CMD["BalanceStand"]}) # type: ignore[no-any-return] | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't work for me. |
||
|
|
||
| def standup_normal(self) -> bool: | ||
| self.publish_request(RTC_TOPIC["SPORT_MOD"], {"api_id": SPORT_CMD["StandUp"]}) | ||
| time.sleep(0.5) | ||
| self.publish_request(RTC_TOPIC["SPORT_MOD"], {"api_id": SPORT_CMD["RecoveryStand"]}) | ||
| return True | ||
|
|
||
| @rpc | ||
| def standup(self) -> bool: | ||
| if self.mode == "ai": | ||
| return self.standup_ai() | ||
| else: | ||
| return self.standup_normal() | ||
| return bool(self.publish_request(RTC_TOPIC["SPORT_MOD"], {"api_id": SPORT_CMD["StandUp"]})) | ||
|
|
||
| @rpc | ||
| def liedown(self) -> bool: | ||
| return self.publish_request(RTC_TOPIC["SPORT_MOD"], {"api_id": SPORT_CMD["StandDown"]}) # type: ignore[no-any-return] | ||
| return bool( | ||
| self.publish_request(RTC_TOPIC["SPORT_MOD"], {"api_id": SPORT_CMD["StandDown"]}) | ||
| ) | ||
|
|
||
| async def handstand(self): # type: ignore[no-untyped-def] | ||
| return self.publish_request( | ||
| RTC_TOPIC["SPORT_MOD"], | ||
| {"api_id": SPORT_CMD["Standup"], "parameter": {"data": True}}, | ||
| ) | ||
|
|
||
| @rpc | ||
| def color(self, color: VUI_COLOR = VUI_COLOR.RED, colortime: int = 60) -> bool: | ||
| return self.publish_request( # type: ignore[no-any-return] | ||
| RTC_TOPIC["VUI"], | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stopping Dask prevented the ModuleCoordinator from stopping modules so
GO2Connection.stopnever calledself.liedown.