visualization

Classes for visualizing grasps and 3D models, extending the Berkeley AUTOLAB visualization module.

class dexnet.visualization.DexNetVisualizer2D

Dex-Net extension of the base pyplot 2D visualization tools

static grasp(grasp, color=’r’, arrow_len=4, arrow_head_len=2, arrow_head_width=3, arrow_width=1, jaw_len=3, jaw_width=3.0, grasp_center_size=7.5, grasp_center_thickness=2.5, grasp_center_style=’+’, grasp_axis_width=1, grasp_axis_style=’–’, line_width=8.0, show_center=True, show_axis=False, scale=1.0)

Plots a 2D grasp with arrow and jaw style using matplotlib

Parameters:
  • grasp (Grasp2D) – 2D grasp to plot
  • color (str) – color of plotted grasp
  • arrow_len (float) – length of arrow body
  • arrow_head_len (float) – length of arrow head
  • arrow_head_width (float) – width of arrow head
  • arrow_width (float) – width of arrow body
  • jaw_len (float) – length of jaw line
  • jaw_width (float) – line width of jaw line
  • grasp_center_thickness (float) – thickness of grasp center
  • grasp_center_style (str) – style of center of grasp
  • grasp_axis_width (float) – line width of grasp axis
  • grasp_axis_style (:obj:`str) – style of grasp axis line
  • show_center (bool) – whether or not to plot the grasp center
  • show_axis (bool) – whether or not to plot the grasp axis
class dexnet.visualization.DexNetVisualizer3D

Dex-Net extension of the base Mayavi-based 3D visualization tools

static grasp(grasp, T_obj_world=RigidTransform(rotation=[[ 1. 0. 0.] [ 0. 1. 0.] [ 0. 0. 1.]], translation=[ 0. 0. 0.], from_frame=obj, to_frame=world), tube_radius=0.002, endpoint_color=(0, 1, 0), endpoint_scale=0.004, grasp_axis_color=(0, 1, 0))

Plots a grasp as an axis and center.

Parameters:
  • grasp (dexnet.grasping.Grasp) – the grasp to plot
  • T_obj_world (autolab_core.RigidTransform) – the pose of the object that the grasp is referencing in world frame
  • tube_radius (float) – radius of the plotted grasp axis
  • endpoint_color (3-tuple) – color of the endpoints of the grasp axis
  • endpoint_scale (3-tuple) – scale of the plotted endpoints
  • grasp_axis_color (3-tuple) – color of the grasp axis
static gripper(gripper, grasp, T_obj_world, color=(0.5, 0.5, 0.5))

Plots a robotic gripper in a pose specified by a particular grasp object.

Parameters:
  • gripper (dexnet.grasping.RobotGripper) – the gripper to plot
  • grasp (dexnet.grasping.Grasp) – the grasp to plot the gripper performing
  • T_obj_world (autolab_core.RigidTransform) – the pose of the object that the grasp is referencing in world frame
  • color (3-tuple) – color of the gripper mesh
static gripper_on_object(gripper, grasp, obj, stable_pose=None, T_table_world=RigidTransform(rotation=[[ 1. 0. 0.] [ 0. 1. 0.] [ 0. 0. 1.]], translation=[ 0. 0. 0.], from_frame=table, to_frame=world), gripper_color=(0.5, 0.5, 0.5), object_color=(0.5, 0.5, 0.5), style=’surface’, plot_table=True, table_dim=0.15)

Visualize a gripper on an object.

Parameters:
  • gripper (dexnet.grasping.RobotGripper) – gripper to plot
  • grasp (dexnet.grasping.Grasp) – grasp to plot the gripper in
  • obj (dexnet.grasping.GraspableObject3D) – 3D object to plot the gripper on
  • stable_pose (meshpy.StablePose or autolab_core.RigidTransform) – stable pose of the object on a planar worksurface
  • T_table_world (autolab_core.RigidTransform) – pose of table, specified as a transformation from mesh frame to world frame
  • gripper_color (3-tuple) – color of the gripper mesh
  • object_color (3-tuple) – color of the object mesh
  • style (str) – color of the object mesh
  • plot_table (bool) – whether or not to plot the table
  • table_dim (float) – dimension of the table