viewer

class jiminy_py.viewer.TrajectoryDataType(**kwargs)[source]

Bases: dict

evolution_robot: Sequence[jiminy_py.state.State]
robot: Optional[jiminy_py.core.Robot]
use_theoretical_model: bool
jiminy_py.viewer.sleep(dt)[source]

Function to provide cross-platform time sleep with maximum accuracy.

Warning

Use this method with cautious since it relies on busy looping principle instead of system scheduler. As a result, it wastes a lot more resources than time.sleep. However, it is the only way to ensure accurate delay on a non-real-time systems such as Windows 10.

Parameters

dt (float) – Sleep duration in seconds.

Return type

None

class jiminy_py.viewer.Viewer(robot, use_theoretical_model=False, robot_color=None, lock=None, backend=None, open_gui_if_parent=None, delete_robot_on_close=False, robot_name=None, scene_name='world', display_com=False, display_dcm=False, display_contact_frames=False, display_contact_forces=False, display_f_external=None, **kwargs)[source]

Bases: object

TODO: Write documentation.

Note

The environment variable ‘JIMINY_VIEWER_INTERACTIVE_DISABLE’ can be used to force disabling interactive display.

Parameters
  • robot (jiminy_py.core.Model) – Jiminy.Model to display.

  • use_theoretical_model (bool) – Whether to use the theoretical (rigid) model or the actual (flexible) model of this robot. Note that using the actual model is more efficient since update of the frames placements can be skipped. Optional: Actual model by default.

  • robot_color (Optional[Union[str, Tuple[float, float, float, float], numpy.ndarray]]) – Color of the robot. It will override the original color of the meshes if not None. It supports both RGBA codes as a list of 4 floating-point values ranging from 0.0 and 1.0, and a few named colors. Optional: Disabled by default.

  • lock (Optional[threading.RLock]) – Custom threading.RLock. Required for parallel rendering. It is required since some backends does not support multiple simultaneous connections (e.g. corbasever). None to use the unique lock of the current thread. Optional: None by default.

  • backend (Optional[str]) – Name of the rendering backend to use. It can be either ‘panda3d’, ‘panda3d-qt’, ‘meshcat’ or ‘gepetto-gui’. None to keep using to one already running if any, or the default one otherwise. Note that the default is hardware and environment dependent. See viewer.default_backend method for details. Optional: None by default.

  • open_gui_if_parent (Optional[bool]) – Open GUI if new viewer’s backend server is started. None to fallback to default. Optional: Do not open gui for ‘meshcat’ backend in interactive mode with already one display cell already opened, open gui in any other case by default.

  • delete_robot_on_close (bool) – Enable automatic deletion of the robot when closing. Optional: False by default.

  • robot_name (Optional[str]) – Unique robot name, to identify each robot. Optional: Randomly generated identifier by default.

  • scene_name (str) – Scene name, used only with ‘gepetto-gui’ backend. It must differ from the scene name. Optional: ‘world’ by default.

  • display_com (bool) – Whether or not to display the center of mass. Optional: Disabled by default.

  • display_dcm (bool) – Whether or not to display the capture point / DCM. Optional: Disabled by default.

  • display_contact_frames (bool) – Whether or not to display the contact frames. Optional: Disabled by default.

  • display_contact_forces (bool) – Whether or not to display the contact forces. Note that the user is responsible for updating sensors data since Viewer.display is only computing kinematic quantities. Optional: Disabled by default.

  • display_f_external (Optional[Union[Sequence[bool], bool]]) – Whether or not to display the external external forces applied at the joints on the robot. If a boolean is provided, the same visibility will be set for each joint, alternatively one can provide a boolean list whose ordering is consistent with pinocchio_model.names. Note that the user is responsible for updating the force buffer viewer.f_external data since Viewer.display is only computing kinematic quantities. Optional: Root joint for robot with freeflyer by default.

  • kwargs (Any) – Unused extra keyword arguments to enable forwarding.

backend = 'panda3d'
window_name = 'jiminy'
static open_gui(start_if_needed=False)[source]

Open a new viewer graphical interface.

Note

This method does nothing when using Gepetto-gui backend because its lifetime is tied to the graphical interface.

Note

