6 from pathlib
import Path
9 import pinocchio
as pin
14 pinocchio_model_dir = Path(__file__).parent.parent /
"models"
16 model_path = pinocchio_model_dir /
"example-robot-data/robots"
17 mesh_dir = pinocchio_model_dir
18 urdf_filename =
"romeo_small.urdf"
19 urdf_model_path = model_path /
"romeo_description/urdf" / urdf_filename
21 model, collision_model, visual_model = pin.buildModelsFromUrdf(
22 urdf_model_path, mesh_dir, pin.JointModelFreeFlyer()
34 viz.initViewer(open=
True)
35 except ImportError
as err:
37 "Error while initializing the viewer. "
38 "It seems you should install Python meshcat"
46 viz.loadViewerModel(color=[0.0, 0.0, 0.0, 1.0])
95 red_robot_viz.initViewer(viz.viewer)
96 red_robot_viz.loadViewerModel(rootNodeName=
"red_robot", color=[1.0, 0.0, 0.0, 0.5])
99 red_robot_viz.display(q)