2 import pinocchio
as pin
10 LangCDefaultVariableNameGenerator,
14 pinmodel = pin.buildSampleModelHumanoidRandom()
15 model = cgpin.Model(pinmodel)
16 data = model.createData()
21 x = np.array([ADCG(CG(0.0))] * (nq + nv + nv))
22 x[:nq] = cgpin.neutral(model)
25 y = cgpin.rnea(model, data, x[:nq], x[nq : nq + nv], x[nq + nv :])
36 handler = CodeHandler(50)
38 indVars = np.array([CG(1.0)] * (nq + nv + nv))
39 handler.makeVariables(indVars)
41 jac = fun.Jacobian(indVars)
43 langC = LanguageC(
"double", 3)
44 nameGen = LangCDefaultVariableNameGenerator(
"y",
"x",
"v",
"array",
"sarray")
45 code = handler.generateCode(langC, jac, nameGen,
"source")