9 import pinocchio
as pin
10 from dynamic_graph
import plug
22 set_printoptions(suppress=
True, precision=7)
31 urdfPath =
"~/git/sot/pinocchio/models/romeo.urdf"
32 urdfDir = [
"~/git/sot/pinocchio/models"]
33 pinocchioRobot =
RomeoWrapper(urdfPath, urdfDir, pin.JointModelFreeFlyer())
35 pinocchioRobot.initDisplay(loadModel=
True)
36 pinocchioRobot.display(pinocchioRobot.q0)
87 dyn.setModel(pinocchioRobot.model)
88 dyn.setData(pinocchioRobot.data)
92 robotDim = dyn.getDimension()
93 inertiaRotor = (0,) * 6 + (5e-4,) * 31
94 gearRatio = (0,) * 6 + (200,) * 31
95 dyn.inertiaRotor.value = inertiaRotor
96 dyn.gearRatio.value = gearRatio
97 dyn.velocity.value = robotDim * (0.0,)
98 dyn.acceleration.value = robotDim * (0.0,)
104 robot = RobotSimu(robotName)
105 robot.resize(robotDim)
111 robot.set(initialConfig)
112 plug(robot.state, dyn.position)
118 sot.setSize(robotDim)
119 plug(sot.control, robot.control)
129 taskRH = MetaTaskKine6d(
"rh", dyn,
"rh",
"RWristPitch")
131 handMgrip[0:3, 3] = (0.1, 0, 0)
132 taskRH.opmodif = matrixToTuple(handMgrip)
133 taskRH.feature.frame(
"desired")
137 taskCom.featureDes.errorIN.value = dyn.com.value
138 taskCom.task.controlGain.value = 10
142 for name, joint
in [[
"LF",
"LAnkleRoll"], [
"RF",
"RAnkleRoll"]]:
143 contact = MetaTaskKine6d(
"contact" + name, dyn, name, joint)
144 contact.feature.frame(
"desired")
145 contact.gain.setConstant(10)
147 locals()[
"contact" + name] = contact
149 target = (0.5, -0.2, 1.3)
154 gotoNd(taskRH, target,
"111", (4.9, 0.9, 0.01, 0.9))
155 sot.push(contactRF.task.name)
156 sot.push(contactLF.task.name)
157 sot.push(taskCom.task.name)
158 sot.push(taskRH.task.name)