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 = (
10  pinocchio_model_dir
11  + "/example-robot-data/robots/ur_description/urdf/ur5_robot.urdf"
12  if len(argv) < 2
13  else argv[1]
14 )
15 
16 # Load the urdf model
17 model = pinocchio.buildModelFromUrdf(urdf_filename)
18 print("model name: " + model.name)
19 
20 # Create data required by the algorithms
21 data = model.createData()
22 
23 # Sample a random configuration
25 print("q: %s" % q.T)
26 
27 # Perform the forward kinematics over the kinematic tree
28 pinocchio.forwardKinematics(model, data, q)
29 
30 # Print out the placement of each joint of the kinematic tree
31 for name, oMi in zip(model.names, data.oMi):
32  print(("{:<24} : {: .2f} {: .2f} {: .2f}".format(name, *oMi.translation.T.flat)))
pinocchio::randomConfiguration
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::forwardKinematics
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...
path


pinocchio
Author(s):
autogenerated on Sat Jun 1 2024 02:40:37