Skip to content

Commit 209e7b0

Browse files
Merge pull request #749 from dimensionalOS/unify-connections
* Removed the old `unitree_go2.py` and `unitree_g1.py` entrypoints. Now you can either use `dimos` or `run.py`. * Remove duplicate connection classes and modules. * Renamed `spec.Image.image` to `color_image` because it's clearer (`image` alone could also mean depth image). Former-commit-id: 4e311d7
2 parents 4e50d33 + 623e540 commit 209e7b0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+417
-4956
lines changed

dimos/agents/modules/base_agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def start(self) -> None:
125125
# Connect response output
126126
if self.response_out:
127127
disposable = self.response_subject.subscribe(
128-
lambda response: self.response_out.publish(response) # type: ignore[no-untyped-call]
128+
lambda response: self.response_out.publish(response)
129129
)
130130
self._module_disposables.append(disposable)
131131

dimos/agents2/skills/demo_robot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def stop(self) -> None:
3131
super().stop()
3232

3333
def _publish_gps_location(self) -> None:
34-
self.gps_location.publish(LatLon(lat=37.78092426217621, lon=-122.40682866540769)) # type: ignore[no-untyped-call]
34+
self.gps_location.publish(LatLon(lat=37.78092426217621, lon=-122.40682866540769))
3535

3636

3737
demo_robot = DemoRobot.blueprint

dimos/agents2/skills/gps_nav_skill.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def set_gps_travel_points(self, *points: dict[str, float]) -> str:
8484
logger.info(f"Set travel points: {new_points}")
8585

8686
if self.gps_goal._transport is not None:
87-
self.gps_goal.publish(new_points) # type: ignore[no-untyped-call]
87+
self.gps_goal.publish(new_points)
8888

8989
if self._set_gps_travel_goal_points:
9090
self._set_gps_travel_goal_points(new_points)

dimos/agents2/skills/ros_navigation.py

Lines changed: 0 additions & 125 deletions
This file was deleted.

dimos/core/stream.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
from reactivex.disposable import Disposable
2929

3030
import dimos.core.colors as colors
31+
from dimos.utils.logging_config import setup_logger
3132
import dimos.utils.reactive as reactive
3233
from dimos.utils.reactive import backpressure
3334

@@ -37,6 +38,9 @@
3738
T = TypeVar("T")
3839

3940

41+
logger = setup_logger(__file__)
42+
43+
4044
class ObservableMixin(Generic[T]):
4145
# subscribes and returns the first value it receives
4246
# might be nicer to write without rxpy but had this snippet ready
@@ -162,9 +166,10 @@ def __reduce__(self): # type: ignore[no-untyped-def]
162166
),
163167
)
164168

165-
def publish(self, msg): # type: ignore[no-untyped-def]
169+
def publish(self, msg) -> None: # type: ignore[no-untyped-def]
166170
if not hasattr(self, "_transport") or self._transport is None:
167-
raise Exception(f"{self} transport for stream is not specified,")
171+
logger.warning(f"Trying to publish on Out {self} without a transport")
172+
return
168173
self._transport.broadcast(self, msg)
169174

170175

dimos/core/testing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ def odomloop(self) -> None:
7575
return
7676
print(odom)
7777
odom.pubtime = time.perf_counter()
78-
self.odometry.publish(odom) # type: ignore[no-untyped-call]
78+
self.odometry.publish(odom)
7979

8080
lidarmsg = next(lidariter)
8181
lidarmsg.pubtime = time.perf_counter() # type: ignore[union-attr]
82-
self.lidar.publish(lidarmsg) # type: ignore[no-untyped-call]
82+
self.lidar.publish(lidarmsg)
8383
time.sleep(0.1)

dimos/core/transport.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
from __future__ import annotations
1616

17-
import traceback
1817
from typing import Any, TypeVar
1918

2019
import dimos.core.colors as colors
@@ -26,7 +25,7 @@
2625
TypeVar,
2726
)
2827

29-
from dimos.core.stream import In, RemoteIn, Transport
28+
from dimos.core.stream import In, Transport
3029
from dimos.protocol.pubsub.jpeg_shm import JpegSharedMemory
3130
from dimos.protocol.pubsub.lcmpubsub import LCM, JpegLCM, PickleLCM, Topic as LCMTopic
3231
from dimos.protocol.pubsub.shmpubsub import PickleSharedMemory, SharedMemory

dimos/hardware/camera/module.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class CameraModuleConfig(ModuleConfig):
5050

5151

5252
class CameraModule(Module, spec.Camera):
53-
image: Out[Image] = None # type: ignore[assignment]
53+
color_image: Out[Image] = None # type: ignore[assignment]
5454
camera_info: Out[CameraInfo] = None # type: ignore[assignment]
5555