Only one graphical interface can be opened locally for efficiency.

Parameters

start_if_needed (bool) –

Return type

bool

static has_gui()[source]
Return type

bool

static wait(require_client=False)[source]

Wait for all the meshes to finish loading in every clients.

Note

It is a non-op for gepetto-gui since it works in synchronous mode.

Parameters

require_client (bool) – Wait for at least one client to be available before checking for mesh loading.

Return type

None

static is_alive()[source]

Check if the backend server is running and responding to queries.

Return type

bool

is_open()[source]

Check if a given viewer instance is open, or if the backend server is running if no instance is specified.

Return type

bool

close()[source]

Close a given viewer instance, or all of them if no instance is specified.

Note

Calling this method with an viewer instance always closes the client. It may also remove the robot from the server if the viewer attribute delete_robot_on_close is True. Moreover, it is the one having started the backend server, it also terminates it, resulting in closing every viewer somehow. It results in the same outcome than calling this method without specifying any viewer instance.

Return type

None

static set_watermark(img_fullpath=None, width=None, height=None)[source]

Insert desired watermark on bottom left corner of the window.

Note

The relative width and height cannot exceed 20% of the visible area, othewise it will be rescaled.

Note

Gepetto-gui is not supported by this method and will never be.

Parameters
  • img_fullpath (Optional[str]) – Full path of the image to use as watermark. Meshcat supports format ‘.png’, ‘.jpeg’ or ‘svg’, while Panda3d only supports ‘.png’ and ‘.jpeg’ for now. None or empty string to disable. Optional: None by default.

  • width (Optional[int]) – Desired width for the image. None to not rescale the image manually. Optional: None by default.

  • height (Optional[int]) – Desired height for the image. None to not rescale the image manually. Optional: None by default.

Return type

None

static set_legend(labels=None)[source]

Insert legend on top left corner of the window.

Note

Make sure to have specified different colors for each robot on the scene, since it will be used as marker on the legend.

Note

Gepetto-gui is not supported by this method and will never be.

Parameters

labels (Optional[Sequence[str]]) – Sequence of strings whose length must be consistent with the number of robots on the scene. None to disable. Optional: None by default.

Return type

None

static set_clock(time=None)[source]

Insert clock on bottom right corner of the window.

Note

Only Panda3d rendering backend is supported by this method.

Parameters

time (Optional[float]) – Current time is seconds. None to disable. Optional: None by default.

Return type

None

get_camera_transform()[source]

Get transform of the camera pose.

Warning

The reference axis is negative z-axis instead of positive x-axis.

Warning

It returns the previous requested camera transform for meshcat, since it is impossible to get acces to this information. Thus this method is valid as long as the user does not move the camera manually using mouse camera control.

Return type

Tuple[Union[Tuple[float, float, float], numpy.ndarray], Union[Tuple[float, float, float], numpy.ndarray]]

set_camera_transform(position=None, rotation=None, relative=None, wait=False)[source]

Set transform of the camera pose.

Warning

The reference axis is negative z-axis instead of positive x-axis, which means that position = [0.0, 0.0, 0.0], rotation = [0.0, 0.0, 0.0] moves the camera at the center of scene, looking downward.

Parameters
  • position (Optional[Union[Tuple[float, float, float], numpy.ndarray]]) – Position [X, Y, Z] as a list or 1D array. None to not update it. Optional: None by default.

  • rotation (Optional[Union[Tuple[float, float, float], numpy.ndarray]]) – Rotation [Roll, Pitch, Yaw] as a list or 1D np.array. None to note update it. Optional: None by default.

  • relative (Optional[Union[str, int]]) – How to apply the transform:

    • None: absolute.

    • ’camera’: relative to current camera pose.

    • other: relative to a robot frame, not accounting for the rotation of the frame during travalling. It supports both frame name and index in model.

  • wait (bool) – Whether or not to wait for rendering to finish.

Return type

None

set_camera_lookat(position, relative=None, wait=False)[source]

Set the camera look-up position.

Note

It preserve the relative camera pose wrt the lookup position.

Parameters
  • position (Union[Tuple[float, float, float], numpy.ndarray]) – Position [X, Y, Z] as a list or 1D array, frame index

  • relative (Optional[Union[str, int]]) – Set the lookat position relative to robot frame if specified, in absolute otherwise. Both frame name and index in model are supported.

  • wait (bool) – Whether or not to wait for rendering to finish.

Return type

None

static register_camera_motion(camera_motion)[source]

Register camera motion. It will be used later by replay to set the absolute or relative camera pose, depending on whether or not travelling is enable.

Parameters

camera_motion (Sequence[jiminy_py.viewer.viewer.CameraMotionBreakpointType]) –

Camera breakpoint poses over time, as a list of CameraMotionBreakpointType dict. Here is an example:

[{'t': 0.00,
  'pose': ([3.5, 0.0, 1.4], [1.4, 0.0, np.pi / 2])},
 {'t': 0.33,
  'pose': ([4.5, 0.0, 1.4], [1.4, np.pi / 6, np.pi / 2])},
 {'t': 0.66,
  'pose': ([8.5, 0.0, 1.4], [1.4, np.pi / 3, np.pi / 2])},
 {'t': 1.00,
  'pose': ([9.5, 0.0, 1.4], [1.4, np.pi / 2, np.pi / 2])}]

Return type

None

static remove_camera_motion()[source]

Remove camera motion.

Return type

None

attach_camera(frame, camera_xyzrpy=(None, None), lock_relative_pose=None)[source]

Attach the camera to a given robot frame.

Only the position of the frame is taken into account. A custom relative pose of the camera wrt to the frame can be further specified. If so, then the relative camera pose wrt the frame is locked, otherwise the camera is only constrained to look at the frame.

Parameters
  • frame (Union[str, int]) – Name or index of the frame of the robot to follow with the camera.

  • camera_xyzrpy (Optional[Tuple[Optional[Union[Tuple[float, float, float], numpy.ndarray]], Optional[Union[Tuple[float, float, float], numpy.ndarray]]]]) – Tuple position [X, Y, Z], rotation [Roll, Pitch, Yaw] corresponding to the relative pose of the camera wrt the tracked frame. It will be used to initialize the camera pose if relative pose is not locked. None to disable. Optional: Disabkle by default.

  • lock_relative_pose (Optional[bool]) – Whether or not to lock the relative pose of the camera wrt tracked frame. Optional: False by default iif Panda3d backend is used.

Return type

None

static detach_camera()[source]

Detach the camera.

Must be called to undo attach_camera, so that it will stop automatically tracking a frame.

Return type

None

set_color(color=None)[source]

Override the color of the visual and collision geometries of the robot on-the-fly.

Note

This method is only supported by Panda3d for now.

Parameters

color (Optional[Union[str, Tuple[float, float, float, float], numpy.ndarray]]) – Color of the robot. It will override the original color of the meshes if not None, and restore them otherwise. It supports both RGBA codes as a list of 4 floating-point values ranging from 0.0 and 1.0, and a few named colors. Optional: Disabled by default.

Return type

None

update_floor(ground_profile=None, grid_size=20.0, grid_unit=0.04, show_meshes=False)[source]

Display a custom ground profile as a height map or the original tile ground floor.

Note

This method is only supported by Panda3d for now.

Parameters
  • ground_profile (Optional[jiminy_py.core.HeightmapFunctor]) – jiminy_py.core.HeightmapFunctor associated with the ground profile. It renders a flat tile ground if not specified. Optional: None by default.

  • grid_size (float) – X and Y dimension of the ground profile to render. Optional: 20m by default.

  • grid_unit (float) – X and Y discretization step of the ground profile. Optional: 4cm by default.

  • show_meshes (bool) – Whether or not to highlight the meshes. Optional: disabled by default.

Return type

None

capture_frame(width=None, height=None, raw_data=False)[source]

Take a snapshot and return associated data.

Parameters
  • width (int) – Width for the image in pixels (not available with Gepetto-gui for now). None to keep unchanged. Optional: Kept unchanged by default.

  • height (int) – Height for the image in pixels (not available with Gepetto-gui for now). None to keep unchanged. Optional: Kept unchanged by default.

  • raw_data (bool) – Whether to return a 2D numpy array, or the raw output from the backend (the actual type may vary).

Return type

Union[numpy.ndarray, bytes]

