native CompressedImage across all go2 blueprints - #2879
Draft
spomichter wants to merge 14 commits into
Draft
Conversation
…ges on any transport adds sensor_msgs.CompressedImage wrapping the existing dimos_lcm binding (jpeg/png, ts+frame_id preserved, rr.EncodedImage viz) and a CodecTransport that compresses Image->CompressedImage over any inner transport (lcm, zenoh, shm, webrtc). benchmark test compares raw image vs compressed on lcm+zenoh: 19.5x wire reduction, raw 720p over lcm drops most frames while comressed delivers all
… compressed image transport go2 basic with CodecTransport on color_image (jpeg q80 on the wire istead of 2.76MB raw frames). readme gets a short compressed-images section with the publish path and how to run the raw-vs-compressed benchmark
the ubuntu-arm runner doesnt have libturbojpeg installed, same optional-dep treatment as test_cli.py / test_all_blueprints.py
…issing root cause of the arm failures: the tests job only apt-installed portaudio, x64 runners had libturbojpeg by accident from the runner image. install it explicitly and turn the silent skip into a CI assert (same treatment as the webrtc aiortc guard from #2048), skip stays for local no-syslib installs
collect rows across the lcm/zenoh params in a module fixture and print a single table (wire/median/max/fps/drops) like tool_benchmark does, plus a note on what the latency number actually measures
installing libturbojpeg on the arm runner unblocked _jpeg_case, which then hit the CI LFS download cap at collection time. treat unavailable data like unavailable turbojpeg (case returns None)
runs a real blueprint in replay mode with BenchSink consumer modules (per-frame arrival log + optional synthetic detector load) and a host sampler (cpu/rss/loopback rate). used for the raw-vs-codec report on unitree-go2; tool_ prefix keeps it out of pytest and the module registry
'codec' already means the memory2 storage codecs (JpegCodec/Lz4Codec) and the generic name promised flexibility the class doesnt have — its hardwired Image<->CompressedImage. new name matches the msg type and the existing JpegLcmTransport/WebRTCVideoTransport naming style
the import-time CI assert broke the self-hosted ros job which collects these files but deselects them by marker. new form: skip locally when the native lib is missing, run (and fail loudly) in CI — same intent, respects deselection like the aiortc guard test does
Team direction is option 5 (connections output CompressedImage directly); the transport wrapper was rejected as public API. Keep it inside tool_replay_bench.py so raw-vs-codec benchmark cells stay reproducible, move its tests alongside, drop the unitree-go2-compressed-image blueprint.
CompressedCodec is bench-only now: drop format/max_width/decode params and the double-wrap guard the bench never uses; rename its tests to test_replay_bench.py to match. Turbojpeg guard moves to conftest as a skipif_no_turbojpeg marker (skip locally, run-and-fail-loudly in CI).
…tion 5) GO2Connection publishes Out[CompressedImage]: encode once at the publish edge (config.image_quality, default 75), already-compressed dataset frames pass through — old replay datasets keep working unconverted. Consumers decode only where pixels are needed; CompressedImage.decode() is memoized (decode cache never pickles). VLM agents and quest teleop send the jpeg wire bytes directly — their per-frame re-encode is gone. Shared-with-other-robots modules get Compressed* port-retype subclasses (SpatialMemory, NavigationSkillContainer, Detection3DModule, MarkerDetectionStreamModule, HostedTwistTeleopModule); go2-only modules flip in place. CameraVideoTrack decodes at recv so webrtc video pays decode only for frames actually sent. Bench harness: --sink decode|bytes flavors, per-nic wire sampling, viewer bridge disabled (was hijacking any open viewer on the box). CompressedImage joins zenoh latest-wins QoS types.
❌ 1 Tests Failed:
View the full list of 1 ❄️ flaky test(s)
To view more test analytics, go to the Test Analytics Dashboard |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
decided to cahgne connections to output
CompressedImagedirectly, producers pick the encoding, consumers decode only when they need pixels. This PR does that migration for every go2 blueprint. Stacked on #2814 (theCompressedImagetype).What changes
Producer —
GO2Connection.color_image: Out[CompressedImage]. jpeg encode happens once at the publish edge (config.image_quality, default 75). frames that are already CompressedImage pass through untouched — which is also why old replay datasets keep working with zero conversion: replay feeds raw Image frames through the same edge and they get encoded like live frames.Go2FleetConnectioninherits the change.Consumers — decode at point of use, and
CompressedImage.decode()is memoized (one decode per frame max, cache never pickles):PerceiveLoopSkill,PersonFollowSkillContainer,TemporalMemory,Go2Memory,Go2Mid360Recorder,VLMAgent,VlmStreamTester,Go2TeleopModuleCompressedSpatialMemory,CompressedNavigationSkillContainer,CompressedDetection3DModule,CompressedMarkerDetectionStreamModule,HostedTwistTeleopModule(retyped in place — hosted-go2 only)# type: ignore[assignment](deliberate LSP violation — that IS the wiring mechanism). 5 of them, each commented.Zero-decode paths (the structural wins over the codec wrapper):
VLMAgentsends the jpeg wire bytes straight to the model (CompressedImage.agent_encode()) — the old per-query re-encode is gone_push_jpegforwards wire bytes to the headset — per-frame re-encode goneCameraVideoTrack(hosted teleop webrtc) decodes atrecv(), so only frames actually sent to the operator pay a decoderr.EncodedImage, no pixel decodeMisc:
sensor_msgs.CompressedImageadded to zenoh latest-wins QoS; bench harness gets--sink decode|bytesand per-nic wire sampling; bench blueprint drops the viewer bridge (it was hijacking any open viewer on the box).Native e2e benchmark (same protocol as #2831: go2_short replay ~14Hz 720p, 60s x 2 reps)
against the #2831 baselines (same box, same dataset):
native matches the codec pin on delivery and cpu and beats raw everywhere, with no wrapper in any blueprint — the encode lives in the connection where option 5 wants it. real dataset frames compress to 71KB at q75 (39x), better than the synthetic 720p estimate.
pending: network sweep (rate-limit + loss profiles via tc netem) — needs sudo on the bench box; raw/codec network baselines run from
3f2fc05adwhere the harness still has--mode raw|codec.Breaking Changes
GO2Connection.color_imageis nowOut[CompressedImage]— anything outside this repo wiring("color_image", Image)against a go2 graph must retype or decode.Compressed*subclasses.How to Test
dimos --replay run unitree-go2shows the camera in rerun via EncodedImage (no pixel decode in the viewer path).Contributor License Agreement