5656
hardware: Callable[[], CameraHardware] | CameraHardware = None # type: ignore[assignment, type-arg]
@@ -75,7 +75,7 @@ def start(self) -> str: # type: ignore[return]
7575
self._disposables.add(self.camera_info_stream().subscribe(self.publish_info))
7676

7777
stream = self.hardware.image_stream().pipe(sharpness_barrier(self.config.frequency)) # type: ignore[attr-defined, union-attr]
78-
self._disposables.add(stream.subscribe(self.image.publish))
78+
self._disposables.add(stream.subscribe(self.color_image.publish))
7979

8080
@rpc
8181
def stop(self) -> None:
@@ -92,7 +92,7 @@ def video_stream(self) -> Image: # type: ignore[misc]
9292
yield from iter(_queue.get, None)
9393

9494
def publish_info(self, camera_info: CameraInfo) -> None:
95-
self.camera_info.publish(camera_info) # type: ignore[no-untyped-call]
95+
self.camera_info.publish(camera_info)
9696

9797
if self.config.transform is None: # type: ignore[attr-defined]
9898
return

dimos/hardware/camera/zed/camera.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ def _publish_color_image(self, image: np.ndarray, header: Header) -> None: # ty
738738
ts=header.ts,
739739
)
740740

741-
self.color_image.publish(msg) # type: ignore[no-untyped-call]
741+
self.color_image.publish(msg)
742742

743743
except Exception as e:
744744
logger.error(f"Error publishing color image: {e}")
@@ -753,7 +753,7 @@ def _publish_depth_image(self, depth: np.ndarray, header: Header) -> None: # ty
753753
frame_id=header.frame_id,
754754
ts=header.ts,
755755
)
756-
self.depth_image.publish(msg) # type: ignore[no-untyped-call]
756+
self.depth_image.publish(msg)
757757

758758
except Exception as e:
759759
logger.error(f"Error publishing depth image: {e}")
@@ -831,7 +831,7 @@ def _publish_camera_info(self) -> None:
831831
binning_y=0,
832832
)
833833

834-
self.camera_info.publish(msg) # type: ignore[no-untyped-call]
834+
self.camera_info.publish(msg)
835835

836836
except Exception as e:
837837
logger.error(f"Error publishing camera info: {e}")
@@ -844,7 +844,7 @@ def _publish_pose(self, pose_data: dict[str, Any], header: Header) -> None:
844844

845845
# Create PoseStamped message
846846
msg = PoseStamped(ts=header.ts, position=position, orientation=rotation)
847-
self.pose.publish(msg) # type: ignore[no-untyped-call]
847+
self.pose.publish(msg)
848848

849849
# Publish TF transform
850850
camera_tf = Transform(

dimos/hardware/fake_zed_module.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def start(self) -> None:
214214
try:
215215
# Color image stream
216216
unsub = self._get_color_stream().subscribe(
217-
lambda msg: self.color_image.publish(msg) if self._running else None # type: ignore[no-untyped-call]
217+
lambda msg: self.color_image.publish(msg) if self._running else None
218218
)
219219
self._disposables.add(unsub)
220220
logger.info("Started color image replay stream")
@@ -224,7 +224,7 @@ def start(self) -> None:
224224
try:
225225
# Depth image stream
226226
unsub = self._get_depth_stream().subscribe(
227-
lambda msg: self.depth_image.publish(msg) if self._running else None # type: ignore[no-untyped-call]
227+
lambda msg: self.depth_image.publish(msg) if self._running else None
228228
)
229229
self._disposables.add(unsub)
230230
logger.info("Started depth image replay stream")
@@ -244,7 +244,7 @@ def start(self) -> None:
244244
try:
245245
# Camera info stream
246246
unsub = self._get_camera_info_stream().subscribe(
247-
lambda msg: self.camera_info.publish(msg) if self._running else None # type: ignore[no-untyped-call]
247+
lambda msg: self.camera_info.publish(msg) if self._running else None
248248
)
249249
self._disposables.add(unsub)
250250
logger.info("Started camera info replay stream")
@@ -265,7 +265,7 @@ def stop(self) -> None:
265265
def _publish_pose(self, msg) -> None: # type: ignore[no-untyped-def]
266266
"""Publish pose and TF transform."""
267267
if msg:
268-
self.pose.publish(msg) # type: ignore[no-untyped-call]
268+
self.pose.publish(msg)
269269

270270
# Publish TF transform from world to camera
271271
import time

0 commit comments

Comments
 (0)