Skip to content

Fix window camera pose round-trip conversion#373

Open
yuecideng wants to merge 2 commits into
mainfrom
fix/window-camera-pose-roundtrip
Open

Fix window camera pose round-trip conversion#373
yuecideng wants to merge 2 commits into
mainfrom
fix/window-camera-pose-roundtrip

Conversation

@yuecideng

Copy link
Copy Markdown
Contributor

Description

This PR fixes the DexSim window camera pose round trip. The printed look-at parameters now follow DexSim's [right, up, -forward] model-matrix convention, so applying the generated window.set_look_at(...) preserves the viewer orientation. It also adds the configured p hotkey, documentation, and regression tests.

Dependencies: None.

Issue: No issue number was provided.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (non-breaking change which improves an existing functionality)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (existing functionality will not work without user modification)
  • Documentation update

Screenshots

Not applicable.

Checklist

  • I have run the black . command to format the code base.
  • I have made corresponding changes to the documentation.
  • I have added tests that prove my fix is effective or that my feature works.
  • Dependencies have been updated, if applicable.

Correct the DexSim pose-to-look-at up-vector conversion, expose the configured camera-pose hotkey, document the behavior, and add regression coverage.
Copilot AI review requested due to automatic review settings July 10, 2026 14:01
@yuecideng yuecideng added bug Something isn't working dexsim Things related to dexsim visualization Features or functions for visualization with the simulation interaction The interaction simulation features labels Jul 10, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses DexSim viewer camera pose round-trip consistency by converting the window camera pose matrix into look-at parameters that follow DexSim’s [right, up, -forward] model-matrix convention, and adds a p hotkey plus documentation and regression tests to preserve that behavior.

Changes:

  • Added window camera pose conversion/formatting utilities and a p hotkey to print a reusable camera pose snippet.
  • Introduced WindowCameraPoseCfg and wired it into SimulationManagerCfg so hotkey behavior is configurable.
  • Added regression tests to validate look-at conversion round-tripping and hotkey registration behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
tests/sim/test_sim_manager.py Adds regression tests for camera pose formatting, conversion round-trip, and the new hotkey behavior.
embodichain/lab/sim/sim_manager.py Implements pose-to-look-at conversion, snippet formatting, printing, and hotkey registration/integration.
embodichain/lab/sim/cfg.py Adds WindowCameraPoseCfg to configure the new camera pose printing hotkey behavior.
docs/source/features/interaction/window.md Documents the new p hotkey and configuration knobs for camera pose printing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 43 to +45
Recording hotkey registration is controlled by `SimConfig.window_record.enable_hotkey` (enabled by default). You can also call `SimulationManager.start_window_record()`, `stop_window_record()`, or `toggle_window_record()` programmatically.

The camera-pose hotkey is controlled by `SimulationManagerCfg.window_camera_pose.enable_hotkey` and prints look-at form by default. Set `SimulationManagerCfg.window_camera_pose.convert_to_look_at=False` to print the raw 4x4 pose matrix instead. The same output can be requested programmatically with `SimulationManager.print_window_camera_pose()`.
Copilot AI review requested due to automatic review settings July 11, 2026 10:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Comment on lines +2433 to +2436
DexSim stores the viewer camera model matrix with columns
``[right, up, -forward]``. ``Windows.set_look_at`` expects the
corresponding world-space look-at vectors, so the conversion is done
from the matrix columns rather than by assuming a fixed world axis.
Comment on lines +2441 to +2444
Returns:
The ``(eye, look_at, up)`` vectors accepted by
``Windows.set_look_at``.

Comment on lines 43 to +45
Recording hotkey registration is controlled by `SimConfig.window_record.enable_hotkey` (enabled by default). You can also call `SimulationManager.start_window_record()`, `stop_window_record()`, or `toggle_window_record()` programmatically.

The camera-pose hotkey is controlled by `SimulationManagerCfg.window_camera_pose.enable_hotkey` and prints look-at form by default. Set `SimulationManagerCfg.window_camera_pose.convert_to_look_at=False` to print the raw 4x4 pose matrix instead. The same output can be requested programmatically with `SimulationManager.print_window_camera_pose()`.
Comment on lines 16 to 18
import argparse
import math
import os
import time
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working dexsim Things related to dexsim interaction The interaction simulation features visualization Features or functions for visualization with the simulation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants