Visualization
The moro.visualization package provides tools for plotting and
animating serial robot manipulators.
Visualization tools for serial robots.
- class moro.visualization.FrameData(T: ndarray)[source]
Bases:
objectNumerical homogeneous transformation of one robot frame.
- T: ndarray
- property position
- property rotation
- property x
- property y
- property z
- class moro.visualization.MatplotlibBackend[source]
Bases:
objectRender robot kinematic diagrams using Matplotlib 3D.
- static animate(scene_data_list: list[SceneData], interval=100, figsize=(10, 8), style: VisualizationStyle | None = None, **kwargs)[source]
Create a Matplotlib animation.
Notes
Keep a reference to the returned
FuncAnimationuntil it has been displayed or saved; otherwise it may be garbage-collected prematurely.
- static render(scene_data: SceneData, ax=None, figsize=(10, 8), view_init=(30, 30), style: VisualizationStyle | None = None)[source]
Render one robot configuration on a Matplotlib 3D axis.
- class moro.visualization.RobotVisualizer(robot: Robot)[source]
Bases:
objectRender a
moro.core.Robotusing the available backends.
- class moro.visualization.SceneData(joints: list[ndarray], frames: list[FrameData], dimension: float)[source]
Bases:
objectEvaluated numerical data for one robot configuration.
- dimension: float
- joints: list[ndarray]
- class moro.visualization.ThreeJSBackend[source]
Bases:
objectRender robot kinematic diagrams using Three.js.
- static animate(scene_data_list: list[SceneData], width: int = 800, height: int = 600, style: VisualizationStyle | None = None)[source]
Return an interactive Three.js animation as
IPython.display.HTML.
- static render(scene_data: SceneData, width: int = 800, height: int = 600, style: VisualizationStyle | None = None)[source]
Return an interactive Three.js view as
IPython.display.HTML.
- class moro.visualization.VisualizationStyle(show_frames: bool = True, show_links: bool = True, show_joints: bool = True, show_base: bool = True, show_grid: bool = True, link_color: str = '#778877', joint_color: str = '#ff1493', base_color: str = '#ff00ff', frame_scale: float | None = None, joint_size: float | None = None, base_size: float | None = None, link_linewidth: float = 3, show_trajectory: bool = False, trajectory_color: str = '#1565c0', trajectory_linewidth: float = 2, trajectory_mode: str = 'full')[source]
Bases:
objectStyle configuration for robot visualization.
- Parameters:
- show_framesbool
Draw coordinate frames at each joint.
- show_linksbool
Draw links connecting consecutive joints.
- show_jointsbool
Draw joint markers.
- show_basebool
Highlight the base joint when joints are visible.
- show_gridbool
Draw the reference grid.
- link_colorstr
Color used for links.
- joint_colorstr
Color used for joints.
- base_colorstr
Color used for the base joint.
- frame_scalefloat or None
Length of frame axes. If None, derive it from the scene dimension.
- joint_sizefloat or None
Joint size. If None, derive it from the scene dimension.
- base_sizefloat or None
Base size. If None, derive it from the scene dimension.
- link_linewidthfloat
Link thickness. Three.js interprets it as a relative thickness factor.
- show_trajectorybool
Draw end-effector Cartesian trajectory in animations.
- trajectory_colorstr
Color used for the trajectory line.
- trajectory_linewidthfloat
Trajectory line thickness.
- trajectory_modestr
Trajectory display mode:
"full"or"trace".
- base_color: str
- base_size: float | None
- frame_scale: float | None
- joint_color: str
- joint_size: float | None
- link_color: str
- link_linewidth: float
- show_base: bool
- show_frames: bool
- show_grid: bool
- show_joints: bool
- show_links: bool
- show_trajectory: bool
- trajectory_color: str
- trajectory_linewidth: float
- trajectory_mode: str
- moro.visualization.evaluate_robot(robot: Robot, num_vals: dict) SceneData[source]
Evaluate a robot at a numerical configuration.
- Parameters:
- robotRobot
Serial-link robot instance.
- num_valsdict
Mapping from symbolic variables to numerical values.
- Returns:
- SceneData
Numerical joint positions and frame transformations ready to render.