kinematics-derivatives.py
Go to the documentation of this file.
1 import numpy as np
2 import pinocchio as pin
3 
4 # Create model and data
5 
6 model = pin.buildSampleModelHumanoidRandom()
7 data = model.createData()
8 
9 # Set bounds (by default they are undefinded)
10 
11 model.lowerPositionLimit = -np.ones((model.nq, 1))
12 model.upperPositionLimit = np.ones((model.nq, 1))
13 
14 q = pin.randomConfiguration(model) # joint configuration
15 v = np.random.rand(model.nv, 1) # joint velocity
16 a = np.random.rand(model.nv, 1) # joint acceleration
17 
18 # Evaluate all the terms required by the kinematics derivatives
19 
20 pin.computeForwardKinematicsDerivatives(model, data, q, v, a)
21 
22 # Evaluate the derivatives for a precise joint (e.g. rleg6_joint)
23 
24 joint_name = "rleg6_joint"
25 joint_id = model.getJointId(joint_name)
26 
27 # Derivatives of the spatial velocity with respect to the joint configuration and
28 # velocity vectors.
29 
31  model, data, joint_id, pin.ReferenceFrame.WORLD
32 )
33 # or to get them in the LOCAL frame of the joint
34 (dv_dq_local, dv_dv_local) = pin.getJointVelocityDerivatives(
35  model, data, joint_id, pin.ReferenceFrame.LOCAL
36 )
37 
38 # Derivatives of the spatial acceleration of the joint with respect to the joint
39 # configuration, velocity and acceleration vectors.
40 
41 (dv_dq, da_dq, da_dv, da_da) = pin.getJointAccelerationDerivatives(
42  model, data, joint_id, pin.ReferenceFrame.WORLD
43 )
44 # or to get them in the LOCAL frame of the joint
45 (dv_dq_local, da_dq_local, da_dv_local, da_da_local) = (
46  pin.getJointAccelerationDerivatives(model, data, joint_id, pin.ReferenceFrame.LOCAL)
47 )
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::computeForwardKinematicsDerivatives
void computeForwardKinematicsDerivatives(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)
Computes all the terms required to compute the derivatives of the placement, spatial velocity and acc...
pinocchio::getJointAccelerationDerivatives
void getJointAccelerationDerivatives(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const DataTpl< Scalar, Options, JointCollectionTpl > &data, const Model::JointIndex jointId, const ReferenceFrame rf, const Eigen::MatrixBase< Matrix6xOut1 > &v_partial_dq, const Eigen::MatrixBase< Matrix6xOut2 > &v_partial_dv, const Eigen::MatrixBase< Matrix6xOut3 > &a_partial_dq, const Eigen::MatrixBase< Matrix6xOut4 > &a_partial_dv, const Eigen::MatrixBase< Matrix6xOut5 > &a_partial_da)
Computes the partial derivaties of the spatial acceleration of a given with respect to the joint conf...
pinocchio::getJointVelocityDerivatives
void getJointVelocityDerivatives(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const DataTpl< Scalar, Options, JointCollectionTpl > &data, const Model::JointIndex jointId, const ReferenceFrame rf, const Eigen::MatrixBase< Matrix6xOut1 > &v_partial_dq, const Eigen::MatrixBase< Matrix6xOut2 > &v_partial_dv)
Computes the partial derivaties of the spatial velocity of a given with respect to the joint configur...


pinocchio
Author(s):
autogenerated on Wed May 28 2025 02:41:20