5 #ifndef __pinocchio_multibody_joint_revolute_unbounded_unaligned_hpp__
6 #define __pinocchio_multibody_joint_revolute_unbounded_unaligned_hpp__
8 #include "pinocchio/fwd.hpp"
9 #include "pinocchio/spatial/inertia.hpp"
10 #include "pinocchio/math/rotation.hpp"
11 #include "pinocchio/math/matrix.hpp"
13 #include "pinocchio/multibody/joint/joint-revolute-unaligned.hpp"
18 template<
typename Scalar,
int Options = 0>
21 template<
typename _Scalar,
int _Options>
29 typedef _Scalar Scalar;
35 typedef Eigen::Matrix<Scalar, NQ, 1, Options> ConfigVector_t;
36 typedef Eigen::Matrix<Scalar, NV, 1, Options> TangentVector_t;
44 typedef Eigen::Matrix<Scalar, 6, NV, Options> F_t;
47 typedef Eigen::Matrix<Scalar, 6, NV, Options> U_t;
48 typedef Eigen::Matrix<Scalar, NV, NV, Options> D_t;
49 typedef Eigen::Matrix<Scalar, 6, NV, Options> UD_t;
51 PINOCCHIO_JOINT_DATA_BASE_ACCESSOR_DEFAULT_RETURN_TYPE
54 template<
typename _Scalar,
int _Options>
58 typedef _Scalar Scalar;
61 template<
typename _Scalar,
int _Options>
65 typedef _Scalar Scalar;
68 template<
typename _Scalar,
int _Options>
70 :
public JointDataBase<JointDataRevoluteUnboundedUnalignedTpl<_Scalar, _Options>>
72 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
75 PINOCCHIO_JOINT_DATA_BASE_DEFAULT_ACCESSOR
77 ConfigVector_t joint_q;
78 TangentVector_t joint_v;
93 ,
joint_v(TangentVector_t::Zero())
94 , M(Transformation_t::Identity())
95 , S(Constraint_t::Vector3::Zero())
96 , v(Constraint_t::Vector3::Zero(), (Scalar)0)
104 template<
typename Vector3Like>
106 :
joint_q(Scalar(1), Scalar(0))
107 ,
joint_v(TangentVector_t::Zero())
108 , M(Transformation_t::Identity())
113 , UDinv(UD_t::Zero())
118 static std::string classname()
120 return std::string(
"JointDataRevoluteUnboundedUnalignedTpl");
122 std::string shortname()
const
131 template<
typename _Scalar,
int _Options>
133 :
public JointModelBase<JointModelRevoluteUnboundedUnalignedTpl<_Scalar, _Options>>
135 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
138 typedef Eigen::Matrix<Scalar, 3, 1, Options> Vector3;
144 using Base::setIndexes;
147 :
axis(Vector3::UnitX())
158 template<
typename Vector3Like>
162 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Vector3Like);
166 JointDataDerived createData()
const
168 return JointDataDerived(
axis);
171 const std::vector<bool> hasConfigurationLimit()
const
173 return {
false,
false};
176 const std::vector<bool> hasConfigurationLimitInTangent()
const
184 return Base::isEqual(other) && internal::comparison_eq(
axis, other.
axis);
187 template<
typename ConfigVector>
188 void calc(JointDataDerived & data,
const typename Eigen::MatrixBase<ConfigVector> & qs)
const
190 data.joint_q = qs.template segment<NQ>(idx_q());
192 const Scalar & ca = data.joint_q(0);
193 const Scalar & sa = data.joint_q(1);
198 template<
typename TangentVector>
200 calc(JointDataDerived & data,
const Blank,
const typename Eigen::MatrixBase<TangentVector> & vs)
203 data.joint_v[0] = vs[idx_v()];
204 data.v.angularRate() = data.joint_v[0];
207 template<
typename ConfigVector,
typename TangentVector>
209 JointDataDerived & data,
210 const typename Eigen::MatrixBase<ConfigVector> & qs,
211 const typename Eigen::MatrixBase<TangentVector> & vs)
const
213 calc(data, qs.derived());
214 data.joint_v[0] = vs[idx_v()];
215 data.v.angularRate() = data.joint_v[0];
218 template<
typename VectorLike,
typename Matrix6Like>
220 JointDataDerived & data,
221 const Eigen::MatrixBase<VectorLike> & armature,
222 const Eigen::MatrixBase<Matrix6Like> & I,
223 const bool update_I)
const
225 data.U.noalias() = I.template middleCols<3>(Motion::ANGULAR) *
axis;
227 Scalar(1) / (
axis.dot(data.U.template segment<3>(Motion::ANGULAR)) + armature[0]);
228 data.UDinv.noalias() = data.U * data.Dinv;
231 PINOCCHIO_EIGEN_CONST_CAST(Matrix6Like, I).noalias() -= data.UDinv * data.U.transpose();
234 static std::string classname()
236 return std::string(
"JointModelRevoluteUnboundedUnaligned");
238 std::string shortname()
const
244 template<
typename NewScalar>
248 ReturnType res(
axis.template cast<NewScalar>());
249 res.setIndexes(
id(), idx_q(), idx_v());
262 #include <boost/type_traits.hpp>
266 template<
typename Scalar,
int Options>
267 struct has_nothrow_constructor<
269 :
public integral_constant<bool, true>
273 template<
typename Scalar,
int Options>
275 :
public integral_constant<bool, true>
279 template<
typename Scalar,
int Options>
280 struct has_nothrow_constructor<
282 :
public integral_constant<bool, true>
286 template<
typename Scalar,
int Options>
288 :
public integral_constant<bool, true>
Main pinocchio namespace.
bool isUnitary(const Eigen::MatrixBase< MatrixLike > &mat, const typename MatrixLike::RealScalar &prec=Eigen::NumTraits< typename MatrixLike::Scalar >::dummy_precision())
Check whether the input matrix is Unitary within the given precision.
JointDataTpl< Scalar, Options, JointCollectionTpl >::TangentVector_t joint_v(const JointDataTpl< Scalar, Options, JointCollectionTpl > &jdata)
Visit a JointDataVariant through JointConfigVisitor to get the joint velocity vector.
JointDataTpl< Scalar, Options, JointCollectionTpl >::ConfigVector_t joint_q(const JointDataTpl< Scalar, Options, JointCollectionTpl > &jdata)
Visit a JointDataVariant through JointConfigVisitor to get the joint configuration vector.
void normalize(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const Eigen::MatrixBase< ConfigVectorType > &qout)
Normalize a configuration vector.
void toRotationMatrix(const Eigen::MatrixBase< Vector3 > &axis, const Scalar &cos_value, const Scalar &sin_value, const Eigen::MatrixBase< Matrix3 > &res)
Computes a rotation matrix from a vector and values of sin and cos orientations values.
JointModelRevoluteUnboundedUnalignedTpl< NewScalar, Options > cast() const
Vector3 axis
axis of rotation of the joint.
Common traits structure to fully define base classes for CRTP.