Datasets:
Commit
·
6987523
1
Parent(s):
c3e9b24
Rename robot grippers
Browse files- scripts/meshcat_utils.py +11 -11
- scripts/visualize_dataset.py +3 -3
scripts/meshcat_utils.py
CHANGED
|
@@ -45,17 +45,17 @@ control_points_suction = np.array([
|
|
| 45 |
])
|
| 46 |
|
| 47 |
control_points_data = {
|
| 48 |
-
"
|
| 49 |
-
"
|
| 50 |
-
"
|
| 51 |
}
|
| 52 |
|
| 53 |
-
def get_gripper_control_points(gripper_name: str = '
|
| 54 |
"""
|
| 55 |
Get the control points for a specific gripper.
|
| 56 |
|
| 57 |
Args:
|
| 58 |
-
gripper_name (str): Name of the gripper ("
|
| 59 |
|
| 60 |
Returns:
|
| 61 |
np.ndarray: Array of control points for the specified gripper
|
|
@@ -74,7 +74,7 @@ def get_gripper_depth(gripper_name: str) -> float:
|
|
| 74 |
Get the depth parameter for a specific gripper type.
|
| 75 |
|
| 76 |
Args:
|
| 77 |
-
gripper_name (str): Name of the gripper ("
|
| 78 |
|
| 79 |
Returns:
|
| 80 |
float: Depth parameter for the specified gripper
|
|
@@ -84,7 +84,7 @@ def get_gripper_depth(gripper_name: str) -> float:
|
|
| 84 |
"""
|
| 85 |
# TODO: Use register module. Don't have this if-else name lookup
|
| 86 |
pts, d = None, None
|
| 87 |
-
if gripper_name in ["
|
| 88 |
pts = get_gripper_control_points(gripper_name)
|
| 89 |
elif gripper_name == "suction":
|
| 90 |
return 0.069
|
|
@@ -141,12 +141,12 @@ def generate_circle_points(center: List[float], radius: float = 0.007, N: int =
|
|
| 141 |
return points
|
| 142 |
|
| 143 |
|
| 144 |
-
def get_gripper_visualization_control_points(gripper_name: str = '
|
| 145 |
"""
|
| 146 |
Get control points for visualizing a specific gripper type.
|
| 147 |
|
| 148 |
Args:
|
| 149 |
-
gripper_name (str): Name of the gripper ("
|
| 150 |
|
| 151 |
Returns:
|
| 152 |
List[np.ndarray]: List of control point arrays for gripper visualization
|
|
@@ -314,7 +314,7 @@ def visualize_pointcloud(
|
|
| 314 |
vis[name].set_transform(transform)
|
| 315 |
|
| 316 |
|
| 317 |
-
def load_visualization_gripper_points(gripper_name: str = "
|
| 318 |
"""
|
| 319 |
Load control points for gripper visualization.
|
| 320 |
|
|
@@ -339,7 +339,7 @@ def visualize_grasp(
|
|
| 339 |
name: str,
|
| 340 |
transform: np.ndarray,
|
| 341 |
color: List[int] = [255, 0, 0],
|
| 342 |
-
gripper_name: str = "
|
| 343 |
**kwargs: Any
|
| 344 |
) -> None:
|
| 345 |
"""
|
|
|
|
| 45 |
])
|
| 46 |
|
| 47 |
control_points_data = {
|
| 48 |
+
"franka_panda": control_points_franka,
|
| 49 |
+
"robotiq_2f_140": control_points_robotiq2f140,
|
| 50 |
+
"single_suction_cup_30mm": control_points_suction,
|
| 51 |
}
|
| 52 |
|
| 53 |
+
def get_gripper_control_points(gripper_name: str = 'franka_panda') -> np.ndarray:
|
| 54 |
"""
|
| 55 |
Get the control points for a specific gripper.
|
| 56 |
|
| 57 |
Args:
|
| 58 |
+
gripper_name (str): Name of the gripper ("franka_panda", "robotiq_2f_140", "single_suction_cup_30mm")
|
| 59 |
|
| 60 |
Returns:
|
| 61 |
np.ndarray: Array of control points for the specified gripper
|
|
|
|
| 74 |
Get the depth parameter for a specific gripper type.
|
| 75 |
|
| 76 |
Args:
|
| 77 |
+
gripper_name (str): Name of the gripper ("franka_panda", "robotiq_2f_140", "single_suction_cup_30mm")
|
| 78 |
|
| 79 |
Returns:
|
| 80 |
float: Depth parameter for the specified gripper
|
|
|
|
| 84 |
"""
|
| 85 |
# TODO: Use register module. Don't have this if-else name lookup
|
| 86 |
pts, d = None, None
|
| 87 |
+
if gripper_name in ["franka_panda", "robotiq2f140"]:
|
| 88 |
pts = get_gripper_control_points(gripper_name)
|
| 89 |
elif gripper_name == "suction":
|
| 90 |
return 0.069
|
|
|
|
| 141 |
return points
|
| 142 |
|
| 143 |
|
| 144 |
+
def get_gripper_visualization_control_points(gripper_name: str = 'franka_panda') -> List[np.ndarray]:
|
| 145 |
"""
|
| 146 |
Get control points for visualizing a specific gripper type.
|
| 147 |
|
| 148 |
Args:
|
| 149 |
+
gripper_name (str): Name of the gripper ("franka_panda", "robotiq_2f_140", "single_suction_cup_30mm")
|
| 150 |
|
| 151 |
Returns:
|
| 152 |
List[np.ndarray]: List of control point arrays for gripper visualization
|
|
|
|
| 314 |
vis[name].set_transform(transform)
|
| 315 |
|
| 316 |
|
| 317 |
+
def load_visualization_gripper_points(gripper_name: str = "franka_panda") -> List[np.ndarray]:
|
| 318 |
"""
|
| 319 |
Load control points for gripper visualization.
|
| 320 |
|
|
|
|
| 339 |
name: str,
|
| 340 |
transform: np.ndarray,
|
| 341 |
color: List[int] = [255, 0, 0],
|
| 342 |
+
gripper_name: str = "franka_panda",
|
| 343 |
**kwargs: Any
|
| 344 |
) -> None:
|
| 345 |
"""
|
scripts/visualize_dataset.py
CHANGED
|
@@ -40,7 +40,7 @@ from dataset import GraspWebDatasetReader, load_uuid_list
|
|
| 40 |
def visualize_mesh_with_grasps(
|
| 41 |
mesh_path: str,
|
| 42 |
mesh_scale: float,
|
| 43 |
-
gripper_name: str = "
|
| 44 |
grasps: list[np.ndarray] = None,
|
| 45 |
color: list = [192, 192, 192],
|
| 46 |
transform: np.ndarray = None,
|
|
@@ -52,7 +52,7 @@ def visualize_mesh_with_grasps(
|
|
| 52 |
Args:
|
| 53 |
mesh_path (str): Path to the mesh file
|
| 54 |
mesh_scale (float): Scale factor for the mesh
|
| 55 |
-
gripper_name (str): Name of the gripper to visualize ("
|
| 56 |
grasps (list[np.ndarray], optional): List of 4x4 grasp transforms
|
| 57 |
color (list, optional): RGB color for the mesh. Defaults to gray if None
|
| 58 |
transform (np.ndarray, optional): 4x4 transform matrix for the mesh. Defaults to identity if None
|
|
@@ -103,7 +103,7 @@ def parse_args():
|
|
| 103 |
parser.add_argument("--uuid_list", type=str, help="Path to UUID list", default=None)
|
| 104 |
parser.add_argument("--uuid_object_paths_file", type=str, help="Path to JSON file, mapping UUID to absolute path of the mesh file", default=None)
|
| 105 |
parser.add_argument("--object_file", type=str, help="This has to be a .stl or .obj or .glb file", default=None)
|
| 106 |
-
parser.add_argument("--gripper_name", type=str, required=True, help="Specify the gripper name", choices=["
|
| 107 |
parser.add_argument("--max_grasps_to_visualize", type=int, help="The max number of grasps to visualize", default=20)
|
| 108 |
return parser.parse_args()
|
| 109 |
|
|
|
|
| 40 |
def visualize_mesh_with_grasps(
|
| 41 |
mesh_path: str,
|
| 42 |
mesh_scale: float,
|
| 43 |
+
gripper_name: str = "franka_panda",
|
| 44 |
grasps: list[np.ndarray] = None,
|
| 45 |
color: list = [192, 192, 192],
|
| 46 |
transform: np.ndarray = None,
|
|
|
|
| 52 |
Args:
|
| 53 |
mesh_path (str): Path to the mesh file
|
| 54 |
mesh_scale (float): Scale factor for the mesh
|
| 55 |
+
gripper_name (str): Name of the gripper to visualize ("franka_panda", "suction", etc.)
|
| 56 |
grasps (list[np.ndarray], optional): List of 4x4 grasp transforms
|
| 57 |
color (list, optional): RGB color for the mesh. Defaults to gray if None
|
| 58 |
transform (np.ndarray, optional): 4x4 transform matrix for the mesh. Defaults to identity if None
|
|
|
|
| 103 |
parser.add_argument("--uuid_list", type=str, help="Path to UUID list", default=None)
|
| 104 |
parser.add_argument("--uuid_object_paths_file", type=str, help="Path to JSON file, mapping UUID to absolute path of the mesh file", default=None)
|
| 105 |
parser.add_argument("--object_file", type=str, help="This has to be a .stl or .obj or .glb file", default=None)
|
| 106 |
+
parser.add_argument("--gripper_name", type=str, required=True, help="Specify the gripper name", choices=["franka_panda", "single_suction_cup_30mm", "robotiq_2f_140"])
|
| 107 |
parser.add_argument("--max_grasps_to_visualize", type=int, help="The max number of grasps to visualize", default=20)
|
| 108 |
return parser.parse_args()
|
| 109 |
|