Skip to content

fix: use sim camera intrinsics in viewer#1516

Merged
paul-nechifor merged 2 commits intodevfrom
ruthwik/fix/camera-view
Mar 11, 2026
Merged

fix: use sim camera intrinsics in viewer#1516
paul-nechifor merged 2 commits intodevfrom
ruthwik/fix/camera-view

Conversation

@ruthwikdasyam
Copy link
Contributor

@ruthwikdasyam ruthwikdasyam commented Mar 10, 2026

Problem

In simulation mode (Mujoco) the Rerun camera view rendered the image in the top-left corner instead of correctly. The publish_camera_info loop always fell back to the hardcoded Go2 camera intrinsics via _camera_info_static(), ignoring Mujoco's computed intrinsics

Solution

When running in sim, self.camera_info_static is set from the Mujoco connection's computed intrinsics. publish_camera_info now simply publishes self.camera_info_static directly

Breaking Changes

None

How to Test

  • Run dimos --simulation run unitree-go2
  • camera image renders correctly in the viewport (not stuck in top-left corner)
  • no change in behavior with hardware

Contributor License Agreement

  • I have read and approved the CLA.

Before&After
Screenshot from 2026-03-10 13-44-56
Screenshot from 2026-03-10 13-42-46

@ruthwikdasyam ruthwikdasyam changed the title fix: resolve camera intrinsics fix: use sim camera intrinsics in viewer Mar 10, 2026
@ruthwikdasyam ruthwikdasyam marked this pull request as ready for review March 10, 2026 20:54
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 10, 2026

Greptile Summary

This PR fixes a bug in simulation mode where the Rerun camera viewer rendered the image in the top-left corner due to mismatched camera intrinsics. The fix sets self.camera_info_static from MujocoConnection's computed intrinsics when simulation=True, and updates publish_camera_info to use self.camera_info_static instead of always calling the hardcoded _camera_info_static() function.

  • publish_camera_info now publishes self.camera_info_static directly (no behavioral change for hardware mode, since the class default is still _camera_info_static())
  • In simulation mode, camera_info_static is overridden with MuJoCo-computed intrinsics (FOV-based pinhole model from MujocoConnection._compute_camera_info)
  • The attribute camera_info_static is accessed on self.connection, which is typed as Go2ConnectionProtocol — but this attribute is not declared in the protocol, leading to a type error and a potential AttributeError if simulation mode is activated with a non-MuJoCo connection type

Confidence Score: 3/5

  • Safe to merge for the intended use case (MuJoCo simulation), but contains an unguarded attribute access that is not type-safe and could fail at runtime in edge configurations.
  • The fix correctly solves the reported bug for the primary use case. However, accessing self.connection.camera_info_static without an isinstance guard or a Protocol declaration means a type checker will flag it, and any configuration where simulation=True but the connection is not MujocoConnection will raise an AttributeError.
  • dimos/robot/unitree/go2/connection.py — the new simulation branch at lines 208–209

Important Files Changed

Filename Overview
dimos/robot/unitree/go2/connection.py Introduces sim-specific camera intrinsics by reading camera_info_static from the connection object, but accesses an attribute not declared in Go2ConnectionProtocol, creating a type error and a potential AttributeError if simulation mode is active with a non-Mujoco connection.

Sequence Diagram

sequenceDiagram
    participant Init as GO2Connection.__init__
    participant Conn as make_connection()
    participant Mujoco as MujocoConnection
    participant Thread as publish_camera_info thread

    Init->>Conn: make_connection(ip, cfg)
    Conn-->>Init: MujocoConnection (when simulation=True)
    Init->>Mujoco: read camera_info_static
    Mujoco-->>Init: CameraInfo (FOV-based intrinsics)
    Init->>Init: self.camera_info_static = MujocoConnection.camera_info_static

    Note over Init: For hardware mode, class default (_camera_info_static()) is kept

    Init->>Thread: start daemon thread
    loop every 1s
        Thread->>Thread: publish(self.camera_info_static)
    end
Loading

Last reviewed commit: d18eaba

@paul-nechifor paul-nechifor merged commit 3d6cecb into dev Mar 11, 2026
12 checks passed
@spomichter
Copy link
Contributor

amazing i was putting this off lol

spomichter added a commit that referenced this pull request Mar 11, 2026
…nts (#1525)

* feat: add Rerun split layout (Camera | 3D) to Go2 and G1 base blueprints

Adds a horizontal split view (camera feed 1/3, 3D world 2/3) to the
Rerun viewer for Go2 basic and G1 primitive blueprints, matching the
existing drone blueprint pattern. All downstream blueprints inherit
the layout automatically.

* fix(g1): use MuJoCo computed camera intrinsics instead of hardcoded Go2 values

Same fix as PR #1516 for Go2. G1 sim was using hardcoded 1280x720
Go2 real-camera intrinsics while MuJoCo renders at 320x240, causing
the projected camera image to appear tiny in Rerun.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants