-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Adds Teleop UI Feedback Visualization: Framework and Application #3178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| from isaaclab.ui.xr_widgets import XRVisualization, TriggerType, VisualizationManager, DataCollector,update_instruction | ||
| from pxr import Gf | ||
|
|
||
| def _sample_handle_ik_error(self, mgr: VisualizationManager, data_collector: DataCollector) -> None: | ||
| """Handle IK error events by displaying an error message widget. | ||
|
|
||
| Args: | ||
| data_collector: DataCollector instance (unused in this handler) | ||
| """ | ||
|
|
||
| self.display_widget("IK Error Detected", "/ik_error", VisualizationManager.message_widget_preset() | {"text_color": self._error_text_color}) | ||
|
|
||
| def _sample_update_error_text_color(self, mgr: VisualizationManager, data_collector: DataCollector) -> None: | ||
| self._error_text_color = self._error_text_color + 0x100 | ||
| if self._error_text_color >= 0xFFFFFFFF: | ||
| self._error_text_color = 0xFF0000FF | ||
|
|
||
| def _sample_update_left_panel(self, mgr, data_collector) -> None: | ||
| """Update the left panel with current data and update counter. | ||
|
|
||
| Args: | ||
| data_collector: DataCollector instance containing current data | ||
| """ | ||
| left_panel_id = getattr(self, '_left_panel_id', None) | ||
| if left_panel_id is not None: | ||
| content = f"{mgr._left_panel_updated_times}\n{data_collector.make_panel_content()}" | ||
| update_instruction(left_panel_id, content) | ||
| mgr._left_panel_updated_times += 1 | ||
|
|
||
| def _sample_update_right_panel(self, mgr, data_collector) -> None: | ||
| """Update the right panel with current data and update counter. | ||
|
|
||
| Args: | ||
| data_collector: DataCollector instance containing current data | ||
| """ | ||
| right_panel_id = getattr(self, '_right_panel_id', None) | ||
| if right_panel_id is not None: | ||
| content = f"{mgr._right_panel_updated_times}\n{data_collector.make_panel_content()}" | ||
| update_instruction(right_panel_id, content) | ||
| mgr._right_panel_updated_times += 1 | ||
|
|
||
| def apply_sample_visualization(): | ||
| # Error Message | ||
| XRVisualization.register_callback(TriggerType.TRIGGER_ON_EVENT, {"event_name": "ik_error"}, _sample_handle_ik_error) | ||
|
|
||
| # Display a panel on the left to display DataCollector data | ||
| # Refresh periodically | ||
| # Todo: use a better way to add '/' to pathname | ||
| XRVisualization.set_attrs({ | ||
| "left_panel_id": "/left_panel", | ||
| "left_panel_translation": Gf.Vec3f(-2, 2.6, 2), | ||
| "left_panel_updated_times": 0, | ||
| "right_panel_updated_times": 0, | ||
| }) | ||
| XRVisualization.register_callback(TriggerType.TRIGGER_ON_PERIOD, {"period": 1.0}, _sample_update_left_panel) | ||
|
|
||
| # Display a panel on the right to display DataCollector data | ||
| # Refresh when data changes | ||
| XRVisualization.set_attrs({ | ||
| "right_panel_id": "/right_panel", | ||
| "right_panel_translation": Gf.Vec3f(1.5, 2, 2), | ||
| }) | ||
| XRVisualization.register_callback(TriggerType.TRIGGER_ON_EVENT, {"event_name": "default_event_has_change"}, _sample_update_right_panel) | ||
|
|
||
| # Change error text color every second | ||
| XRVisualization.set_attrs({ | ||
| "error_text_color": 0xFF0000FF, | ||
| }) | ||
| XRVisualization.register_callback(TriggerType.TRIGGER_ON_UPDATE, {}, _sample_update_error_text_color) | ||
|
|
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,7 +17,7 @@ | |
|
|
||
| from isaaclab.managers import CommandManager, CurriculumManager, RewardManager, TerminationManager | ||
| from isaaclab.ui.widgets import ManagerLiveVisualizer | ||
|
|
||
| from isaaclab.ui.xr_widgets import XRVisualization | ||
| from .common import VecEnvStepReturn | ||
| from .manager_based_env import ManagerBasedEnv | ||
| from .manager_based_rl_env_cfg import ManagerBasedRLEnvCfg | ||
|
|
@@ -196,6 +196,14 @@ def step(self, action: torch.Tensor) -> VecEnvStepReturn: | |
| # update buffers at sim dt | ||
| self.scene.update(dt=self.physics_dt) | ||
|
|
||
| # Todo: torque limit doesn't need updating every frame | ||
| # get joint torque limits | ||
| joints_torque_limit = self.scene["robot"].data.joint_effort_limits[0] | ||
| # get joint torque | ||
| joints_torque = self.scene["robot"].data.applied_torque[0] | ||
| joints_name = self.scene["robot"].data.joint_names | ||
| XRVisualization.push_data({"joints_torque": joints_torque, "joints_torque_limit": joints_torque_limit, "joints_name": joints_name}) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not the right place to put this I think. We only care about this for imitation learning but this is a base class specifically for RL tasks. |
||
|
|
||
| # post-step: | ||
| # -- update env counters (used for curriculum generation) | ||
| self.episode_length_buf += 1 # step in current episode (per env) | ||
|
|
||
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we not get this from the
hand_joint_namesin theGR1T2RetargeterCfg?