Conversation
Greptile OverviewGreptile SummaryThis PR adds a webcam demo feature accessible via Key ChangesCore Feature:
Bug Fixes:
Code Cleanup:
IntegrationThe demo follows the established pattern used by other demo blueprints like
Confidence Score: 4/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant User
participant CLI as dimos CLI
participant Blueprint as ModuleBlueprintSet
participant CameraModule
participant Webcam as Webcam Hardware
participant ImageStream as Observable[Image]
User->>CLI: dimos run demo-camera
CLI->>Blueprint: Load demo_camera blueprint
Note over Blueprint: autoconnect(camera_module())
Blueprint->>CameraModule: Deploy & start module
CameraModule->>Webcam: Initialize webcam hardware
Webcam->>Webcam: Open cv2.VideoCapture
Webcam->>ImageStream: Create image stream
loop Capture Loop
Webcam->>Webcam: Read frame from camera
Webcam->>Webcam: Convert BGR to RGB
Webcam->>ImageStream: Emit Image(format=RGB)
ImageStream->>CameraModule: Publish to color_image output
end
Note over CameraModule: Module runs until stopped
User->>CLI: Stop (Ctrl+C)
CLI->>CameraModule: Stop module
CameraModule->>Webcam: Release camera
|
| ) | ||
|
|
||
|
|
||
| __all__ = ["CameraModule", "camera_module"] |
There was a problem hiding this comment.
demo_camera should be added to the __all__ export list for consistency with the module's export conventions. While the blueprint will work without this (since all_blueprints.py uses direct import paths), it's best practice to include all public module-level variables in __all__.
| __all__ = ["CameraModule", "camera_module"] | |
| __all__ = ["CameraModule", "camera_module", "demo_camera"] |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
spomichter
left a comment
There was a problem hiding this comment.
Approving bc i assume this is tested - but idk why we need auto connect on blueprints w one
module
|
|
||
| camera_module = CameraModule.blueprint | ||
|
|
||
| demo_camera = autoconnect( |
There was a problem hiding this comment.
@paul-nechifor do we need to run autocorrect on a blueprint with one module?
There was a problem hiding this comment.
Thats a good point, probably not. I'll test that tomorrow and simplify if it works without autoconnect.
There was a problem hiding this comment.
No. It can just be demo_camera = CameraModule.blueprint()
|
you can also instantiate the class and just use it (no multiprocess or anything) or you can dimos.deploy it and then use it, idk if we want to use blueprints on a single module but your call, just making sure we are all aware https://github.com/dimensionalOS/dimos/blob/dev/docs/concepts/modules.md |
dimos run demo-camera