-
Notifications
You must be signed in to change notification settings - Fork 142
Antim/sim integration merged #1390
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
Open
leshy
wants to merge
8
commits into
dev
Choose a base branch
from
antim/sim-integration-merged
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
15526d4
Add Antim Labs sim integration module (dimsim)
Viswa4599 6d28968
Auto-install and update dimsim CLI on dimos run sim-nav
Viswa4599 fe77900
CI code cleanup
Viswa4599 97c77f7
Fixes:
Viswa4599 02d1342
CI code cleanup
Viswa4599 0dbcd7a
Fix rerun camera: separate pinhole from image entity for 2D/3D compat
Viswa4599 4a46b5d
Force Deno cache reload on dimsim CLI update
Viswa4599 60c0c00
sim mapper small adjustments
leshy 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
Empty file.
Empty file.
Empty file.
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,145 @@ | ||
| # Copyright 2026 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. | ||
|
|
||
| """Basic DimSim blueprint — connection + visualization.""" | ||
|
|
||
| from typing import Any | ||
|
|
||
| from dimos.core.blueprints import autoconnect | ||
| from dimos.core.global_config import global_config | ||
| from dimos.core.transport import JpegLcmTransport | ||
| from dimos.msgs.sensor_msgs import Image | ||
| from dimos.protocol.pubsub.impl.lcmpubsub import LCM | ||
| from dimos.robot.sim.bridge import sim_bridge | ||
| from dimos.robot.sim.tf_module import sim_tf | ||
| from dimos.web.websocket_vis.websocket_vis_module import websocket_vis | ||
|
|
||
|
|
||
| class _SimLCM(LCM): # type: ignore[misc] | ||
| """LCM that JPEG-decodes image topics and standard-decodes everything else.""" | ||
|
|
||
| _JPEG_TOPICS = frozenset({"/color_image"}) | ||
|
|
||
| def decode(self, msg: bytes, topic: Any) -> Any: # type: ignore[override] | ||
| if getattr(topic, "topic", None) in self._JPEG_TOPICS: | ||
| return Image.lcm_jpeg_decode(msg) | ||
| return super().decode(msg, topic) | ||
|
|
||
|
|
||
| # DimSim sends JPEG-compressed images over LCM — use JpegLcmTransport to decode. | ||
| _transports_base = autoconnect().transports( | ||
| {("color_image", Image): JpegLcmTransport("/color_image", Image)} | ||
| ) | ||
|
|
||
|
|
||
| def _convert_camera_info(camera_info: Any) -> Any: | ||
| # Log pinhole under TF tree (3D frustum) — NOT at the image entity. | ||
| # Pinhole at the image entity blocks rerun's 2D viewer. | ||
| import rerun as rr | ||
|
|
||
| fx, fy = camera_info.K[0], camera_info.K[4] | ||
| cx, cy = camera_info.K[2], camera_info.K[5] | ||
| return [ | ||
| ( | ||
| "world/tf/camera_optical", | ||
| rr.Pinhole( | ||
| focal_length=[fx, fy], | ||
| principal_point=[cx, cy], | ||
| width=camera_info.width, | ||
| height=camera_info.height, | ||
| image_plane_distance=1.0, | ||
| ), | ||
| ), | ||
| ( | ||
| "world/tf/camera_optical", | ||
| rr.Transform3D(parent_frame="tf#/camera_optical"), | ||
| ), | ||
| ] | ||
|
|
||
|
|
||
| def _convert_color_image(image: Any) -> Any: | ||
| # Log image at both: | ||
| # world/color_image — 2D view (no pinhole ancestor) | ||
| # world/tf/camera_optical/image — 3D view (child of pinhole) | ||
| rerun_data = image.to_rerun() | ||
| return [ | ||
| ("world/color_image", rerun_data), | ||
| ("world/tf/camera_optical/image", rerun_data), | ||
| ] | ||
|
|
||
|
|
||
| def _convert_global_map(grid: Any) -> Any: | ||
| return grid.to_rerun(voxel_size=0.1, mode="boxes") | ||
|
|
||
|
|
||
| def _convert_navigation_costmap(grid: Any) -> Any: | ||
| return grid.to_rerun( | ||
| colormap="Accent", | ||
| z_offset=0.015, | ||
| opacity=0.2, | ||
| background="#484981", | ||
| ) | ||
|
|
||
|
|
||
| def _static_base_link(rr: Any) -> list[Any]: | ||
| return [ | ||
| rr.Boxes3D( | ||
| half_sizes=[0.3, 0.15, 0.12], | ||
| colors=[(0, 180, 255)], | ||
| ), | ||
| rr.Transform3D(parent_frame="tf#/base_link"), | ||
| ] | ||
|
|
||
|
|
||
| rerun_config = { | ||
| "pubsubs": [_SimLCM(autoconf=True)], | ||
| "visual_override": { | ||
| "world/camera_info": _convert_camera_info, | ||
| "world/color_image": _convert_color_image, | ||
| "world/global_map": _convert_global_map, | ||
| "world/navigation_costmap": _convert_navigation_costmap, | ||
| "world/pointcloud": None, | ||
| }, | ||
| "static": { | ||
| "world/tf/base_link": _static_base_link, | ||
| }, | ||
| } | ||
|
|
||
| match global_config.viewer_backend: | ||
| case "foxglove": | ||
| from dimos.robot.foxglove_bridge import foxglove_bridge | ||
|
|
||
| with_vis = autoconnect( | ||
| _transports_base, | ||
| foxglove_bridge(shm_channels=["/color_image#sensor_msgs.Image"]), | ||
| ) | ||
| case "rerun": | ||
| from dimos.visualization.rerun.bridge import rerun_bridge | ||
|
|
||
| with_vis = autoconnect(_transports_base, rerun_bridge(**rerun_config)) | ||
| case "rerun-web": | ||
| from dimos.visualization.rerun.bridge import rerun_bridge | ||
|
|
||
| with_vis = autoconnect(_transports_base, rerun_bridge(viewer_mode="web", **rerun_config)) | ||
| case _: | ||
| with_vis = _transports_base | ||
|
|
||
| sim_basic = autoconnect( | ||
| with_vis, | ||
| sim_bridge(), | ||
| sim_tf(), | ||
| websocket_vis(), | ||
| ).global_config(n_workers=4, robot_model="dimsim") | ||
|
|
||
| __all__ = ["sim_basic"] | ||
Empty file.
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,35 @@ | ||
| # Copyright 2026 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. | ||
|
|
||
| """DimSim navigation blueprint — basic + mapping + planning + exploration.""" | ||
|
|
||
| from dimos.core.blueprints import autoconnect | ||
| from dimos.mapping.costmapper import cost_mapper | ||
| from dimos.mapping.pointclouds.occupancy import ( | ||
| HeightCostConfig, | ||
| ) | ||
| from dimos.mapping.voxels import voxel_mapper | ||
| from dimos.navigation.frontier_exploration import wavefront_frontier_explorer | ||
| from dimos.navigation.replanning_a_star.module import replanning_a_star_planner | ||
| from dimos.robot.sim.blueprints.basic.sim_basic import sim_basic | ||
|
|
||
| sim_nav = autoconnect( | ||
| sim_basic, | ||
| voxel_mapper(voxel_size=0.1, publish_interval=0.5), | ||
| cost_mapper(algo="height_cost", config=HeightCostConfig(can_pass_under=1.5, smoothing=2.0)), | ||
| replanning_a_star_planner(), | ||
| wavefront_frontier_explorer(), | ||
| ).global_config(n_workers=6, robot_model="dimsim") | ||
|
|
||
| __all__ = ["sim_nav"] |
Oops, something went wrong.
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.
I'd suggest we should be moving to a config that is not created at import time. To facilitate that in future, maybe this should all be wrapped into a function? Then if we remove the global_config variable in future this API wouldn't need to change.