Skip to content

Commit

Permalink
Merge pull request #2284 from florent-lamiraux/devel
Browse files Browse the repository at this point in the history
Some minor modifications necessary to upgrade HPP
  • Loading branch information
jcarpent committed Jun 18, 2024
2 parents df3aa95 + 317a9fa commit be4a836
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

### Fixed

- Fix `appendModel` build when called with template arguments different than the ones from `context` ([#2284](https://github.com/stack-of-tasks/pinocchio/pull/2284))
- Fix `TransformRevoleTpl::rotation` and `TransformHelicalTpl::rotation` build ([#2284](https://github.com/stack-of-tasks/pinocchio/pull/2284))
- Fix compilation issue for Boost 1.85 ([#2255](https://github.com/stack-of-tasks/pinocchio/pull/2255))
- Fix python bindings of `contactInverseDynamics` ([#2263](https://github.com/stack-of-tasks/pinocchio/pull/2263))
- Deactivate `BUILD_WITH_LIBPYTHON` when building with PyPy ([#2274](https://github.com/stack-of-tasks/pinocchio/pull/2274))
Expand Down
8 changes: 4 additions & 4 deletions include/pinocchio/algorithm/model.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,8 @@ namespace pinocchio
for (JointIndex joint_idA = 1; joint_idA < modelA.joints.size(); ++joint_idA)
{
const JointIndex joint_id = model.getJointId(modelA.names[joint_idA]);
const JointModel & joint_model = model.joints[joint_id];
const JointModel & joint_modelA = modelA.joints[joint_idA];
const typename Model::JointModel & joint_model = model.joints[joint_id];
const typename Model::JointModel & joint_modelA = modelA.joints[joint_idA];

joint_model.jointConfigSelector(config_vector) =
joint_modelA.jointConfigSelector(config_vectorA);
Expand Down Expand Up @@ -409,8 +409,8 @@ namespace pinocchio
for (JointIndex joint_idB = 1; joint_idB < modelB.joints.size(); ++joint_idB)
{
const JointIndex joint_id = model.getJointId(modelB.names[joint_idB]);
const JointModel & joint_model = model.joints[joint_id];
const JointModel & joint_modelB = modelB.joints[joint_idB];
const typename Model::JointModel & joint_model = model.joints[joint_id];
const typename Model::JointModel & joint_modelB = modelB.joints[joint_idB];

joint_model.jointConfigSelector(config_vector) =
joint_modelB.jointConfigSelector(config_vectorB);
Expand Down
4 changes: 2 additions & 2 deletions include/pinocchio/multibody/joint/joint-helical.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ namespace pinocchio
typedef Matrix3 AngularType;
typedef Matrix3 AngularRef;
typedef Matrix3 ConstAngularRef;
typedef typename Vector3::ConstantReturnType LinearType;
typedef Vector3 LinearType;
typedef typename Vector3::ConstantReturnType LinearRef;
typedef const typename Vector3::ConstantReturnType ConstLinearRef;
typedef typename traits<PlainType>::ActionMatrixType ActionMatrixType;
Expand Down Expand Up @@ -201,7 +201,7 @@ namespace pinocchio
}
AngularType rotation() const
{
AngularType m(AngularType::Identity(3));
AngularType m(AngularType::Identity());
_setRotation(m);
return m;
}
Expand Down
2 changes: 1 addition & 1 deletion include/pinocchio/multibody/joint/joint-revolute.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ namespace pinocchio
}
AngularType rotation() const
{
AngularType m(AngularType::Identity(3));
AngularType m(AngularType::Identity());
_setRotation(m);
return m;
}
Expand Down
20 changes: 20 additions & 0 deletions unittest/all-joints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,18 @@ struct TestJointModelIsEqual : TestJointModel<TestJointModelIsEqual>
}
};

struct TestJointModelTransform : TestJointModel<TestJointModelTransform>
{
template<typename JointModel>
static void test(const JointModelBase<JointModel> & jmodel)
{
typedef typename JointModel::JointDataDerived JointData;
JointData jdata = jmodel.createData();
Eigen::Matrix<typename JointModel::Scalar, 3, 1> v = jdata.M_accessor().translation();
Eigen::Matrix<typename JointModel::Scalar, 3, 3> R = jdata.M_accessor().rotation();
}
};

BOOST_AUTO_TEST_CASE(isEqual)
{
typedef JointCollectionDefault::JointModelVariant JointModelVariant;
Expand All @@ -211,6 +223,14 @@ BOOST_AUTO_TEST_CASE(isEqual)
BOOST_CHECK(jmodel_any != jmodelx);
}

BOOST_AUTO_TEST_CASE(transform)
{
typedef JointCollectionDefault::JointModelVariant JointModelVariant;
boost::mpl::for_each<JointModelVariant::types>(TestJointModelTransform());

TestJointModelTransform()(JointModel());
}

struct TestJointModelCast : TestJointModel<TestJointModelCast>
{
template<typename JointModel>
Expand Down

0 comments on commit be4a836

Please sign in to comment.