roboplan.viser_visualizer
TEMPORARY FILE: Can be removed when Pinocchio 3.9.0 is available on all platforms.
Attributes
Classes
A Pinocchio visualizer using Viser. |
Module Contents
- roboplan.viser_visualizer.import_viser_succeed = False
- roboplan.viser_visualizer.MESH_TYPES
- class roboplan.viser_visualizer.ViserVisualizer(model=pin.Model(), collision_model=None, visual_model=None, copy_models=False, data=None, collision_data=None, visual_data=None)
Bases:
pinocchio.visualize.BaseVisualizerA Pinocchio visualizer using Viser.
- static_objects = []
- initViewer(viewer=None, open=False, loadModel=False, host='localhost', port='8000')
Start a new Viser server and client. Note: the server can also be passed in through the viewer argument. :param viewer: An existing ViserServer instance, or None.
If None, creates a new ViserServer in this visualizer.
- Parameters:
open – If True, automatically opens a browser tab to the visualizer.
loadModel – If True, loads the Pinocchio models passed in.
host – If viewer is None, this will be the host URL.
port – If viewer is None, this will be the host port.
- loadViewerModel(rootNodeName='pinocchio', collision_color=None, visual_color=None, frame_axis_length=0.2, frame_axis_radius=0.01)
Load the robot in a Viser viewer. :param rootNodeName: name to give to the robot in the viewer :param collision_color: optional, color to give to the collision model of
the robot. Format is a list of four RGBA floating-point numbers (between 0 and 1)
- Parameters:
visual_color – optional, color to give to the visual model of the robot. Format is a list of four RGBA floating-point numbers (between 0 and 1)
frame_axis_length – optional, length of frame axes if displaying frames.
frame_axis_radius – optional, radius of frame axes if displaying frames.
- loadViewerGeometryObject(geometry_object, prefix='', color=None)
Loads a single geometry object.
- display(q=None)
Display the robot at configuration q in the viewer by placing all the bodies
- displayCollisions(visibility)
- displayVisuals(visibility)
- displayFrames(visibility)
- abstractmethod drawFrameVelocities(*args, **kwargs)
- updatePlacements(geometry_type)
- updateFrames()
- captureImage(w=None, h=None, client_id=None, transport_format='jpeg')
Capture an image from the Viser viewer and return an RGB array. :param w: The width of the captured image. :param h: The height of the captured image. :param client_id: The ID of the Viser client handle.
If None, uses the first available client.
- Parameters:
transport_format – The transport format to use for the captured image. Can be “jpeg” (default) or “png”.
- abstractmethod setBackgroundColor(preset_name='gray', col_top=None, col_bot=None)
- Parameters:
preset_name (str)
- abstractmethod setCameraTarget(target)
- Parameters:
target (numpy.ndarray)
- abstractmethod setCameraPosition(position)
- Parameters:
position (numpy.ndarray)
- abstractmethod setCameraZoom(zoom)
- Parameters:
zoom (float)
- abstractmethod setCameraPose(pose=np.eye(4))
- Parameters:
pose (numpy.ndarray)
- abstractmethod disableCameraControl()
- abstractmethod enableCameraControl()