5 #ifndef __pinocchio_joint_revolute_unbounded_hpp__
6 #define __pinocchio_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"
19 template<
typename _Scalar,
int _Options,
int axis>
26 typedef _Scalar Scalar;
27 enum { Options = _Options };
36 typedef Eigen::Matrix<Scalar,6,NV,Options> U_t;
37 typedef Eigen::Matrix<Scalar,NV,NV,Options> D_t;
38 typedef Eigen::Matrix<Scalar,6,NV,Options> UD_t;
40 PINOCCHIO_JOINT_DATA_BASE_ACCESSOR_DEFAULT_RETURN_TYPE
42 typedef Eigen::Matrix<Scalar,NQ,1,Options> ConfigVector_t;
43 typedef Eigen::Matrix<Scalar,NV,1,Options> TangentVector_t;
46 template<
typename Scalar,
int Options,
int axis>
50 template<
typename Scalar,
int Options,
int axis>
54 template<
typename _Scalar,
int _Options,
int axis>
57 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
59 PINOCCHIO_JOINT_DATA_TYPEDEF_TEMPLATE(JointDerived);
60 PINOCCHIO_JOINT_DATA_BASE_DEFAULT_ACCESSOR
73 : M((Scalar)0,(Scalar)1)
80 static std::string classname()
82 return std::string(
"JointDataRUB") + axisLabel<axis>();
84 std::string shortname()
const {
return classname(); }
88 template<
typename NewScalar,
typename Scalar,
int Options,
int axis>
94 template<
typename _Scalar,
int _Options,
int axis>
96 :
public JointModelBase< JointModelRevoluteUnboundedTpl<_Scalar,_Options,axis> >
98 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
100 PINOCCHIO_JOINT_TYPEDEF_TEMPLATE(JointDerived);
107 using Base::setIndexes;
109 JointDataDerived createData()
const {
return JointDataDerived(); }
111 const std::vector<bool> hasConfigurationLimit()
const
113 return {
false,
false};
116 const std::vector<bool> hasConfigurationLimitInTangent()
const
121 template<
typename ConfigVector>
122 void calc(JointDataDerived & data,
123 const typename Eigen::MatrixBase<ConfigVector> & qs)
const
125 typedef typename ConfigVector::Scalar OtherScalar;
126 typename ConfigVector::template ConstFixedSegmentReturnType<NQ>::Type
127 & q = qs.template segment<NQ> (
idx_q());
129 const OtherScalar & ca = q(0);
130 const OtherScalar & sa = q(1);
132 data.M.setValues(sa,ca);
135 template<
typename ConfigVector,
typename TangentVector>
136 void calc(JointDataDerived & data,
137 const typename Eigen::MatrixBase<ConfigVector> & qs,
138 const typename Eigen::MatrixBase<TangentVector> & vs)
const
140 calc(data,qs.derived());
142 data.v.angularRate() =
static_cast<Scalar
>(vs[
idx_v()]);
145 template<
typename Matrix6Like>
146 void calc_aba(JointDataDerived & data,
const Eigen::MatrixBase<Matrix6Like> & I,
const bool update_I)
const
148 data.U = I.col(Inertia::ANGULAR + axis);
149 data.Dinv[0] = (Scalar)(1)/I(Inertia::ANGULAR + axis,Inertia::ANGULAR + axis);
150 data.UDinv.noalias() = data.U * data.Dinv[0];
153 PINOCCHIO_EIGEN_CONST_CAST(Matrix6Like,I) -= data.UDinv * data.U.transpose();
156 static std::string classname()
158 return std::string(
"JointModelRUB") + axisLabel<axis>();
160 std::string shortname()
const {
return classname(); }
163 template<
typename NewScalar>
176 template<
typename ConfigVectorIn,
typename Scalar,
typename ConfigVectorOut>
177 static void run(
const Eigen::MatrixBase<ConfigVectorIn> & q,
178 const Scalar & scaling,
179 const Scalar & offset,
180 const Eigen::MatrixBase<ConfigVectorOut> & dest)
182 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(ConfigVectorIn,2);
183 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(ConfigVectorOut,2);
185 const typename ConfigVectorIn::Scalar & ca = q(0);
186 const typename ConfigVectorIn::Scalar & sa = q(1);
188 const typename ConfigVectorIn::Scalar & theta = math::atan2(sa,ca);
189 const typename ConfigVectorIn::Scalar & theta_transform = scaling * theta + offset;
191 ConfigVectorOut & dest_ = PINOCCHIO_EIGEN_CONST_CAST(ConfigVectorOut,dest);
192 SINCOS(theta_transform,&dest_.coeffRef(1),&dest_.coeffRef(0));
196 template<
typename Scalar,
int Options,
int axis>
216 #include <boost/type_traits.hpp>
220 template<
typename Scalar,
int Options,
int axis>
222 :
public integral_constant<bool,true> {};
224 template<
typename Scalar,
int Options,
int axis>
226 :
public integral_constant<bool,true> {};
228 template<
typename Scalar,
int Options,
int axis>
230 :
public integral_constant<bool,true> {};
232 template<
typename Scalar,
int Options,
int axis>
234 :
public integral_constant<bool,true> {};
237 #endif // ifndef __pinocchio_joint_revolute_unbounded_hpp__