Skip to content
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

[DO NOT MERGE] mimicgen #1044

Closed
wants to merge 43 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
9fd9caf
add option to replay actions (rather than states) for DataPlaybackWra…
ChengshuLi Sep 3, 2024
7c42a79
initial integration of mimicgen and b1k
ChengshuLi Sep 7, 2024
004bf30
Merge branch 'og-develop' into b1k-mimicgen
ChengshuLi Sep 19, 2024
1dd4272
proper shutdown after data collection
ChengshuLi Sep 19, 2024
295ad82
unify scale format when loading robots
ChengshuLi Sep 19, 2024
1d799b4
streamlime setup_scene process
ChengshuLi Sep 19, 2024
6b6e958
add test_cabinet.hdf5
ChengshuLi Sep 19, 2024
3123d1d
Remove OMPL and robot copy from primitives
hang-yin Nov 4, 2024
f94c760
Merge branch 'feat/curobo-improved' of https://github.com/StanfordVL/…
hang-yin Nov 5, 2024
5871adc
Refactor action primitives and replace OMPL with curobo for manipulation
hang-yin Nov 5, 2024
f902e86
Minor primitives refactoring
hang-yin Nov 6, 2024
8f73b6f
Completely remove OMPL planning context from action primitives plus r…
hang-yin Nov 6, 2024
ee0f8f6
Merge branch 'feat/curobo-improved' into feat/curobo-primitives
hang-yin Nov 6, 2024
5740749
Merge branch 'feat/curobo-improved' of https://github.com/StanfordVL/…
hang-yin Nov 6, 2024
519f5e5
Fix grasp pose bug
hang-yin Nov 8, 2024
0fbefe7
Primitives & curobo bug fixes - grasp mostly working
hang-yin Nov 8, 2024
749d2cf
Refactor primitives and get grasp working
hang-yin Nov 8, 2024
9f0e101
Merge branch 'feat/curobo-improved' of https://github.com/StanfordVL/…
hang-yin Nov 8, 2024
c06029c
Make primitives more robust and fast; add debug marker
hang-yin Nov 11, 2024
ced8693
Merge branch 'feat/curobo-improved' of https://github.com/StanfordVL/…
hang-yin Nov 11, 2024
c1b4986
Adapt curobo primitives to Tiago; call curobo planning and collision …
hang-yin Nov 12, 2024
863f3b6
Merge branch 'feat/curobo-improved' of https://github.com/StanfordVL/…
hang-yin Nov 12, 2024
671db19
Tune batch size to avoid gpu memory error
hang-yin Nov 12, 2024
b3fd62b
Add integral term to joint controller
hang-yin Nov 12, 2024
81647d3
Move hand upwards by a little after grasp to avoid getting stuck
hang-yin Nov 12, 2024
9e5c349
Merge branch 'feat/curobo-primitives' of https://github.com/StanfordV…
hang-yin Nov 12, 2024
071baa3
Add reset robot for arms and torso
hang-yin Nov 12, 2024
7ba8054
Fix head tracking
hang-yin Nov 13, 2024
6b8b670
Disable eef tracking by default; add low precision mode for motion pl…
hang-yin Nov 14, 2024
08e9b14
Merge branch 'feat/curobo-improved' of https://github.com/StanfordVL/…
hang-yin Nov 14, 2024
ec5d68b
Support for arm setting
hang-yin Nov 15, 2024
4466ee5
Robustify grasp primitive
hang-yin Nov 18, 2024
6e5682b
Add arm locking mode
hang-yin Nov 19, 2024
267fad0
Subsumed pull request #934
hang-yin Nov 19, 2024
90c3b0c
Merge branch 'feat/curobo-improved' of https://github.com/StanfordVL/…
hang-yin Nov 19, 2024
3615f24
Merge branch 'feat/curobo-improved' of https://github.com/StanfordVL/…
hang-yin Nov 19, 2024
bd6768a
Merge branch 'feat/curobo-improved' of https://github.com/StanfordVL/…
hang-yin Nov 20, 2024
b4c83c7
Make primitives faster and more robust
hang-yin Nov 21, 2024
2dfa062
Merge branch 'og-develop' into feat/curobo-primitives
hang-yin Nov 25, 2024
ba82cbb
merge og-deveop
mxu34 Nov 25, 2024
54eff77
Merge branch 'feat/curobo-primitives' of https://github.com/StanfordV…
mxu34 Nov 25, 2024
161766b
add script data collection
mxu34 Dec 3, 2024
6291691
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 7 additions & 13 deletions omnigibson/action_primitives/action_primitive_set_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,13 @@ def __init_subclass__(cls, **kwargs):
if not inspect.isabstract(cls):
REGISTERED_PRIMITIVE_SETS[cls.__name__] = cls

def __init__(self, env):
self.env = env
def __init__(self, robot):
self.robot = robot

