5 import pinocchio
as pin
14 elif j0 ==
"spherical":
16 elif j0 ==
"sphericalzyx":
19 raise ValueError(
"Unknown joint type")
21 jointCube = model.addJoint(0, j0, pin.SE3.Identity(),
"joint0")
22 M = pin.SE3.Identity()
23 model.appendBodyToJoint(jointCube, pin.Inertia.FromBox(1, 0.8, 0.4, 0.2), M)
28 jointCube = model.getFrameId(
"joint0")
30 cube_shape = hppfcl.Box(0.8, 0.4, 0.2)
32 "cube_shape", 0, jointCube, cube_shape, pin.SE3.Identity()
34 cube.meshColor = np.array([1.0, 0.1, 0.1, 0.5])
35 geom_model.addGeometryObject(cube)
42 return model, geom_model
45 def pin_step(model, vizer, v_index_increment, dt=0.1):
47 v = np.zeros(model.nv)
48 v[v_index_increment] += 1.0
61 if __name__ ==
"__main__":
62 list_joint0 = [
"freeflyer",
"sphericalzyx",
"spherical"]
64 for joint0_name
in list_joint0:
65 print(f
"\njoint0_name = {joint0_name}")
72 print(f
"neutral q configuration: {q=}")
75 vizer.initViewer(open=
True, loadModel=
True)
80 for i
in range(model.nv):