Go to the documentation of this file.
15 #include <boost/test/unit_test.hpp>
16 #include <boost/utility/binary.hpp>
19 template<
typename Derived>
20 inline bool isFinite(
const Eigen::MatrixBase<Derived> & x)
22 return ((
x -
x).array() == (
x -
x).array()).all();
27 using namespace Eigen;
40 VectorXd qdot = VectorXd::Random(
model.nv);
41 VectorXd qddot = VectorXd::Zero(
model.nv);
44 BOOST_CHECK(
v.toVector().isApprox(Jrh * qdot, 1e-12));
52 BOOST_CHECK(XJrh.isApprox(rhJrh, 1e-12));
57 BOOST_CHECK(XJrh.isApprox(rhJrh, 1e-12));
64 BOOST_CHECK(w_v.toVector().isApprox(WJrh * qdot));
71 BOOST_CHECK(data_fk.
J.isApprox(
data.J));
74 BOOST_AUTO_TEST_SUITE(BOOST_TEST_MODULE)
81 for (
int j = 1; j <
model.njoints; j++)
102 using namespace Eigen;
110 model, -1 * Eigen::VectorXd::Ones(
model.nq), Eigen::VectorXd::Ones(
model.nq));
111 VectorXd
v = VectorXd::Random(
model.nv);
112 VectorXd
a = VectorXd::Random(
model.nv);
132 BOOST_CHECK(v_idx.isApprox(data_ref.oMi[idx].act(data_ref.v[idx])));
135 const Motion & a_ref = data_ref.oMi[idx].act(data_ref.a[idx]);
136 BOOST_CHECK(a_idx.isApprox(a_ref));
143 v_idx = (Motion::Vector6)(
J *
v);
144 BOOST_CHECK(v_idx.isApprox(data_ref.v[idx]));
146 a_idx = (Motion::Vector6)(
J *
a + dJ *
v);
147 BOOST_CHECK(a_idx.isApprox(data_ref.a[idx]));
157 world_v_local.linear().setZero();
159 v_idx = (Motion::Vector6)(
J *
v);
160 BOOST_CHECK(v_idx.isApprox(worldMlocal.act(data_ref.v[idx])));
162 a_idx = (Motion::Vector6)(
J *
a + dJ *
v);
163 BOOST_CHECK(a_idx.isApprox(
164 world_v_local.cross(worldMlocal.act(data_ref.v[idx])) + worldMlocal.act(data_ref.a[idx])));
170 const double alpha = 1e-8;
171 Eigen::VectorXd q_plus(
model.nq);
186 dJ_ref = (J_ref_plus - J_ref) /
alpha;
193 BOOST_CHECK(dJ.isApprox(dJ_ref, sqrt(
alpha)));
199 const double alpha = 1e-8;
200 Eigen::VectorXd q_plus(
model.nq);
214 dJ_ref = (J_ref_plus - J_ref) /
alpha;
221 BOOST_CHECK(dJ.isApprox(dJ_ref, sqrt(
alpha)));
228 const double alpha = 1e-8;
229 Eigen::VectorXd q_plus(
model.nq);
243 dJ_ref = (J_ref_plus - J_ref) /
alpha;
250 BOOST_CHECK(dJ.isApprox(dJ_ref, sqrt(
alpha)));
256 using namespace Eigen;
263 long flag = BOOST_BINARY(1111);
266 #ifdef _INTENSE_TESTING_
267 const size_t NBT = 1000 * 1000;
269 const size_t NBT = 10;
272 const size_t NBT = 1;
273 std::cout <<
"(the time score in debug mode is not relevant) ";
276 bool verbose = flag & (flag - 1);
278 std::cout <<
"--" << std::endl;
289 std::cout <<
"Compute =\t";
290 timer.
toc(std::cout, NBT);
307 std::cout <<
"Copy =\t";
308 timer.
toc(std::cout, NBT);
325 std::cout <<
"Change frame =\t";
326 timer.
toc(std::cout, NBT);
343 std::cout <<
"Single jacobian =\t";
344 timer.
toc(std::cout, NBT);
348 BOOST_AUTO_TEST_SUITE_END()
void getJointJacobianTimeVariation(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const DataTpl< Scalar, Options, JointCollectionTpl > &data, const JointIndex joint_id, const ReferenceFrame reference_frame, const Eigen::MatrixBase< Matrix6Like > &dJ)
Computes the Jacobian time variation of a specific joint frame expressed either in the world frame (r...
void forwardKinematics(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q)
Update the joint placements according to the current joint configuration.
const DataTpl< Scalar, Options, JointCollectionTpl >::Matrix6x & computeJointJacobiansTimeVariation(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q, const Eigen::MatrixBase< TangentVectorType > &v)
Computes the full model Jacobian variations with respect to time. It corresponds to dJ/dt which depen...
const DataTpl< Scalar, Options, JointCollectionTpl >::Matrix6x & computeJointJacobians(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q)
Computes the full model Jacobian, i.e. the stack of all motion subspace expressed in the world frame....
void humanoidRandom(ModelTpl< Scalar, Options, JointCollectionTpl > &model, bool usingFF=true, bool mimic=false)
Create a humanoid kinematic tree with 6-DOF limbs and random joint placements.
void randomConfiguration(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const Eigen::MatrixBase< ConfigVectorIn1 > &lowerLimits, const Eigen::MatrixBase< ConfigVectorIn2 > &upperLimits, const Eigen::MatrixBase< ReturnType > &qout)
Generate a configuration vector uniformly sampled among provided limits.
ConstLinearRef translation() const
void integrate(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const Eigen::MatrixBase< ConfigVectorType > &q, const Eigen::MatrixBase< TangentVectorType > &v, const Eigen::MatrixBase< ReturnType > &qout)
Integrate a configuration vector for the specified model for a tangent vector during one unit time.
bool isFinite(const Eigen::MatrixBase< Derived > &x)
void getJointJacobian(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const DataTpl< Scalar, Options, JointCollectionTpl > &data, const JointIndex joint_id, const ReferenceFrame reference_frame, const Eigen::MatrixBase< Matrix6Like > &J)
Computes the Jacobian of a specific joint frame expressed in one of the pinocchio::ReferenceFrame opt...
pinocchio::Model model_mimic
static void se3Action(const SE3Tpl< Scalar, Options > &m, const Eigen::MatrixBase< Mat > &iF, Eigen::MatrixBase< MatRet > const &jF)
SE3 action on a set of forces, represented by a 6xN matrix whose each column represent a spatial forc...
BOOST_AUTO_TEST_CASE(test_jacobian)
MotionTpl< Scalar, Options > getVelocity(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const DataTpl< Scalar, Options, JointCollectionTpl > &data, const JointIndex jointId, const ReferenceFrame rf=LOCAL)
Returns the spatial velocity of the joint expressed in the desired reference frame....
Matrix6x J
Jacobian of joint placements.
const DataTpl< Scalar, Options, JointCollectionTpl >::TangentVectorType & rnea(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)
The Recursive Newton-Euler algorithm. It computes the inverse dynamics, aka the joint torques accordi...
void computeJointJacobian(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q, const JointIndex joint_id, const Eigen::MatrixBase< Matrix6Like > &J)
Computes the Jacobian of a specific joint frame expressed in the local frame of the joint and store t...
Eigen::Matrix< Scalar, 6, Eigen::Dynamic, Options > Matrix6x
The 6d jacobian type (temporary)
void test_jacobian_impl(const pinocchio::Model &model, pinocchio::JointIndex joint_id)
void neutral(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const Eigen::MatrixBase< ReturnType > &qout)
Return the neutral configuration element related to the model configuration space.
Main pinocchio namespace.
pinocchio
Author(s):
autogenerated on Thu Apr 10 2025 02:42:19