Verified Commit 426777fe authored by jcarpent's avatar jcarpent Committed by Justin Carpentier
Browse files

[Examples] Update example of loading URDF

parent 36f11f4c
##
## Copyright (c) 2018 CNRS
##
## This file is part of Pinocchio
## Pinocchio is free software: you can redistribute it
## and/or modify it under the terms of the GNU Lesser General Public
## License as published by the Free Software Foundation, either version
## 3 of the License, or (at your option) any later version.
##
## Pinocchio is distributed in the hope that it will be
## useful, but WITHOUT ANY WARRANTY; without even the implied warranty
## of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Lesser Public License for more details. You should have
## received a copy of the GNU Lesser General Public License along with
## Pinocchio If not, see
## <http:##www.gnu.org/licenses/>.
##
##
## In this short script, we show how to a load a robot model from its URDF description.
## Here, the robot model is ROMEO, but a similar approach can be done by with rospkg.
##
import pinocchio as pin
from pinocchio.romeo_wrapper import RomeoWrapper
from pinocchio.romeo_wrapper import RobotWrapper
DISPLAY = False
......@@ -13,16 +36,17 @@ mesh_dir = model_path
urdf_filename = "romeo_small.urdf"
urdf_model_path = model_path + "/romeo_description/urdf/" + urdf_filename
robot = RomeoWrapper(urdf_model_path, [mesh_dir])
robot = RobotWrapper(urdf_model_path, [mesh_dir])
## alias
# alias
model = robot.model
data = robot.data
## do whatever, e.g. compute the center of mass position in the world frame
# do whatever, e.g. compute the center of mass position expressed in the world frame
q0 = robot.q0
com = robot.com(q0)
# This last command is similar to
# This last command is similar to:
com2 = pin.centerOfMass(model,data,q0)
## load model into gepetto-gui
......
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