-
Notifications
You must be signed in to change notification settings - Fork 5
Adds new new affordance: placeable and new atomic task: place upright #293
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
Conversation
… task, and an example of agibot_tabletop_place_upright_mug env
…m_mode property, which is not a standard scene instance - refactors placeable's query function
f89632f to
0d67164
Compare
| orientation_threshold, device=object_quat.device, dtype=object_quat.dtype | ||
| ) | ||
|
|
||
| success = angle_error < orientation_threshold_tensor |
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.
nice
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.
yea this is cool!
- registers retargeter for place_upright_task - updates background initial_pose and scale
alexmillane
left a comment
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.
Thanks for adding this. Look good to me!
I have a few comments. Feel free to merge once you have addressed them.
| - The orientation threshold is the threshold for the angle between the upright axis and the world +Z direction. | ||
| """ | ||
|
|
||
| def __init__(self, upright_axis_name: Literal["x", "y", "z"] = "z", orientation_threshold: float = 0.5, **kwargs): |
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.
suggestion to add a unit to orientation_threshold. For example orientation_threshold_deg (if indeed the unit here is degrees.
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.
thanks Alex, here is radians actually, and I will revise the default value to math.pi / 18.0 to indict that this is in radians, and adds the unit is radians in the comments of this method.
| orientation_threshold, device=object_quat.device, dtype=object_quat.dtype | ||
| ) | ||
|
|
||
| success = angle_error < orientation_threshold_tensor |
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.
yea this is cool!
| """Place the object upright (in all the environments). | ||
| This function places the object upright by rotating its upright axis towards the world +Z direction. | ||
| The upright percentage is a value in [0, 1] that describes the absolute target angle between the upright axis and the world +Z direction: | ||
| 0.0 results in a perpendicular orientation (90 degrees) and 1.0 fully aligns the axis with +Z (0 degrees). | ||
| """ |
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.
In the case of upright_percentage = 0.0 which world axis does the object's upright axis point along?
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.
upright_percentage = 0.0: the target upright axis is perpendicular to world +Z (90°), and the direction with the smallest angle to the object_upright_axis, in the plane spanned by the object_upright_axis and world +Z.
| def _compute_target_quaternions( | ||
| object_quat: torch.Tensor, | ||
| upright_percentage: float | torch.Tensor, | ||
| upright_axis_name: str, | ||
| ) -> torch.Tensor: |
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.
Suggestion to add a docstring.
What's the expected shape of upright_percentage if it's a tensor? I would guess: [num_envs, 1]?
| axis_index = {"x": 0, "y": 1, "z": 2}[upright_axis_name] | ||
| rotation_mats = math_utils.matrix_from_quat(object_quat) | ||
| current_axis = rotation_mats[:, :, axis_index] |
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.
This code is repeated from above. Suggestion to move to a function
def get_object_axis_in_world_frame(object_quat: torch.tensor) -> torch.tensor:
axis_index = {"x": 0, "y": 1, "z": 2}[upright_axis_name]
rotation_mats = math_utils.matrix_from_quat(object_quat)
current_axis = rotation_mats[:, :, axis_index]
return current_axis
| if __name__ == "__main__": | ||
| # test_place_upright_mug_single() | ||
| test_place_upright_mug_multi() | ||
| # test_place_upright_mug_condition() |
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.
Thanks for adding these tests!
Suggestion to uncommen the lines here.
| randomize_mug_positions = EventTerm( | ||
| func=randomize_object_pose, | ||
| mode="reset", | ||
| params={ | ||
| "pose_range": { | ||
| "x": (-0.05, 0.2), | ||
| "y": (-0.10, 0.10), | ||
| "z": (0.75, 0.75), | ||
| "roll": (-1.57, -1.57), | ||
| "yaw": (-0.57, 0.57), | ||
| }, | ||
| "asset_cfgs": [SceneEntityCfg("mug")], | ||
| }, | ||
| ) |
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.
@viiik-inside I feel like we need to add an option to our objects to add randomness to the poses on reset. I've now seen this pattern in a few MRs where people are overriding the EventCfg coming from the task. This kind of breaks our design. Maybe we could expand our definition of setting an objects pose to take either a Pose or a PoseRange such that object.set_initial_pose(Pose | PoseRange). In the case of a pose range, it would an event to the Cfg.
## Summary We allow addings spawn_cfg_addon and asset_cfg_addon. This exposes and gives possiblitly for a user to create any supported assets with various settings.
- TODO: find why long steps cause the object behavior not stable
Summary
Adds new new affordance: placeable and new atomic task: place upright task
Detailed description
Test Pipeline
Zero Action Policy:
python isaaclab_arena/examples/policy_runner.py --policy_type zero_action tabletop_place_upright --object mugRecord demos:
python isaaclab_arena/scripts/imitation_learning/record_demos.py --dataset_file datasets/dataset_agibot_left_arm_rel.hdf5 --num_demos 1 tabletop_place_upright --teleop_device keyboardReplay demos:
python isaaclab_arena/scripts/imitation_learning/replay_demos.py --dataset_file datasets/dataset_agibot_left_arm_rel.hdf5 tabletop_place_uprightTest place_upright_mug task:
pytest isaaclab_arena/tests/test_place_upright_mug.py