hppfcl.Sphere(0.5), hppfcl.Box(1, 1, 1), hppfcl.Cylinder(0.1, 1.0), hppfcl.Cone(0.5, 1.0), ] for i, geom in enumerate(geometries): placement = pin.SE3(np.eye(3), np.array([i, 0, 0])) geom_obj = pin.GeometryObject("obj{}".format(i), 0, 0, geom, placement) color = np.random.uniform(0, 1, 4) color[3] = 1 geom_obj.meshColor = color geom_model.addGeometryObject(geom_obj) viz = GepettoVisualizer( model=model, collision_model=geom_model, visual_model=geom_model, ) # Initialize the viewer. try: viz.initViewer() except ImportError as error: print( "Error while initializing the viewer. It seems you should install gepetto-viewer" ) print(error) sys.exit(0) try: viz.loadViewerModel("shapes")
from pinocchio.visualize import GepettoVisualizer # Load the URDF model. # Conversion with str seems to be necessary when executing this file with ipython current_path = str(os.path.dirname(os.path.abspath(__file__))) model_path = str( os.path.abspath(os.path.join(current_path, '../../models/romeo'))) mesh_dir = model_path urdf_model_path = str( os.path.abspath( os.path.join(model_path, 'romeo_description/urdf/romeo_small.urdf'))) model, collision_model, visual_model = pin.buildModelsFromUrdf( urdf_model_path, mesh_dir, pin.JointModelFreeFlyer()) display = GepettoVisualizer(model, collision_model, visual_model) # Initialize the display. display.initViewer() display.loadViewerModel("pinocchio") # Display a robot configuration. q0 = np.matrix([ 0, 0, 0.840252, 0, 0, 0, 1, # Free flyer 0,
from os.path import dirname, join, abspath from pinocchio.visualize import GepettoVisualizer # Load the URDF model. # Conversion with str seems to be necessary when executing this file with ipython pinocchio_model_dir = join(dirname(dirname(str(abspath(__file__)))), "models") model_path = join(pinocchio_model_dir, "example-robot-data/robots") mesh_dir = pinocchio_model_dir urdf_filename = "talos_reduced.urdf" urdf_model_path = join(join(model_path, "talos_data/robots"), urdf_filename) model, collision_model, visual_model = pin.buildModelsFromUrdf( urdf_model_path, mesh_dir, pin.JointModelFreeFlyer()) viz = GepettoVisualizer(model, collision_model, visual_model) # Initialize the viewer. try: viz.initViewer() except ImportError as err: print( "Error while initializing the viewer. It seems you should install gepetto-viewer" ) print(err) sys.exit(0) try: viz.loadViewerModel("pinocchio") except AttributeError as err: print(
shape2 = fcl.Cylinder(body_radius / 4., body_placement.translation[2]) shape2_placement = body_placement.copy() shape2_placement.translation[2] /= 2. geom2_obj = pin.GeometryObject(geom2_name, joint_id, shape2, shape2_placement) geom2_obj.meshColor = np.array([0., 0., 0., 1.]) geom_model.addGeometryObject(geom2_obj) parent_id = joint_id joint_placement = body_placement.copy() from pinocchio.visualize import GepettoVisualizer visual_model = geom_model viz = GepettoVisualizer(model, geom_model, visual_model) # Initialize the viewer. try: viz.initViewer() except ImportError as err: print( "Error while initializing the viewer. It seems you should install gepetto-viewer" ) print(err) sys.exit(0) try: viz.loadViewerModel("pinocchio") except AttributeError as err: print(