save_frame(image_path, width=None, height=None)[source]

Save a snapshot in png format.

Parameters
  • image_path (str) – Fullpath of the image (.png extension is mandatory)

  • width (int) – Width for the image in pixels (not available with Gepetto-gui for now). None to keep unchanged. Optional: Kept unchanged by default.

  • height (int) – Height for the image in pixels (not available with Gepetto-gui for now). None to keep unchanged. Optional: Kept unchanged by default.

Return type

None

display_visuals(visibility)[source]

Set the visibility of the visual model of the robot.

Parameters

visibility (bool) – Whether to enable or disable display of the visual model.

Return type

None

display_collisions(visibility)[source]

Set the visibility of the collision model of the robot.

Parameters

visibility (bool) – Whether to enable or disable display of the visual model.

Return type

None

add_marker(name, shape, pose=(None, None), scale=1.0, color=None, remove_if_exists=False, auto_refresh=True, *shape_args, **shape_kwargs)[source]

Add marker on the scene.

Warning

This method is only supported by Panda3d.

Parameters
  • name (str) – Unique name. It must be a valid string identifier.

  • shape (str) – Desired shape, as a string, i.e. ‘cone’, ‘box’, ‘sphere’, ‘capsule’, ‘cylinder’, or ‘arrow’.

  • pose (Union[Sequence[Optional[numpy.ndarray]], Callable[Tuple[Union[Tuple[float, float, float], numpy.ndarray], Union[Tuple[float, float, float, float], numpy.ndarray]]]]) – Pose of the geometry on the scene, as a list of vectors (position [X, Y, Z], quaternion [X, Y, Z, W]). None corresponds to world frame position and/or orientation. Optional: World frame by default.

  • scale (Union[float, Tuple[float, float, float], numpy.ndarray, Callable[numpy.ndarray]]) – Size of the marker. Each principal axis of the geometry are scaled separately.

  • color (Union[str, Tuple[float, float, float, float], numpy.ndarray, None, Callable[Union[Tuple[float, float, float, float], numpy.ndarray]]]) – Color of the marker. It supports both RGBA codes as a list of 4 floating-point values ranging from 0.0 and 1.0, and a few named colors. Optional: robot’s color by default if overridden, ‘red’ otherwise.

  • auto_refresh (bool) – Whether or not to refresh the scene after adding the marker. Useful for adding a bunch of markers and only refresh once. Note that the marker will not display properly until then.

  • shape_args (Any) – Any additional positional arguments to forward to jiminy_py.viewer.panda3d.panda3d_visualizer. Panda3dApp.append_{shape}.

  • shape_kwargs (Any) – Any additional keyword arguments to forward to shape instantiation method.

  • remove_if_exists (bool) –

Returns

Dict of type MarkerDataType, storing references to the current pose, scale, and color of the marker, and itself a reference to viewer.markers[name]. Any modification of it will take effect at next refresh call.

Return type

jiminy_py.viewer.viewer.MarkerDataType

display_center_of_mass(visibility)[source]

Display the position of the center of mass as a sphere.

Note

It corresponds to the attribute com[0] of the provided robot.pinocchio_model. Calling Viewer.display will update it automatically, while Viewer.refresh will not.

Parameters

visibility (bool) – Whether to enable or disable display of the center of mass.

Return type

None

display_capture_point(visibility)[source]

Display the position of the capture point,also called divergent component of motion (DCM) as a sphere.

Note

Calling Viewer.display will update it automatically, while Viewer.refresh will not.

Parameters

visibility (bool) – Whether to enable or disable display of the capture point.

Return type

None

display_contact_frames(visibility)[source]

Display the contact frames of the robot as spheres.

Note

The frames to display are specified by the attribute contact_frames_names of the provided robot. Calling Viewer.display will update it automatically, while Viewer.refresh will not.

Warning

This method is only supported by Panda3d.

Parameters

visibility (bool) – Whether or not to display the contact frames.

Return type

None

display_contact_forces(visibility)[source]

Display forces associated with the contact sensors attached to the robot, as cylinders of variable length depending of Fz.

Note

Fz can be signed. It will affect the orientation of the capsule.

Warning

