Go to the documentation of this file.
    4 import pinocchio 
as pin
 
    8 def df_dq(model, func, q, h=1e-9):
 
    9     """Perform df/dq by num_diff. q is in the lie manifold. 
   10     :params func: function to differentiate f : np.array -> np.array 
   11     :params q: configuration value at which f is differentiated. type np.array 
   16     dq = np.zeros(model.nv)
 
   18     res = np.zeros([len(f0), model.nv])
 
   19     for iq 
in range(model.nv):
 
   28         self.
rmodel = rmodel = pin.buildSampleModelHumanoid()
 
   29         self.
rdata = rmodel.createData()
 
   32         self.
rmodel.lowerPositionLimit[:3] = -1.0
 
   33         self.
rmodel.upperPositionLimit[:3] = -1.0
 
   42         q, vq = self.
q, self.
vq 
   50             """Compute COM velocity""" 
   52             return rdata_fd.vcom[0].
copy()
 
   54         dvc_dqn = 
df_dq(rmodel, 
lambda _q: calc_vc(_q, vq), q)
 
   56         self.assertTrue(np.allclose(dvc_dq, dvc_dqn, atol=np.sqrt(self.
precision)))
 
   59 if __name__ == 
"__main__":
 
  
void randomConfiguration(const LieGroupGenericTpl< LieGroupCollection > &lg, const Eigen::MatrixBase< ConfigL_t > &q0, const Eigen::MatrixBase< ConfigR_t > &q1, const Eigen::MatrixBase< ConfigOut_t > &qout)
def df_dq(model, func, q, h=1e-9)
void getCenterOfMassVelocityDerivatives(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< Matrix3xOut > &vcom_partial_dq)
Computes the partial derivatie of the center-of-mass velocity with respect to the joint configuration...
void integrate(const LieGroupGenericTpl< LieGroupCollection > &lg, const Eigen::MatrixBase< ConfigIn_t > &q, const Eigen::MatrixBase< Tangent_t > &v, const Eigen::MatrixBase< ConfigOut_t > &qout)
Visit a LieGroupVariant to call its integrate method.
const DataTpl< Scalar, Options, JointCollectionTpl >::Vector3 & centerOfMass(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const bool computeSubtreeComs=true)
Computes the center of mass position, velocity and acceleration of a given model according to the cur...
void copy(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const DataTpl< Scalar, Options, JointCollectionTpl > &origin, DataTpl< Scalar, Options, JointCollectionTpl > &dest, KinematicLevel kinematic_level)
Copy part of the data from origin to dest. Template parameter can be used to select at which differen...
void computeAllTerms(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q, const Eigen::MatrixBase< TangentVectorType > &v)
Computes efficiently all the terms needed for dynamic simulation. It is equivalent to the call at the...
pinocchio
Author(s): 
autogenerated on Wed May 28 2025 02:41:14