Module placo_utils#
Visualization#
The following methods can be used as helpers to render objects in Meshcat:
- placo_utils.visualization.arrow_viz(name: str, point_from: ndarray, point_to: ndarray, color: float = 16711680, radius: float = 0.003) None #
Prints an arrow
- placo_utils.visualization.contacts_viz(solver: DynamicsSolver, ratio=0.1, radius=0.005)#
- placo_utils.visualization.footsteps_viz(footsteps: Footsteps, T: ndarray = array([[1., 0., 0., 0.], [0., 1., 0., 0.], [0., 0., 1., 0.], [0., 0., 0., 1.]])) None #
- placo_utils.visualization.frame_viz(name: str, T: ndarray, opacity: float = 1.0) None #
Visualizes a given frame
- placo_utils.visualization.get_viewer() Visualizer #
Gets the meshcat viewer, if it doesn’t exist, create it
- placo_utils.visualization.line_viz(name: str, points: ndarray, color: float = 16711680) None #
Prints a line
- placo_utils.visualization.point_viz(name: str, point: ndarray, radius: float = 0.01, color: float = 16711680, opacity: float = 1.0) None #
Prints a point (sphere)
- placo_utils.visualization.points_viz(name: str, points: ndarray, radius: float = 0.01, color: float = 16711680, opacity: float = 1.0) None #
Prints a point (sphere)
- placo_utils.visualization.robot_frame_viz(robot: RobotWrapper, frame: str) None #
Draw a frame from the robot
- placo_utils.visualization.robot_viz(robot: RobotWrapper, name: str = 'robot') MeshcatVisualizer #
Builds an instance of pinocchio MeshcatVisualizer, which allows to push the model to the meshcat visualizer passed as parameter
The robot can further be displayed using:
> viz.display(q)
TF#
Importing:
import placo_utils.tf as tf
Actually is an alias to Meshcat transformations, containing straightforward implementations to handle rigid body transformations.
The typical two methods you want to use are rotation_matrix and translation_matrix:
# Rotation of 0.5 rad around the z axis
T = tf.rotation_matrix(0.5, [0, 0, 1])
# Translation of 1m along the x axis
T = tf.translation_matrix([1, 0, 0])