5 #ifndef __pinocchio_multibody_joint_revolute_unbounded_hpp__
6 #define __pinocchio_multibody_joint_revolute_unbounded_hpp__
8 #include "pinocchio/math/fwd.hpp"
9 #include "pinocchio/math/sincos.hpp"
10 #include "pinocchio/spatial/inertia.hpp"
11 #include "pinocchio/multibody/joint/joint-base.hpp"
12 #include "pinocchio/multibody/joint/joint-revolute.hpp"
17 template<
typename Scalar,
int Options,
int axis>
20 template<
typename _Scalar,
int _Options,
int axis>
28 typedef _Scalar Scalar;
41 typedef Eigen::Matrix<Scalar, 6, NV, Options> U_t;
42 typedef Eigen::Matrix<Scalar, NV, NV, Options> D_t;
43 typedef Eigen::Matrix<Scalar, 6, NV, Options> UD_t;
45 typedef Eigen::Matrix<Scalar, NQ, 1, Options> ConfigVector_t;
46 typedef Eigen::Matrix<Scalar, NV, 1, Options> TangentVector_t;
48 PINOCCHIO_JOINT_DATA_BASE_ACCESSOR_DEFAULT_RETURN_TYPE
51 template<
typename _Scalar,
int _Options,
int axis>
55 typedef _Scalar Scalar;
58 template<
typename _Scalar,
int _Options,
int axis>
62 typedef _Scalar Scalar;
65 template<
typename _Scalar,
int _Options,
int axis>
67 :
public JointDataBase<JointDataRevoluteUnboundedTpl<_Scalar, _Options, axis>>
69 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
72 PINOCCHIO_JOINT_DATA_BASE_DEFAULT_ACCESSOR
74 ConfigVector_t joint_q;
75 TangentVector_t joint_v;
90 ,
joint_v(TangentVector_t::Zero())
91 , M((Scalar)0, (Scalar)1)
100 static std::string classname()
102 return std::string(
"JointDataRUB") + axisLabel<axis>();
104 std::string shortname()
const
111 template<
typename NewScalar,
typename Scalar,
int Options,
int axis>
117 template<
typename _Scalar,
int _Options,
int axis>
119 :
public JointModelBase<JointModelRevoluteUnboundedTpl<_Scalar, _Options, axis>>
121 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
130 using Base::setIndexes;
132 typedef Eigen::Matrix<Scalar, 3, 1, _Options> Vector3;
134 JointDataDerived createData()
const
136 return JointDataDerived();
139 const std::vector<bool> hasConfigurationLimit()
const
141 return {
false,
false};
144 const std::vector<bool> hasConfigurationLimitInTangent()
const
149 template<
typename ConfigVector>
150 void calc(JointDataDerived & data,
const typename Eigen::MatrixBase<ConfigVector> & qs)
const
152 data.joint_q = qs.template segment<NQ>(idx_q());
154 const Scalar & ca = data.joint_q[0];
155 const Scalar & sa = data.joint_q[1];
157 data.M.setValues(sa, ca);
160 template<
typename TangentVector>
162 calc(JointDataDerived & data,
const Blank,
const typename Eigen::MatrixBase<TangentVector> & vs)
165 data.joint_v[0] = vs[idx_v()];
166 data.v.angularRate() = data.joint_v[0];
169 template<
typename ConfigVector,
typename TangentVector>
171 JointDataDerived & data,
172 const typename Eigen::MatrixBase<ConfigVector> & qs,
173 const typename Eigen::MatrixBase<TangentVector> & vs)
const
175 calc(data, qs.derived());
176 data.joint_v[0] = vs[idx_v()];
177 data.v.angularRate() = data.joint_v[0];
180 template<
typename VectorLike,
typename Matrix6Like>
182 JointDataDerived & data,
183 const Eigen::MatrixBase<VectorLike> & armature,
184 const Eigen::MatrixBase<Matrix6Like> & I,
185 const bool update_I)
const
187 data.U = I.col(Inertia::ANGULAR + axis);
189 (Scalar)(1) / (I(Inertia::ANGULAR + axis, Inertia::ANGULAR + axis) + armature[0]);
190 data.UDinv.noalias() = data.U * data.Dinv[0];
193 PINOCCHIO_EIGEN_CONST_CAST(Matrix6Like, I).noalias() -= data.UDinv * data.U.transpose();
196 static std::string classname()
198 return std::string(
"JointModelRUB") + axisLabel<axis>();
200 std::string shortname()
const
205 Vector3 getMotionAxis()
const
210 return Vector3::UnitX();
212 return Vector3::UnitY();
214 return Vector3::UnitZ();
216 assert(
false &&
"must never happen");
222 template<
typename NewScalar>
227 res.setIndexes(
id(), idx_q(), idx_v());
235 template<
typename ConfigVectorIn,
typename Scalar,
typename ConfigVectorOut>
237 const Eigen::MatrixBase<ConfigVectorIn> & q,
238 const Scalar & scaling,
239 const Scalar & offset,
240 const Eigen::MatrixBase<ConfigVectorOut> & dest)
242 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(ConfigVectorIn, 2);
243 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(ConfigVectorOut, 2);
245 const typename ConfigVectorIn::Scalar & ca = q(0);
246 const typename ConfigVectorIn::Scalar & sa = q(1);
248 const typename ConfigVectorIn::Scalar & theta = math::atan2(sa, ca);
249 const typename ConfigVectorIn::Scalar & theta_transform = scaling * theta + offset;
251 ConfigVectorOut & dest_ = PINOCCHIO_EIGEN_CONST_CAST(ConfigVectorOut, dest);
252 SINCOS(theta_transform, &dest_.coeffRef(1), &dest_.coeffRef(0));
256 template<
typename Scalar,
int Options,
int axis>
276 #include <boost/type_traits.hpp>
280 template<
typename Scalar,
int Options,
int axis>
282 :
public integral_constant<bool, true>
286 template<
typename Scalar,
int Options,
int axis>
288 :
public integral_constant<bool, true>
292 template<
typename Scalar,
int Options,
int axis>
294 :
public integral_constant<bool, true>
298 template<
typename Scalar,
int Options,
int axis>
300 :
public integral_constant<bool, true>
Main pinocchio namespace.
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 SINCOS(const S1 &a, S2 *sa, S3 *ca)
Computes sin/cos values of a given input scalar.
Type of the cast of a class C templated by Scalar and Options, to a new NewScalar type....
JointModelRevoluteUnboundedTpl< NewScalar, Options, axis > cast() const
Common traits structure to fully define base classes for CRTP.