Add trajectory recording/replay system with performance improvements#16
Merged
Conversation
1d7c8b5 to
5847041
Compare
89e736a to
2741028
Compare
a986844 to
f4b1a58
Compare
a3d0916 to
e0fc6c9
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR adds a comprehensive trajectory recording and replay system with performance improvements. The system allows users to record robot movements using keyboard teleop controls and replay them later for demonstration or analysis purposes.
- Adds trajectory recording capability with 'r' key toggle in the teleop interface
- Implements trajectory replay functionality with a dedicated replay script
- Includes performance optimizations and bug fixes across multiple robot control components
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/env/gs_env/sim/robots/manipulators.py | Adds reset_to_pose method, fixes inverse kinematics handling, and improves error handling |
| src/env/gs_env/sim/envs/manipulation/pick_cube_env.py | Updates joint configuration to include 7th joint for proper robot initialization |
| src/env/gs_env/common/utils/gs_utils.py | Fixes return type annotation for better type safety |
| src/agent/gs_agent/wrappers/teleop_wrapper.py | Major refactor adding trajectory recording/replay system and improved keyboard handling |
| src/agent/gs_agent/wrappers/gs_env_wrapper.py | Updates type annotation for better compatibility |
| examples/run_pick_cube_teleop.py | Updates teleop script with new recording instructions and improved control flow |
| examples/replay_with_viewer.py | New replay script for trajectory playback using recorded data |
| README.md | Comprehensive documentation update with teleop usage instructions and trajectory format details |
Comments suppressed due to low confidence (1)
src/env/gs_env/sim/robots/manipulators.py:227
- The code now assumes inverse_kinematics always returns a tuple and never returns None, but there's no error handling if the IK solver fails. Consider adding a check to handle cases where q_pos might be None or invalid.
q_pos, _ = self._robot_entity.inverse_kinematics(
link=self._ee_link,
pos=target_pos,
quat=target_quat,
dofs_idx_local=self._arm_dof_idx,
max_samples=10, # number of IK samples
max_solver_iters=20, # maximum solver iterations
)
q_pos[:, self._fingers_dof] = torch.tensor(
[act.gripper_width, act.gripper_width], device=self._device
)
self._robot_entity.control_dofs_position(position=q_pos)
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
yun-long
reviewed
Sep 9, 2025
yun-long
reviewed
Sep 9, 2025
yun-long
reviewed
Sep 9, 2025
yun-long
reviewed
Sep 9, 2025
yun-long
reviewed
Sep 9, 2025
yun-long
reviewed
Sep 9, 2025
yun-long
reviewed
Sep 9, 2025
yun-long
reviewed
Sep 9, 2025
yun-long
reviewed
Sep 9, 2025
yun-long
reviewed
Sep 9, 2025
YilingQiao
reviewed
Sep 9, 2025
YilingQiao
reviewed
Sep 9, 2025
YilingQiao
reviewed
Sep 9, 2025
YilingQiao
reviewed
Sep 9, 2025
YilingQiao
reviewed
Sep 9, 2025
YilingQiao
reviewed
Sep 9, 2025
YilingQiao
reviewed
Sep 9, 2025
YilingQiao
reviewed
Sep 9, 2025
YilingQiao
reviewed
Sep 9, 2025
YilingQiao
reviewed
Sep 9, 2025
YilingQiao
reviewed
Sep 9, 2025
YilingQiao
reviewed
Sep 9, 2025
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.
What's Added:
Trajectory Recording - Press 'r' to start/stop recording robot movements
Trajectory Replay - Replay recorded trajectories with replay_with_viewer.py
How to Use:
Run teleop: python examples/run_pick_cube_teleop.py
Press 'r' to record, 'r' again to stop and save
Replay: python examples/replay_with_viewer.py