It corresponds to the attribute data of jiminy.ContactSensor. Calling Viewer.display will NOT update its value automatically. It is up to the user to keep it up-to-date.

Warning

This method is only supported by Panda3d.

Parameters

visibility (bool) – Whether or not to display the contact forces.

Return type

None

display_external_forces(visibility)[source]

Display external forces applied on the joints the robot, as arrows of variable length depending of magnitude of the force.

Warning

It only display the linear component of the force, while ignoring the angular part for now.

Warning

It corresponds to the attribute ``viewer.f_external`. Calling Viewer.display will NOT update its value automatically. It is up to the user to keep it up-to-date.

Warning

This method is only supported by Panda3d.

Parameters

visibility (Union[Sequence[bool], bool]) – Whether or not to display the external force applied at each joint selectively. If a boolean is provided, the same visibility will be set for each joint, alternatively, one can provide a boolean list whose ordering is consistent with pinocchio model (i.e. pinocchio_model.names).

Return type

None

remove_marker(name)[source]

Remove a marker, based on its name.

Parameters
  • identifier – Name of the marker to remove.

  • name (str) –

Return type

None

refresh(force_update_visual=False, force_update_collision=False, wait=False)[source]

Refresh the configuration of Robot in the viewer.

This method is also in charge of updating the camera placement for travelling.

Note

This method is copy-pasted from Pinocchio.visualize.*.display method, after removing parts responsible of update pinocchio data and collision data. Visual data must still be updated.

Parameters
  • force_update_visual (bool) – Force update of visual geometries.

  • force_update_collision (bool) – Force update of collision geometries.

  • wait (bool) – Whether or not to wait for rendering to finish.

Return type

None

display(q, v=None, xyz_offset=None, update_hook=None, wait=False)[source]

Update the configuration of the robot.

Warning

It will alter original robot data if viewer attribute use_theoretical_model is false.

Parameters
  • q (numpy.ndarray) – Configuration of the robot.

  • v (Optional[numpy.ndarray]) – Velocity of the robot. Used only to update velocity dependent markers such as DCM. None if undefined. Optional: None by default.

  • xyz_offset (Optional[numpy.ndarray]) – Freeflyer position offset. Note that it does not check for the robot actually have a freeflyer.

  • update_hook (Optional[Callable[None]]) – Callable that will be called right after updating kinematics data. None to disable. Optional: None by default.

  • wait (bool) – Whether or not to wait for rendering to finish.

Return type

None

replay(evolution_robot, time_interval=(0.0, inf), speed_ratio=1.0, xyz_offset=None, update_hook=None, enable_clock=False, wait=False)[source]

Replay a complete robot trajectory at a given real-time ratio.

Note

Specifying ‘udpate_hook’ is necessary to be able to display sensor information usch as contact forces. It will be automatically disable otherwise.

Warning

It will alter original robot data if viewer attribute use_theoretical_model is false.

Parameters
  • evolution_robot (Sequence[jiminy_py.state.State]) – List of State object of increasing time.

  • time_interval (Optional[Union[numpy.ndarray, Tuple[float, float]]]) – Specific time interval to replay. Optional: Complete evolution by default [0, inf].

  • speed_ratio (float) – Real-time factor. Optional: No time dilation by default (1.0).

  • xyz_offset (Optional[numpy.ndarray]) – Freeflyer position offset. Note that it does not check for the robot actually have a freeflyer. OPtional: None by default.

  • update_hook (Optional[Callable[[float, numpy.ndarray, numpy.ndarray], None]]) –

    Callable that will be called periodically between every state update. None to disable, otherwise it must have the following signature:

    f(t:float, q: ndarray, v: ndarray) -> None

    Optional: No update hook by default.

  • wait (bool) – Whether or not to wait for rendering to finish.

  • enable_clock (bool) –

Return type

None

jiminy_py.viewer.interactive_mode()[source]

Determine what kind of process is running Python kernel.

Returns

  • 0: Non-interactive process. It can be either Ipython console

    or builtin terminaL. Does not support HTML embedding.

  • 1: Interactive Jupyter Notebook. (It can be confused with

    Qtconsole)

  • 2: Interactive Google Colab. Not properly supported so far.

Return type

None

jiminy_py.viewer.extract_replay_data_from_log_data(robot, log_data)[source]

Extract replay data from log data.

Parameters
  • robot (jiminy_py.core.Robot) – Jiminy robot for which to extract log data.

  • log_data (Dict[str, numpy.ndarray]) – Data from the log file, in a dictionnary.

Returns

Trajectory data, update hook and extra keyword arguments to forward to play_trajectories method to display the trajectory. By default, it enables display of external forces applied on freeflyer if any.

Return type

Tuple[jiminy_py.log.TrajectoryDataType, Callable[float, None], Any]

jiminy_py.viewer.play_trajectories(trajs_data, update_hooks=None, time_interval=(0.0, inf), speed_ratio=1.0, xyz_offsets=None, robots_colors=None, travelling_frame=None, camera_xyzrpy=(None, None), camera_motion=None, watermark_fullpath=None, legend=None, enable_clock=False, display_com=None, display_dcm=None, display_contacts=None, display_f_external=None, scene_name='world', record_video_path=None, start_paused=False, backend=None, delete_robot_on_close=None, remove_widgets_overlay=True, close_backend=False, viewers=None, verbose=True, **kwargs)[source]

Replay one or several robot trajectories in a viewer.

The ratio between the replay and the simulation time is kept constant to the desired ratio. One can choose between several backend (gepetto-gui or meshcat).

Note

Replay speed is independent of the platform (windows, linux…) and available CPU power.

Parameters
  • trajs_data (Union[jiminy_py.log.TrajectoryDataType, Sequence[jiminy_py.log.TrajectoryDataType]]) – List of TrajectoryDataType dicts.

  • update_hooks (Optional[Union[Callable[[float, numpy.ndarray, numpy.ndarray], None], Sequence[Callable[[float, numpy.ndarray, numpy.ndarray], None]]]]) –

    Callables associated with each robot that can be used to update non-kinematic robot data, for instance to emulate sensors data from log using the hook provided by emulate_sensors_data_from_log method. None to disable, otherwise it must have the signature:

    f(t:float, q: ndarray, v: ndarray) -> None

    Optional: None by default.

  • time_interval (Optional[Union[numpy.ndarray, Tuple[float, float]]]) – Replay only timesteps in this interval of time. It does not have to be finite. Optional: [0, inf] by default.

  • speed_ratio (float) – Speed ratio of the simulation. Optional: 1.0 by default.

  • xyz_offsets (Optional[Union[Tuple[float, float, float], numpy.ndarray, Sequence[Union[Tuple[float, float, float], numpy.ndarray]]]]) – List of constant position of the root joint for each robot in world frame. None to disable. Optional: None by default.

  • robots_colors (Optional[Union[Tuple[float, float, float, float], numpy.ndarray, str, Sequence[Union[Tuple[float, float, float, float], numpy.ndarray, str]]]]) – List of RGBA codes or named colors defining the color for each robot. It will be applied to every link. None to disable. Optional: Original color if single robot, default color cycle otherwise.

  • travelling_frame (Optional[Union[str, int]]) – Name or index of the frame to track. The camera will automatically follow the frame of the robot associated with the first trajs_data.`None` to disable. Optional: Disabled by default.

  • camera_xyzrpy (Optional[Tuple[Optional[Union[Tuple[float, float, float], numpy.ndarray]], Optional[Union[Tuple[float, float, float], numpy.ndarray]]]]) – Tuple position [X, Y, Z], rotation [Roll, Pitch, Yaw] corresponding to the absolute pose of the camera during replay, if travelling is disable, or the relative pose wrt the tracked frame otherwise. None to disable. Optional: None by default.

  • camera_motion (Optional[Sequence[jiminy_py.viewer.viewer.CameraMotionBreakpointType]]) – Camera breakpoint poses over time, as a list of CameraMotionBreakpointType dict. None to disable. Optional: None by default.

  • watermark_fullpath (Optional[str]) – Add watermark to the viewer. It is not persistent but disabled after replay. This option is only supported by meshcat backend. None to disable. Optional: No watermark by default.

  • legend (Optional[Union[str, Sequence[str]]]) – List of text defining the legend for each robot. It is not persistent but disabled after replay. This option is only supported by meshcat backend. None to disable. Optional: No legend if no color by default, the robots names otherwise.

  • enable_clock (bool) – Add clock on bottom right corner of the viewer. Only available with ‘panda3d’ rendering backend. Optional: Disabled by default.

  • display_com (Optional[bool]) – Whether or not to display the center of mass. None to keep current viewers’ settings, if any. Optional: Enabled by default iif viewers is None, and backend is ‘panda3d’.

  • display_dcm (Optional[bool]) – Whether or not to display the capture point (also called DCM). None to keep current viewers’ settings. Optional: Enabled by default iif `viewers is None, and backend is ‘panda3d’.

  • display_contacts (Optional[bool]) – Whether or not to display the contact forces. Note that the user is responsible for updating sensors data via update_hooks. None to keep current viewers’ settings. Optional: Enabled by default iif update_hooks is specified, viewers is None, and backend is ‘panda3d’.

  • display_f_external (Optional[Union[Sequence[bool], bool]]) – Whether or not to display the external external forces applied at the joints on the robot. If a boolean is provided, the same visibility will be set for each joint, alternatively one can provide a boolean list whose ordering is consistent with pinocchio_model.names. Note that the user is responsible for updating the force buffer viewer.f_external via update_hooks. None to keep current viewers’ settings. Optional: None by default.

  • scene_name (str) – Name of viewer’s scene in which to display the robot. Optional: Common default name if omitted.

  • record_video_path (Optional[str]) – Fullpath location where to save generated video. It must be specified to enable video recording. Meshcat only support ‘webm’ format, while the other renderer only supports ‘mp4’ format encoded with web-compatible ‘h264’ codec. Optional: None by default.

  • start_paused (bool) – Start the simulation is pause, waiting for keyboard input before starting to play the trajectories. Only available if record_video_path is None. Optional: False by default.

  • backend (Optional[str]) – Backend, one of ‘panda3d’, ‘meshcat’, or ‘gepetto-gui’. If None, the most appropriate backend will be selected automatically, based on hardware and python environment. Optional: None by default.

  • delete_robot_on_close (Optional[bool]) – Whether or not to delete the robot from the viewer when closing it. Optional: True by default.

  • remove_widgets_overlay (bool) – Remove overlay (legend, watermark, clock, …) automatically before returning. Optional: Enabled by default.

  • close_backend (bool) – Whether or not to close backend automatically before returning. Optional: Disabled by default.

  • viewers (Optional[Sequence[Optional[jiminy_py.viewer.viewer.Viewer]]]) – List of already instantiated viewers, associated one by one in order to each trajectory data. None to disable. Optional: None by default.

  • verbose (bool) – Add information to keep track of the process. Optional: True by default.

  • kwargs (Any) – Unused keyword arguments to allow chaining renderining methods with ease.

