-
Notifications
You must be signed in to change notification settings - Fork 414
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Examples] Add example on how to load a Romeo with Python
- Loading branch information
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Pinocchio examples in Python | ||
|
||
This directory contains minimal examples on how to use **Pinocchio** with the Python bindings. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
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) |