Verified Commit 36f11f4c authored by jcarpent's avatar jcarpent Committed by Justin Carpentier
Browse files

[Examples] Rename load-romeo into load-urdf

parent 8faa7132
##
## 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 RobotWrapper
from pinocchio.romeo_wrapper import RomeoWrapper
DISPLAY = False
# Load Romeo with 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
urdf_filename = "romeo_small.urdf"
urdf_model_path = model_path + "/romeo_description/urdf/" + urdf_filename
robot = RobotWrapper(urdf_model_path, [mesh_dir])
robot = RomeoWrapper(urdf_model_path, [mesh_dir])
# alias
## alias
model = robot.model
data = robot.data
# do whatever, e.g. compute the center of mass position expressed in the world frame
## 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:
# This last command is similar to
com2 = pin.centerOfMass(model,data,q0)
## load model into gepetto-gui
if DISPLAY:
import gepetto.corbaserver
cl = gepetto.corbaserver.Client()
gui = cl.gui
if gui.nodeExists("world"):
gui.deleteNode("world","ON")
robot.initDisplay(loadModel=False)
robot.loadDisplayModel("pinocchio")
robot.display(robot.q0)
gui = robot.viewer.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