Skip to content

Commit fbaa760

Browse files
committed
constraints: RigidConstraintModelTpl inherits from KinematicsConstraintModelBase
1 parent d85bd07 commit fbaa760

File tree

1 file changed

+12
-24
lines changed

1 file changed

+12
-24
lines changed

include/pinocchio/algorithm/contact-info.hpp

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Copyright (c) 2019-2024 INRIA CNRS
2+
// Copyright (c) 2019-2025 INRIA
33
//
44

55
#ifndef __pinocchio_algorithm_contact_info_hpp__
@@ -11,7 +11,7 @@
1111
#include "pinocchio/spatial/skew.hpp"
1212
#include "pinocchio/algorithm/fwd.hpp"
1313
#include "pinocchio/algorithm/constraints/fwd.hpp"
14-
#include "pinocchio/algorithm/constraints/constraint-model-base.hpp"
14+
#include "pinocchio/algorithm/constraints/kinematics-constraint-base.hpp"
1515
#include "pinocchio/algorithm/constraints/constraint-data-base.hpp"
1616
#include "pinocchio/algorithm/constraints/baumgarte-corrector-parameters.hpp"
1717
#include "pinocchio/algorithm/constraints/baumgarte-corrector-vector-parameters.hpp"
@@ -131,7 +131,8 @@ namespace pinocchio
131131
///
132132
template<typename _Scalar, int _Options>
133133
struct PINOCCHIO_UNSUPPORTED_MESSAGE("The API will change towards more flexibility")
134-
RigidConstraintModelTpl : ConstraintModelBase<RigidConstraintModelTpl<_Scalar, _Options>>
134+
RigidConstraintModelTpl
135+
: KinematicsConstraintModelBase<RigidConstraintModelTpl<_Scalar, _Options>>
135136
{
136137
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
137138

@@ -142,7 +143,7 @@ namespace pinocchio
142143
};
143144

144145
typedef RigidConstraintModelTpl Self;
145-
typedef ConstraintModelBase<Self> Base;
146+
typedef KinematicsConstraintModelBase<Self> Base;
146147

147148
template<typename NewScalar, int NewOptions>
148149
friend struct RigidConstraintModelTpl;
@@ -178,15 +179,10 @@ namespace pinocchio
178179
typedef Eigen::Matrix<Scalar, 6, 1, Options> Vector6;
179180
typedef Eigen::Matrix<Scalar, Eigen::Dynamic, 1, Options> VectorXs;
180181

182+
using Base::joint1_id, Base::joint2_id;
181183
///  \brief Type of the contact.
182184
ContactType type;
183185

184-
/// \brief Index of the first joint in the model tree
185-
JointIndex joint1_id;
186-
187-
/// \brief Index of the second joint in the model tree
188-
JointIndex joint2_id;
189-
190186
/// \brief Relative placement with respect to the frame of joint1.
191187
SE3 joint1_placement;
192188

@@ -275,10 +271,8 @@ namespace pinocchio
275271
const JointIndex joint2_id,
276272
const SE3 & joint2_placement,
277273
const ReferenceFrame & reference_frame = LOCAL)
278-
: Base(model)
274+
: Base(model, joint1_id, joint2_id)
279275
, type(type)
280-
, joint1_id(joint1_id)
281-
, joint2_id(joint2_id)
282276
, joint1_placement(joint1_placement)
283277
, joint2_placement(joint2_placement)
284278
, reference_frame(reference_frame)
@@ -312,10 +306,8 @@ namespace pinocchio
312306
const JointIndex joint1_id,
313307
const SE3 & joint1_placement,
314308
const ReferenceFrame & reference_frame = LOCAL)
315-
: Base(model)
309+
: Base(model, joint1_id, 0)
316310
, type(type)
317-
, joint1_id(joint1_id)
318-
, joint2_id(0)
319311
, joint1_placement(joint1_placement)
320312
, joint2_placement(SE3::Identity())
321313
, reference_frame(reference_frame)
@@ -347,10 +339,8 @@ namespace pinocchio
347339
const JointIndex joint1_id,
348340
const JointIndex joint2_id,
349341
const ReferenceFrame & reference_frame = LOCAL)
350-
: Base(model)
342+
: Base(model, joint1_id, joint2_id)
351343
, type(type)
352-
, joint1_id(joint1_id)
353-
, joint2_id(joint2_id)
354344
, joint1_placement(SE3::Identity())
355345
, joint2_placement(SE3::Identity())
356346
, reference_frame(reference_frame)
@@ -383,10 +373,8 @@ namespace pinocchio
383373
const ModelTpl<Scalar, OtherOptions, JointCollectionTpl> & model,
384374
const JointIndex joint1_id,
385375
const ReferenceFrame & reference_frame = LOCAL)
386-
: Base(model)
376+
: Base(model, joint1_id, 0)
387377
, type(type)
388-
, joint1_id(joint1_id)
389-
, joint2_id(0) // set to be the Universe
390378
, joint1_placement(SE3::Identity())
391379
, joint2_placement(SE3::Identity())
392380
, reference_frame(reference_frame)
@@ -503,8 +491,8 @@ namespace pinocchio
503491
template<int OtherOptions>
504492
bool operator==(const RigidConstraintModelTpl<Scalar, OtherOptions> & other) const
505493
{
506-
return base() == other.base() && type == other.type && joint1_id == other.joint1_id
507-
&& joint2_id == other.joint2_id && joint1_placement == other.joint1_placement
494+
return base() == other.base() && type == other.type
495+
&& joint1_placement == other.joint1_placement
508496
&& joint2_placement == other.joint2_placement
509497
&& reference_frame == other.reference_frame && corrector == other.corrector
510498
&& colwise_joint1_sparsity == other.colwise_joint1_sparsity

0 commit comments

Comments
 (0)