Fix window camera pose round-trip conversion#373
Open
yuecideng wants to merge 2 commits into
Open
Conversation
Correct the DexSim pose-to-look-at up-vector conversion, expose the configured camera-pose hotkey, document the behavior, and add regression coverage.
Contributor
There was a problem hiding this comment.
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
photkey to print a reusable camera pose snippet. - Introduced
WindowCameraPoseCfgand wired it intoSimulationManagerCfgso 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()`. |
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 |
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.
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 generatedwindow.set_look_at(...)preserves the viewer orientation. It also adds the configuredphotkey, documentation, and regression tests.Dependencies: None.
Issue: No issue number was provided.
Type of change
Screenshots
Not applicable.
Checklist
black .command to format the code base.