Conversation
leshy
commented
Apr 28, 2026
- confirmed auto-recording of go2 when running on real platform
- created new (temporary) china office recording - better one coming tomorrow
- ./bin/lfs_push ignores sqlite sidecar files
- fixed bgr/rgb stuff once and for all, removed legacy hacks fixing this
| rgb_array = self.to_rgb().data | ||
| jpeg_data = jpeg.encode(rgb_array, quality=quality, pixel_format=TJPF_RGB) |
There was a problem hiding this comment.
RGBA images will break JPEG encoding
to_rgb() for ImageFormat.RGBA returns a 4-channel copy (it doesn't strip alpha — see the return self.copy() branch at line 247), so rgb_array will have shape (H, W, 4). Passing a 4-channel array to jpeg.encode(..., pixel_format=TJPF_RGB) (which expects 3-channel RGB) will raise an error at runtime.
The old to_bgr() path correctly dropped the alpha channel via cv2.COLOR_RGBA2BGR. The new path doesn't. If an RGBA-formatted Image ever reaches lcm_jpeg_encode, it will now fail where it previously succeeded.
Greptile SummaryThis PR confirms auto-recording on the real Go2 platform, ships a new Confidence Score: 5/5Safe to merge — all findings are P2 and limited to a test helper. The only issue found is in dimos/memory2/codecs/test_codecs.py — shape check in Important Files Changed
Sequence DiagramsequenceDiagram
participant RC as ReplayConnection
participant TSR as TimedSensorReplay
participant SS as SqliteStore<br/>(must_exist=True)
participant Rec as Recorder (Go2Memory)
participant DB as SQLite DB
RC->>TSR: video_stream() / lidar_stream() / odom_stream()
TSR->>SS: _get_store(dataset)
SS->>DB: open (raises FileNotFoundError if missing)
DB-->>SS: connection
SS-->>TSR: store
TSR-->>RC: Observable[Image|PointCloud2|PoseStamped]
Note over Rec: start() called
Rec->>Rec: g.replay == True?
alt replay mode
Rec-->>Rec: return early — DB left untouched
else live mode
Rec->>DB: record color_image / lidar / odom streams
end
Note over RC: lcm_jpeg_encode
RC->>RC: to_rgb() → TJPF_RGB encode
RC->>RC: lcm_jpeg_decode → TJPF_RGB → ImageFormat.RGB
Reviews (3): Last reviewed commit: "fix(Image): to_rgb/to_bgr correctly hand..." | Re-trigger Greptile |
to_rgb() previously returned a 4-channel RGBA-tagged Image for RGBA input and an RGBA Image for BGRA input, contradicting its name and breaking lcm_jpeg_encode (which passes the result to TurboJPEG with TJPF_RGB, expecting 3 channels). Both branches now strip alpha via cv2 and return a real RGB Image. to_rgb/to_bgr now also warn when dropping alpha. Also moves ImageFormat import to top of test_codecs.py per review feedback.