1 from ..
import pinocchio_pywrap
as pin
2 from ..shortcuts
import buildModelsFromUrdf, createDatas
7 """Pinocchio visualizers are employed to easily display a model at a given configuration. 8 BaseVisualizer is not meant to be directly employed, but only to provide a uniform interface and a few common methods. 9 New visualizers should extend this class and override its methods as neeeded. 12 def __init__(self, model = pin.Model(), collision_model =
None, visual_model =
None, copy_models =
False, data =
None, collision_data =
None, visual_data =
None):
13 """Construct a display from the given model, collision model, and visual model. 14 If copy_models is True, the models are copied. Otherwise, they are simply kept as a reference.""" 26 self.
data = self.model.createData()
30 if collision_data
is None:
35 if visual_data
is None:
41 """Re-build the data objects. Needed if the models were modified. 42 Warning: this will delete any information stored in all data objects.""" 46 """Return the name of the geometry object inside the viewer.""" 50 """Init the viewer by loading the gui and creating a window.""" 54 """Create the scene displaying the robot meshes in the viewer""" 57 def reload(self, new_geometry_object, geometry_type = None):
58 """ Reload a geometry_object given by its type""" 62 """ Delete all the objects from the whole scene """ 66 """Display the robot at configuration q or refresh the rendering 67 from the current placements contained in data by placing all the bodies in the viewer.""" 71 """Set whether to display collision objects or not.""" 75 """Set whether to display visual objects or not.""" 78 def play(self, q_trajectory, dt):
79 """Play a trajectory with given time step.""" 80 for k
in range(q_trajectory.shape[1]):
82 self.display(q_trajectory[:, k])
84 elapsed_time = t1 - t0
86 time.sleep(dt - elapsed_time)
88 __all__ = [
'BaseVisualizer']
def getViewerNodeName(self, geometry_object, geometry_type)
def displayCollisions(self, visibility)
def reload(self, new_geometry_object, geometry_type=None)
def display(self, q=None)
def initViewer(self, args, kwargs)
def __init__(self, model=pin.Model(), collision_model=None, visual_model=None, copy_models=False, data=None, collision_data=None, visual_data=None)
def displayVisuals(self, visibility)
def loadViewerModel(self, args, kwargs)
def play(self, q_trajectory, dt)