2 import pinocchio
as pin
10 material = meshcat.geometry.MeshPhongMaterial()
11 material.color = int(r * 255) * 256**2 + int(g * 255) * 256 + int(b * 255)
17 return np.array(pin.XYZQUATToSE3([x, y, z, q, u, a, t]))
24 if isinstance(viz, pin.visualize.MeshcatVisualizer):
27 viz.viewer[name].set_object(
30 elif isinstance(viz, pin.visualize.GepettoVisualizer):
31 viz.viewer.gui.addBox(name, sizex, sizey, sizez, rgba)
33 msg = f
"Viewer {viz.__class__} is not supported."
34 raise AttributeError(msg)
38 if isinstance(viz, pin.visualize.MeshcatVisualizer):
41 viz.viewer[name].set_object(
44 elif isinstance(viz, pin.visualize.GepettoVisualizer):
45 viz.viewer.gui.addSphere(name, size, rgba)
47 msg = f
"Viewer {viz.__class__} is not supported."
48 raise AttributeError(msg)
52 if isinstance(viz, pin.visualize.MeshcatVisualizer):
54 elif isinstance(viz, pin.visualize.GepettoVisualizer):
55 viz.viewer.gui.applyConfiguration(name, xyzquat)
56 viz.viewer.gui.refresh()
58 msg = f
"Viewer {viz.__class__} is not supported."
59 raise AttributeError(msg)
65 viz.viewer['world/ball'].set_object(meshcat.geometry.Sphere(.1),
66 meshcat_material(.2, .2, 1., .5))
67 viz.viewer['world/box'].set_transform(meshcat_transform(.5, .2, .2, 1, 0, 0, 0))
68 viz.viewer['world/ball'].set_transform(meshcat_transform(-.5, .2, .2, 1, 0, 0, 0))