@property
def robot(self):
# Currently returns the first robot in the environment, but can be scaled to multiple robots
# by creating multiple action generators and passing in a robot index etc.
return self.env.robots[0]

@abstractmethod
def get_action_space(self):
"""Get the higher-level action space as an OpenAI Gym Space object."""
pass
# @abstractmethod
# def get_action_space(self):
# """Get the higher-level action space as an OpenAI Gym Space object."""
# pass

@abstractmethod
def apply(self, action):
Expand All @@ -84,7 +78,7 @@ def apply(self, action):
pass

@abstractmethod
def apply_ref(self, action, *args):
def apply_ref(self, primitive, *args):
"""
Apply a primitive action by reference.

Expand Down
52 changes: 47 additions & 5 deletions omnigibson/action_primitives/curobo.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def __init__(
num_trajopt_seeds=4,
num_graph_seeds=4,
interpolation_dt=0.03,
collision_activation_distance=0.005,
collision_activation_distance=0.05,
self_collision_check=True,
maximum_trajectory_dt=None,
fixed_iters_trajopt=True,
Expand Down Expand Up @@ -336,6 +336,7 @@ def check_collisions(
self,
q,
check_self_collision=True,
skip_obstacle_update=False,
):
"""
Checks collisions between the sphere representation of the robot and the rest of the current scene
Expand All @@ -353,7 +354,8 @@ def check_collisions(
emb_sel = CuroboEmbodimentSelection.DEFAULT

# Update obstacles
self.update_obstacles()
if not skip_obstacle_update:
self.update_obstacles()

q_pos = self.robot.get_joint_positions().unsqueeze(0)
cu_joint_state = lazy.curobo.types.state.JointState(
Expand Down Expand Up @@ -428,7 +430,9 @@ def compute_trajectories(
return_full_result=False,
success_ratio=None,
attached_obj=None,
motion_constraint=None,
attached_obj_scale=None,
skip_obstacle_update=False,
emb_sel=CuroboEmbodimentSelection.DEFAULT,
):
"""
Expand Down Expand Up @@ -509,8 +513,16 @@ def compute_trajectories(
success_ratio=1.0 / self.batch_size if success_ratio is None else success_ratio,
)

# Refresh the collision state
self.update_obstacles()
# Add the pose cost metric
if motion_constraint is None:
motion_constraint = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
pose_cost_metric = lazy.curobo.wrap.reacher.motion_gen.PoseCostMetric(
hold_partial_pose=False, hold_vec_weight=self._tensor_args.to_device(motion_constraint)
)
plan_cfg.pose_cost_metric = pose_cost_metric

if not skip_obstacle_update:
self.update_obstacles()

for link_name in target_pos.keys():
target_pos_link = target_pos[link_name]
Expand Down Expand Up @@ -581,9 +593,12 @@ def compute_trajectories(
object_names=obj_paths,
ee_pose=ee_pose,
link_name=self.robot.curobo_attached_object_link_names[ee_link_name],
scale=0.99 if attached_obj_scale is None else attached_obj_scale[ee_link_name],
scale=1.0 if attached_obj_scale is None else attached_obj_scale[ee_link_name],
pitch_scale=1.0,
merge_meshes=True,
world_objects_pose_offset=lazy.curobo.types.math.Pose.from_list(
[0, 0, 0.01, 1, 0, 0, 0], self._tensor_args
),
)

all_rollout_fns = [
Expand Down Expand Up @@ -752,6 +767,33 @@ def convert_q_to_eef_traj(self, traj, return_axisangle=False, emb_sel=CuroboEmbo

return th.concatenate([positions, orientations], dim=-1)

def solve_ik(self, target_pos, target_quat, emb_sel=CuroboEmbodimentSelection.ARM):
# # If target_pos and target_quat are torch tensors, it's assumed that they correspond to the default ee_link
# if isinstance(target_pos, th.Tensor):
# target_pos = {self.ee_link[emb_sel]: target_pos}
# if isinstance(target_quat, th.Tensor):
# target_quat = {self.ee_link[emb_sel]: target_quat}

# # Refresh the collision state
# self.update_obstacles(ignore_paths=None, emb_sel=emb_sel)

# assert target_pos.keys() == target_quat.keys(), "Expected target_pos and target_quat to have the same keys!"

# # TODO: fill these in
# solve_state = self.mg[emb_sel]._get_solve_state(lazy.curobo.ReacherSolveType.GOALSET, plan_config, goal_pose, start_state)

# ik_result = self.mg[emb_sel]._solve_ik_from_solve_state(
# goal_pose=,
# solve_state=solve_state,
# start_state=,
# use_nn_seed=False,
# partial_ik_opt=False,
# link_poses=,
# )

# breakpoint()
return

@property
def tensor_args(self):
"""
Expand Down
Loading
Loading