Go to the documentation of this file.
4 import pinocchio
as pin
6 from test_case
import PinocchioTestCase
as TestCase
11 self.
model = pin.buildSampleModelHumanoidRandom()
14 qmax = np.full((self.
model.nq, 1), np.pi)
19 self.assertIsNot(mass, np.nan)
21 mass_check = sum([inertia.mass
for inertia
in self.
model.inertias[1:]])
22 self.assertApprox(mass, mass_check)
25 self.assertIsNot(mass_data, np.nan)
26 self.assertApprox(mass, mass_data)
27 self.assertApprox(mass_data, self.
data.mass[0])
31 self.assertApprox(mass, data2.mass[0])
39 for i
in range(self.
model.njoints):
40 self.assertApprox(self.
data.mass[i], data2.mass[i])
48 self.assertApprox(c0, c0_bis)
56 self.assertApprox(c0, c0_bis)
60 self.assertApprox(c0, c0_bis)
62 self.assertApprox(c0, data2.com[0])
63 self.assertApprox(self.
data.com[0], data2.com[0])
72 self.assertApprox(c0, c0_bis)
80 self.assertApprox(c0, c0_bis)
84 self.assertApprox(c0, c0_bis)
89 self.assertApprox(self.
data.com[0], data2.com[0])
90 self.assertApprox(self.
data.vcom[0], data2.vcom[0])
92 self.assertApprox(self.
data.com[0], data3.com[0])
102 self.assertApprox(c0, c0_bis)
110 self.assertApprox(c0, c0_bis)
113 self.assertApprox(c0, c0_bis)
121 self.assertApprox(self.
data.com[0], data2.com[0])
122 self.assertApprox(self.
data.vcom[0], data2.vcom[0])
123 self.assertApprox(self.
data.acom[0], data2.acom[0])
125 self.assertApprox(self.
data.com[0], data3.com[0])
127 self.assertApprox(self.
data.com[0], data4.com[0])
128 self.assertApprox(self.
data.vcom[0], data4.vcom[0])
139 for i
in range(self.
model.njoints):
140 self.assertApprox(self.
data.com[i], data2.com[i])
141 self.assertApprox(self.
data.vcom[i], data2.vcom[i])
142 self.assertApprox(self.
data.acom[i], data2.acom[i])
146 self.assertFalse(np.isnan(Jcom).any())
150 self.assertFalse(np.isnan(Jcom).any())
151 self.assertFalse(np.isnan(self.
data.com[1]).any())
162 self.assertTrue((Jcom_no == Jcom_up).all())
173 self.assertTrue((Jcom_no == Jcom_up).all())
174 self.assertTrue((data_no.com[1] == data_up.com[1]).all())
182 self.assertApprox(Jcom, Jcom_subtree)
184 data2 = model.createData()
186 self.assertApprox(Jcom_subtree, Jcom_subtree2)
188 data3 = model.createData()
190 self.assertApprox(Jcom_subtree3, Jcom_subtree2)
193 self.assertApprox(Jcom_subtree3, Jcom_subtree4)
196 if __name__ ==
"__main__":
def test_com_default(self)
void randomConfiguration(const LieGroupGenericTpl< LieGroupCollection > &lg, const Eigen::MatrixBase< ConfigL_t > &q0, const Eigen::MatrixBase< ConfigR_t > &q1, const Eigen::MatrixBase< ConfigOut_t > &qout)
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 jacobianSubtreeCenterOfMass(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const JointIndex &rootSubtreeId, const Eigen::MatrixBase< Matrix3xLike > &res)
Computes the Jacobian of the center of mass of the given subtree according to the current value store...
def test_Jcom_noupdate3(self)
Scalar computeTotalMass(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data)
Compute the total mass of the model, put it in data.mass[0] and return it.
ConstraintDataTpl< Scalar, Options, ConstraintCollectionTpl > createData(const ConstraintModelTpl< Scalar, Options, ConstraintCollectionTpl > &cmodel)
void computeSubtreeMasses(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data)
Compute the mass of each kinematic subtree and store it in data.mass. The element mass[0] corresponds...
def test_subtree_masses(self)
def test_Jcom_noupdate2(self)
void getJacobianSubtreeCenterOfMass(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const DataTpl< Scalar, Options, JointCollectionTpl > &data, const JointIndex &rootSubtreeId, const Eigen::MatrixBase< Matrix3xLike > &res)
Retrieves the Jacobian of the center of mass of the given subtree according to the current value stor...
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...
const DataTpl< Scalar, Options, JointCollectionTpl >::Matrix3x & jacobianCenterOfMass(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const bool computeSubtreeComs=true)
Computes both the jacobian and the the center of mass position of a given model according to the curr...
def test_Jcom_update4(self)
def test_subtree_jacobian(self)
def test_Jcom_update3(self)
pinocchio
Author(s):
autogenerated on Wed May 28 2025 02:41:14