Returns

List of viewers used to play the trajectories.

Return type

Sequence[jiminy_py.viewer.viewer.Viewer]

jiminy_py.viewer.play_logs_data(robots, logs_data, **kwargs)[source]

Play log data in a viewer.

This method simply formats the data then calls play_trajectories.

Parameters
  • robots (Union[Sequence[jiminy_py.core.Robot], jiminy_py.core.Robot]) – Either a single robot, or a list of robot for each log data.

  • logs_data (Union[Sequence[Dict[str, numpy.ndarray]], Dict[str, numpy.ndarray]]) – Either a single dictionary, or a list of dictionaries of simulation data log.

  • kwargs – Keyword arguments to forward to play_trajectories method.

Return type

Sequence[jiminy_py.viewer.viewer.Viewer]

jiminy_py.viewer.play_logs_files(logs_files, mesh_package_dirs=(), **kwargs)[source]

Play the content of a logfile in a viewer.

This method reconstruct the exact model used during the simulation corresponding to the logfile, including random biases or flexible joints.

Parameters
  • logs_files (Union[str, Sequence[str]]) – Either a single simulation log files in any format, or a list.

  • mesh_package_dirs (Union[str, Sequence[str]]) – Prepend custom mesh package seach path directories to the ones provided by log file. It may be necessary to specify it to read log generated on a different environment.

  • kwargs – Keyword arguments to forward to play_trajectories method.

Return type

Sequence[jiminy_py.viewer.viewer.Viewer]