Isaac Sim 4.0 support, Kinematics API doc, Windows support

This commit is contained in:
Balakumar Sundaralingam
2024-07-20 14:51:43 -07:00
parent 2ae381f328
commit 3690d28c54
83 changed files with 2818 additions and 497 deletions

View File

@@ -544,6 +544,7 @@ class UsdHelper:
def get_prim_from_obstacle(
self, obstacle: Obstacle, base_frame: str = "/world/obstacles", timestep=None
):
if isinstance(obstacle, Cuboid):
return self.add_cuboid_to_stage(obstacle, base_frame, timestep=timestep)
elif isinstance(obstacle, Mesh):
@@ -813,6 +814,8 @@ class UsdHelper:
visualize_robot_spheres: bool = True,
robot_color: Optional[List[float]] = None,
flatten_usd: bool = False,
goal_pose: Optional[Pose] = None,
goal_color: Optional[List[float]] = None,
):
if kin_model is None:
config_file = load_yaml(join_path(get_robot_configs_path(), robot_model_file))
@@ -829,6 +832,25 @@ class UsdHelper:
if robot_color is not None:
robot_mesh_model.add_color(robot_color)
robot_mesh_model.add_material(Material(metallic=0.4))
if goal_pose is not None:
kin_model.link_names
if kin_model.ee_link in kin_model.kinematics_config.mesh_link_names:
index = kin_model.kinematics_config.mesh_link_names.index(kin_model.ee_link)
gripper_mesh = m[index]
if len(goal_pose.shape) == 1:
goal_pose = goal_pose.unsqueeze(0)
if len(goal_pose.shape) == 2:
goal_pose = goal_pose.unsqueeze(0)
for i in range(goal_pose.n_goalset):
g = goal_pose.get_index(0, i).to_list()
world_model.add_obstacle(
Mesh(
file_path=gripper_mesh.file_path,
pose=g,
name="goal_idx_" + str(i),
color=goal_color,
)
)
usd_helper = UsdHelper()
usd_helper.create_stage(
save_path,
@@ -905,6 +927,8 @@ class UsdHelper:
robot_asset_prim_path=None,
robot_color: Optional[List[float]] = None,
flatten_usd: bool = False,
goal_pose: Optional[Pose] = None,
goal_color: Optional[List[float]] = None,
):
usd_exists = False
# if usd file doesn't exist, fall back to urdf animation script
@@ -915,10 +939,13 @@ class UsdHelper:
robot_model_file = robot_model_file["robot_cfg"]
robot_model_file["kinematics"]["load_link_names_with_mesh"] = True
robot_model_file["kinematics"]["use_usd_kinematics"] = True
if "usd_path" in robot_model_file["kinematics"]:
usd_exists = file_exists(
join_path(get_assets_path(), robot_model_file["kinematics"]["usd_path"])
)
usd_exists = file_exists(
join_path(get_assets_path(), robot_model_file["kinematics"]["usd_path"])
)
else:
usd_exists = False
else:
if kin_model.generator_config.usd_path is not None:
usd_exists = file_exists(kin_model.generator_config.usd_path)
@@ -946,6 +973,8 @@ class UsdHelper:
visualize_robot_spheres=visualize_robot_spheres,
robot_color=robot_color,
flatten_usd=flatten_usd,
goal_pose=goal_pose,
goal_color=goal_color,
)
if kin_model is None:
robot_cfg = CudaRobotModelConfig.from_data_dict(