From 25dfd018210972ab5c777bba5b93a2a4120b468a Mon Sep 17 00:00:00 2001 From: Kavi Dey Date: Mon, 27 Jun 2022 13:05:16 -0700 Subject: [PATCH] improve gripper visualization --- .../heuristic_grasp_server.py | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/grasp_generation/aurmr_web_interface/heuristic_grasp_server.py b/grasp_generation/aurmr_web_interface/heuristic_grasp_server.py index 4008cd8..966b775 100755 --- a/grasp_generation/aurmr_web_interface/heuristic_grasp_server.py +++ b/grasp_generation/aurmr_web_interface/heuristic_grasp_server.py @@ -167,27 +167,24 @@ def viz_convex_hull(updated_pcd): response.grasp.pose.position = p.pose.position response.grasp.pose.orientation = p.pose.orientation + gripper_thickness = 0.02 + gripper_depth = 0.05 + gripper_width = object_width + gripper_thickness + 0.02 + gripper_mesh = o3d.geometry.TriangleMesh() - gripper_mesh += o3d.geometry.TriangleMesh.create_box(width=5, height=1, depth=1) - gripper_mesh += o3d.geometry.TriangleMesh.create_box(width=1, height=1, depth=5).translate( - (0, 0, -5) + gripper_mesh += o3d.geometry.TriangleMesh.create_box(width=gripper_width, height=gripper_thickness, depth=gripper_thickness) + gripper_mesh += o3d.geometry.TriangleMesh.create_box(width=gripper_thickness, height=gripper_thickness, depth=gripper_depth).translate( + (0, 0, -gripper_depth) ) - gripper_mesh += o3d.geometry.TriangleMesh.create_box(width=1, height=1, depth=5).translate( - (5, 0, -5) + gripper_mesh += o3d.geometry.TriangleMesh.create_box(width=gripper_thickness, height=gripper_thickness, depth=gripper_depth).translate( + (gripper_width, 0, -gripper_depth) ) - gripper_mesh = gripper_mesh.scale(0.02, gripper_mesh.get_center()) + # gripper_mesh = gripper_mesh.scale(0.02, gripper_mesh.get_center()) gripper_mesh.compute_vertex_normals() trans = gripper_mesh.translate( [object_center[0], object_center[1], object_center[2] - 0.075], relative=False ) - # trans = gripper.rotate( - # Rotation.from_euler("xyz", [0, 0, req.se2.theta]).as_matrix(), - # trans.get_center(), - # ) - # trans = trans.rotate( - # trans.get_rotation_matrix_from_xyz((0, 0, req.se2.theta)), trans.get_center() - # ) trans = trans.rotate(pcd_bbox.R, trans.get_center()) gripper_viz.vertices = trans.vertices