Skillgen demo#4
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request appears to be a demonstration or experimental implementation for "Skillgen" that adds support for a vial insertion task with various backup controllers and recovery mechanisms. The PR introduces new environment configurations, modifies termination and observation logic, adds ensemble training capabilities, and implements state machine-based backup controllers for safe robot manipulation.
Changes:
- Adds new environment registration "Dev-IK-Rel-Insert-v1" for top-down vial insertion task
- Implements backup controller state machines for insert operations with recovery logic
- Updates training configurations and uncertainty-based switching parameters
- Adds LaTeX documentation for the switching logic algorithm
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 23 comments.
Show a summary per file
| File | Description |
|---|---|
| terminations.py | Modified termination conditions for object insertion with updated thresholds and added debug prints |
| observations.py (tasks) | Added debug print statements to observation functions |
| dev_ik_rel_vial_insert_top_down.py | New configuration file for top-down vial insertion task |
| dev_ik_rel_vial_insert.py | Updated termination parameters for success criteria |
| bc_rnn_low_dim.json | Modified WandB project name and increased training epochs |
| init.py | Registered new "Dev-IK-Rel-Insert-v1" environment |
| generation.py | Changed log file mode from append to write |
| observations.py (isaaclab) | Added debug print for joint positions |
| train_ensemble.py | Updated hard-coded data paths and bootstrap sampling percentage |
| switching_logic_algorithm.tex | New LaTeX documentation for uncertainty-based switching logic |
| play_with_backup.py | Changed backup controller task type to "insert" |
| play_ensemble_v05.py | Enabled recovery mode and updated uncertainty parameters for vial insertion |
| play_controller.py | Switched to BackupControllerInsertSM |
| backup_controller_insert_top.py | New state machine controller implementation for top-down insertion |
| backup_controller_insert.py | Extensive updates to state machine logic with rotation checking and new UNGRASP state |
| backup_controller_handler.py | Added "insert_top" task type support with duplicate import |
| run_experiments.sh | Updated experiment configuration for insert task |
| config.json | New training configuration file |
| find_best_checkpoints.py | Changed to absolute Docker path |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| height_dist = torch.linalg.vector_norm(pos_diff[:, 2:], dim=1) | ||
| xy_dist = torch.linalg.vector_norm(pos_diff[:, :2], dim=1) | ||
| #print(f"For DEBUG : xy_dist : {xy_dist}, height_dist : {height_dist}") | ||
| # print(f"For DEBUG : xy_dist : {xy_dist}, height_dist : {height_dist}") |
There was a problem hiding this comment.
Inconsistent indentation. The comment on line 164 has incorrect indentation (3 spaces instead of 4), which violates Python's PEP 8 style guidelines.
| #print(f"For DEBUG : STACKED STATUS : {stacked}") | ||
| stacked_upright = stacked & upright_good | ||
| #print(f"For DEBUG : STACKED STATUS : {stacked_upright}, {stacked}, {upright_good} ") |
There was a problem hiding this comment.
Inconsistent indentation. The comment on line 191 has incorrect indentation (3 spaces instead of 4), which violates Python's PEP 8 style guidelines.
| #print(f"For DEBUG : STACKED STATUS : {stacked}") | |
| stacked_upright = stacked & upright_good | |
| #print(f"For DEBUG : STACKED STATUS : {stacked_upright}, {stacked}, {upright_good} ") | |
| # print(f"For DEBUG : STACKED STATUS : {stacked}") | |
| stacked_upright = stacked & upright_good | |
| # print(f"For DEBUG : STACKED STATUS : {stacked_upright}, {stacked}, {upright_good} ") |
| robot.data.root_state_w[:, :3], robot.data.root_state_w[:, 3:7], object_pos_w | ||
| ) | ||
|
|
||
| #print(f"object position : {object_pos_b}") |
There was a problem hiding this comment.
Inconsistent indentation. The comment on line 37 has incorrect indentation (3 spaces instead of 4), which violates Python's PEP 8 style guidelines.
| #print(f"object position : {object_pos_b}") | |
| # print(f"object position : {object_pos_b}") |
| ) | ||
| dot = wp.min(dot, float(1.0)) | ||
| angle = float(2.0) * wp.acos(dot) | ||
| # print(f"angle : {angle}, threshold : {threshold_rad}") |
There was a problem hiding this comment.
Inconsistent indentation. The comment on line 60 has incorrect indentation (3 spaces instead of 4), which violates Python's PEP 8 style guidelines.
| # print(f"angle : {angle}, threshold : {threshold_rad}") | |
| # print(f"angle : {angle}, threshold : {threshold_rad}") |
| robot: Articulation = env.scene[robot_cfg.name] | ||
| upper: RigidObject = env.scene[upper_object_cfg.name] | ||
| tilt_deg = upright_tilt_deg(upper.data.root_quat_w, upper.data.default_root_state[:, 3:7]) | ||
| print(f"Tilt deg: {tilt_deg}") |
There was a problem hiding this comment.
This print statement should be removed before merging to production. Debug print statements left in production code can clutter logs and impact performance.
| print(f"Tilt deg: {tilt_deg}") |
| self.observations.subtask_terms.appr_goal=ObsTerm(func=mdp.is_object_lifted, params={"threshold":0.15} | ||
|
|
||
| ) |
There was a problem hiding this comment.
Missing closing parenthesis. The ObsTerm function call on line 112 is not properly closed, which will cause a syntax error.
| self.observations.subtask_terms.appr_goal=ObsTerm(func=mdp.is_object_lifted, params={"threshold":0.15} | |
| ) | |
| self.observations.subtask_terms.appr_goal = ObsTerm( | |
| func=mdp.is_object_lifted, | |
| params={"threshold": 0.15}, | |
| ) |
| # self.scene.robot = FRANKA_PANDA_HIGH_PD_CFG.replace( | ||
| # prim_path="{ENV_REGEX_NS}/Robot", | ||
| # init_state=ArticulationCfg.InitialStateCfg( | ||
| # joint_pos={ | ||
|
|
||
| # "panda_joint1": 0.3281, | ||
| # "panda_joint2": -0.3684, | ||
| # "panda_joint3": -0.2787, | ||
| # "panda_joint4": -2.6138, | ||
| # "panda_joint5": -2.7527, | ||
| # "panda_joint6": 2.4991, # +90° → keeps hand level | ||
| # "panda_joint7": 0.3331, | ||
| # "panda_finger_joint1": 0.04, # open gripper | ||
| # "panda_finger_joint2": 0.04, | ||
| # } | ||
| # ), | ||
| # ) |
There was a problem hiding this comment.
Large blocks of commented-out code (lines 81-97) reduce code readability and maintainability. If this code is no longer needed, it should be removed. If it might be useful in the future, consider documenting why it's kept or moving it to version control history.
| # self.scene.robot = FRANKA_PANDA_HIGH_PD_CFG.replace( | |
| # prim_path="{ENV_REGEX_NS}/Robot", | |
| # init_state=ArticulationCfg.InitialStateCfg( | |
| # joint_pos={ | |
| # "panda_joint1": 0.3281, | |
| # "panda_joint2": -0.3684, | |
| # "panda_joint3": -0.2787, | |
| # "panda_joint4": -2.6138, | |
| # "panda_joint5": -2.7527, | |
| # "panda_joint6": 2.4991, # +90° → keeps hand level | |
| # "panda_joint7": 0.3331, | |
| # "panda_finger_joint1": 0.04, # open gripper | |
| # "panda_finger_joint2": 0.04, | |
| # } | |
| # ), | |
| # ) |
| ) | ||
| dot = wp.min(dot, float(1.0)) | ||
| angle = float(2.0) * wp.acos(dot) | ||
| # print(f"angle : {angle}, threshold : {threshold_rad}") |
There was a problem hiding this comment.
Inconsistent indentation. The comment on line 60 has incorrect indentation (3 spaces instead of 4), which violates Python's PEP 8 style guidelines.
| # print(f"angle : {angle}, threshold : {threshold_rad}") | |
| # print(f"angle : {angle}, threshold : {threshold_rad}") |
| #print(f"rpy version :{torch.cat([rest_pos,roll.unsqueeze(0), pitch.unsqueeze(0), yaw.unsqueeze(0)], dim =-1)}") | ||
| if self.tasktype == "insert_top": | ||
| rest_pos = torch.tensor([[ 0.6226, -0.0621, 0.3555]], device=self.device) | ||
| rest_rot = tensor([[ 0, 1, 0, 0]], device=self.device) |
There was a problem hiding this comment.
Missing import statement for 'tensor'. The code uses 'tensor' on line 105 but it's not imported. This should be 'torch.tensor' to avoid a NameError.
| rest_rot = tensor([[ 0, 1, 0, 0]], device=self.device) | |
| rest_rot = torch.tensor([[ 0, 1, 0, 0]], device=self.device) |
|
|
||
| def upright_tilt_deg(q_cur, q_init) -> torch.Tensor: | ||
| u_cur, u_init = matrix_from_quat(q_cur)[:, :, 2], matrix_from_quat(q_init)[:, :, 2] | ||
| # print(f"upright good {torch.rad2deg(torch.acos((u_cur * u_init).sum(-1).clamp(-1.0, 1.0)))}") |
There was a problem hiding this comment.
Inconsistent indentation. The comment on line 147 has incorrect indentation (3 spaces instead of 4), which violates Python's PEP 8 style guidelines. This should be aligned with the rest of the function body.
| # print(f"upright good {torch.rad2deg(torch.acos((u_cur * u_init).sum(-1).clamp(-1.0, 1.0)))}") | |
| # print(f"upright good {torch.rad2deg(torch.acos((u_cur * u_init).sum(-1).clamp(-1.0, 1.0)))}") |
Description
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.
List any dependencies that are required for this change.
Fixes # (issue)
Type of change
Screenshots
Please attach before and after screenshots of the change if applicable.
Checklist
pre-commitchecks with./isaaclab.sh --formatconfig/extension.tomlfileCONTRIBUTORS.mdor my name already exists there