-
Notifications
You must be signed in to change notification settings - Fork 159
New g1 blueprint runfiles #706
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
23a2c1f
WIP g1 runfile conversion to blueprint
spomichter e97fc23
Temp comment out websocket vis throwing connection errors to odom and…
alexlin2 acf7336
Working G1 runfiles (spatial memory not working)
spomichter c12c9cc
CI code cleanup
spomichter 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
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 |
|---|---|---|
| @@ -0,0 +1,173 @@ | ||
| #!/usr/bin/env python3 | ||
| # Copyright 2025 Dimensional Inc. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| """Blueprint configurations for Unitree G1 humanoid robot. | ||
|
|
||
| This module provides pre-configured blueprints for various G1 robot setups, | ||
| from basic teleoperation to full autonomous agent configurations. | ||
| """ | ||
|
|
||
| from dimos.constants import DEFAULT_CAPACITY_COLOR_IMAGE, DEFAULT_CAPACITY_DEPTH_IMAGE | ||
| from dimos.core.blueprints import autoconnect | ||
| from dimos.core.transport import LCMTransport, pSHMTransport | ||
| from dimos.msgs.geometry_msgs import ( | ||
| PoseStamped, | ||
| Twist, | ||
| TwistStamped, | ||
| Transform, | ||
| Vector3, | ||
| Quaternion, | ||
| ) | ||
| from dimos.msgs.sensor_msgs import Image, PointCloud2 | ||
| from dimos.msgs.nav_msgs import Odometry, Path | ||
| from dimos_lcm.sensor_msgs import CameraInfo | ||
| from dimos.msgs.std_msgs import Bool | ||
| from dimos.perception.spatial_perception import spatial_memory | ||
| from dimos.robot.foxglove_bridge import foxglove_bridge | ||
| from dimos.robot.unitree_webrtc.unitree_g1 import connection | ||
| from dimos.navigation.rosnav.nav_bot import navigation_module | ||
| from dimos.utils.monitoring import utilization | ||
| from dimos.web.websocket_vis.websocket_vis_module import websocket_vis | ||
| from dimos.navigation.global_planner import astar_planner | ||
| from dimos.navigation.local_planner.holonomic_local_planner import ( | ||
| holonomic_local_planner, | ||
| ) | ||
| from dimos.navigation.bt_navigator.navigator import ( | ||
| behavior_tree_navigator, | ||
| ) | ||
| from dimos.navigation.frontier_exploration import ( | ||
| wavefront_frontier_explorer, | ||
| ) | ||
| from dimos.robot.unitree_webrtc.type.map import mapper | ||
| from dimos.robot.unitree_webrtc.depth_module import depth_module | ||
| from dimos.perception.object_tracker import object_tracking | ||
| from dimos.agents2.agent import llm_agent | ||
| from dimos.agents2.cli.human import human_input | ||
| from dimos.agents2.skills.navigation import navigation_skill | ||
| from dimos.robot.unitree_webrtc.g1_joystick_module import g1_joystick | ||
| from dimos.robot.unitree_webrtc.unitree_g1_skill_container import g1_skills | ||
| from dimos.hardware.camera.module import camera_module | ||
| from dimos.hardware.camera.webcam import Webcam | ||
| from dimos.hardware.camera import zed | ||
|
|
||
|
|
||
| # Basic configuration with navigation and visualization | ||
| basic = ( | ||
| autoconnect( | ||
| # Core connection module for G1 | ||
| connection(), | ||
| # Camera module | ||
| camera_module( | ||
| transform=Transform( | ||
| translation=Vector3(0.05, 0.0, 0.0), | ||
| rotation=Quaternion.from_euler(Vector3(0.0, 0.2, 0.0)), | ||
| frame_id="sensor", | ||
| child_frame_id="camera_link", | ||
| ), | ||
| hardware=lambda: Webcam( | ||
| camera_index=0, | ||
| frequency=15, | ||
| stereo_slice="left", | ||
| camera_info=zed.CameraInfo.SingleWebcam, | ||
| ), | ||
| ), | ||
| # SLAM and mapping | ||
| mapper(voxel_size=0.5, global_publish_interval=2.5), | ||
| # Navigation stack | ||
| astar_planner(), | ||
| holonomic_local_planner(), | ||
| behavior_tree_navigator(), | ||
| wavefront_frontier_explorer(), | ||
| navigation_module(), # G1-specific ROS navigation | ||
| # Visualization | ||
| websocket_vis(), | ||
| foxglove_bridge(), | ||
| ) | ||
| .with_global_config(n_dask_workers=4) | ||
| .with_transports( | ||
| { | ||
| # G1 uses Twist for movement commands | ||
| ("cmd_vel", Twist): LCMTransport("/cmd_vel", Twist), | ||
| ("movecmd", Twist): LCMTransport("/cmd_vel", Twist), | ||
| # State estimation from ROS | ||
| ("state_estimation", Odometry): LCMTransport("/state_estimation", Odometry), | ||
| # Odometry output from ROSNavigationModule | ||
| ("odom_pose", PoseStamped): LCMTransport("/odom", PoseStamped), | ||
| # Navigation module topics from nav_bot | ||
| ("goal_req", PoseStamped): LCMTransport("/goal_req", PoseStamped), | ||
| ("goal_active", PoseStamped): LCMTransport("/goal_active", PoseStamped), | ||
| ("path_active", Path): LCMTransport("/path_active", Path), | ||
| ("pointcloud", PointCloud2): LCMTransport("/lidar", PointCloud2), | ||
| ("global_pointcloud", PointCloud2): LCMTransport("/map", PointCloud2), | ||
| # Original navigation topics for backwards compatibility | ||
| ("goal_pose", PoseStamped): LCMTransport("/goal_pose", PoseStamped), | ||
| ("goal_reached", Bool): LCMTransport("/goal_reached", Bool), | ||
| ("cancel_goal", Bool): LCMTransport("/cancel_goal", Bool), | ||
| # Camera topics (if camera module is added) | ||
| ("image", Image): LCMTransport("/g1/color_image", Image), | ||
| ("color_image", Image): LCMTransport("/g1/color_image", Image), | ||
| ("camera_info", CameraInfo): LCMTransport("/g1/camera_info", CameraInfo), | ||
| } | ||
| ) | ||
| ) | ||
|
|
||
| # Standard configuration with perception and memory | ||
| standard = autoconnect( | ||
| basic, | ||
| spatial_memory(), | ||
| object_tracking(frame_id="camera_link"), | ||
| utilization(), | ||
| ).with_global_config(n_dask_workers=8) | ||
|
|
||
| # Optimized configuration using shared memory for images | ||
| standard_with_shm = autoconnect( | ||
| standard.with_transports( | ||
| { | ||
| ("color_image", Image): pSHMTransport( | ||
| "/g1/color_image", default_capacity=DEFAULT_CAPACITY_COLOR_IMAGE | ||
| ), | ||
| } | ||
| ), | ||
| foxglove_bridge( | ||
| shm_channels=[ | ||
| "/g1/color_image#sensor_msgs.Image", | ||
| ] | ||
| ), | ||
| ) | ||
|
|
||
| # Full agentic configuration with LLM and skills | ||
| agentic = autoconnect( | ||
| standard, | ||
| llm_agent(), | ||
| human_input(), | ||
| navigation_skill(), | ||
| g1_skills(), # G1-specific arm and movement mode skills | ||
| ) | ||
|
|
||
| # Configuration with joystick control for teleoperation | ||
| with_joystick = autoconnect( | ||
| basic, | ||
| g1_joystick(), # Pygame-based joystick control | ||
| ) | ||
|
|
||
| # Full featured configuration with everything | ||
| full_featured = autoconnect( | ||
| standard_with_shm, | ||
| llm_agent(), | ||
| human_input(), | ||
| navigation_skill(), | ||
| g1_skills(), | ||
| g1_joystick(), | ||
| ) |
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
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.
The new
deployhelper wiresnav.cmd_veltoLCMTransport("/cmd_vel", TwistStamped), butROSNav/ROSNavigationModuleonly ever emit plainTwistobjects. BecauseLCMTransportencodes the message type into the channel name, a publisher sendingTwistwill broadcast on/cmd_vel#geometry_msgs.Twistwhile this transport subscribes/publishes on/cmd_vel#geometry_msgs.TwistStamped. Subscribers will either fail to decode or never receive velocity commands, so the deployed navigation node cannot move the robot. Use aTwisttransport here (or convert toTwistStampedbefore publishing).Useful? React with 👍 / 👎.