Commit 3f2cd506 authored by jcarpent's avatar jcarpent
Browse files

[Examples] Add example on how to load a Romeo with Python

parent 08e3a703
# Pinocchio examples in Python
This directory contains minimal examples on how to use **Pinocchio** with the Python bindings.
import pinocchio as pin
from pinocchio.romeo_wrapper import RomeoWrapper
## Load Romeo with RomeoWrapper
import os
current_path = os.getcwd()
# The model of Romeo is contained in the path PINOCCHIO_GIT_REPOSITORY/models/romeo
model_path = current_path + "/" + "../../models/romeo"
mesh_dir = model_path
urdf_filename = "romeo.urdf"
urdf_model_path = model_path + "/urdf/" + urdf_filename
robot = RomeoWrapper(urdf_model_path, [mesh_dir])
## alias
model = robot.model
data = robot.data
## do whatever, e.g. compute the center of mass position in the world frame
q0 = robot.q0
com = robot.com(q0)
# This last command is similar to
com2 = pin.centerOfMass(model,data,q0)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment