overview-urdf.py
Go to the documentation of this file.
1 import pinocchio
2 from sys import argv
3 from os.path import dirname, join, abspath
4 
5 # This path refers to Pinocchio source code but you can define your own directory here.
6 pinocchio_model_dir = join(dirname(dirname(str(abspath(__file__)))), "models")
7 
8 # You should change here to set up your own URDF file or just pass it as an argument of this example.
9 urdf_filename = pinocchio_model_dir + '/example-robot-data/robots/ur_description/urdf/ur5_robot.urdf' if len(argv)<2 else argv[1]
10 
11 # Load the urdf model
12 model = pinocchio.buildModelFromUrdf(urdf_filename)
13 print('model name: ' + model.name)
14 
15 # Create data required by the algorithms
16 data = model.createData()
17 
18 # Sample a random configuration
20 print('q: %s' % q.T)
21 
22 # Perform the forward kinematics over the kinematic tree
23 pinocchio.forwardKinematics(model,data,q)
24 
25 # Print out the placement of each joint of the kinematic tree
26 for name, oMi in zip(model.names, data.oMi):
27  print(("{:<24} : {: .2f} {: .2f} {: .2f}"
28  .format( name, *oMi.translation.T.flat )))
void forwardKinematics(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q, const Eigen::MatrixBase< TangentVectorType1 > &v, const Eigen::MatrixBase< TangentVectorType2 > &a)
Update the joint placements, spatial velocities and spatial accelerations according to the current jo...
void randomConfiguration(const LieGroupGenericTpl< LieGroupCollection > &lg, const Eigen::MatrixBase< ConfigL_t > &q0, const Eigen::MatrixBase< ConfigR_t > &q1, const Eigen::MatrixBase< ConfigOut_t > &qout)


pinocchio
Author(s):
autogenerated on Tue Jun 1 2021 02:45:04