18 #ifndef __se3_lie_group_algo_hxx__ 19 #define __se3_lie_group_algo_hxx__ 21 #include "pinocchio/multibody/visitor.hpp" 28 template<
typename Algo>
32 typename Algo::ArgsType args)
34 for (
size_t i = 0; i < jmodel.
joints.size(); ++i)
35 Algo::run(jmodel.
joints[i], args);
39 #define SE3_DETAILS_WRITE_ARGS_0(JM) const JointModelBase<JM> & jmodel 40 #define SE3_DETAILS_WRITE_ARGS_1(JM) SE3_DETAILS_WRITE_ARGS_0(JM), typename boost::fusion::result_of::at_c<ArgsType, 0>::type a0 41 #define SE3_DETAILS_WRITE_ARGS_2(JM) SE3_DETAILS_WRITE_ARGS_1(JM), typename boost::fusion::result_of::at_c<ArgsType, 1>::type a1 42 #define SE3_DETAILS_WRITE_ARGS_3(JM) SE3_DETAILS_WRITE_ARGS_2(JM), typename boost::fusion::result_of::at_c<ArgsType, 2>::type a2 43 #define SE3_DETAILS_WRITE_ARGS_4(JM) SE3_DETAILS_WRITE_ARGS_3(JM), typename boost::fusion::result_of::at_c<ArgsType, 3>::type a3 45 #define SE3_DETAILS_DISPATCH_JOINT_COMPOSITE_1(Visitor, Algo) \ 46 template <typename LieGroup_t> struct Algo <LieGroup_t, JointModelComposite> { \ 47 typedef typename Visitor<LieGroup_t>::ArgsType ArgsType; \ 48 static void run (SE3_DETAILS_WRITE_ARGS_1(JointModelComposite)) \ 49 { ::se3::details::Dispatch< Visitor<LieGroup_t> >::run(jmodel.derived(), ArgsType(a0)); } \ 52 #define SE3_DETAILS_DISPATCH_JOINT_COMPOSITE_2(Visitor, Algo) \ 53 template <typename LieGroup_t> struct Algo <LieGroup_t, JointModelComposite> { \ 54 typedef typename Visitor<LieGroup_t>::ArgsType ArgsType; \ 55 static void run (SE3_DETAILS_WRITE_ARGS_2(JointModelComposite)) \ 56 { ::se3::details::Dispatch< Visitor<LieGroup_t> >::run(jmodel.derived(), ArgsType(a0, a1)); } \ 59 #define SE3_DETAILS_DISPATCH_JOINT_COMPOSITE_3(Visitor, Algo) \ 60 template <typename LieGroup_t> struct Algo <LieGroup_t, JointModelComposite> { \ 61 typedef typename Visitor<LieGroup_t>::ArgsType ArgsType; \ 62 static void run (SE3_DETAILS_WRITE_ARGS_3(JointModelComposite)) \ 63 { ::se3::details::Dispatch< Visitor<LieGroup_t> >::run(jmodel.derived(), ArgsType(a0, a1, a2)); } \ 66 #define SE3_DETAILS_DISPATCH_JOINT_COMPOSITE_4(Visitor, Algo) \ 67 template <typename LieGroup_t> struct Algo <LieGroup_t, JointModelComposite> { \ 68 typedef typename Visitor<LieGroup_t>::ArgsType ArgsType; \ 69 static void run (SE3_DETAILS_WRITE_ARGS_4(JointModelComposite)) \ 70 { ::se3::details::Dispatch< Visitor<LieGroup_t> >::run(jmodel.derived(), ArgsType(a0, a1, a2, a3)); } \ 73 #define SE3_DETAILS_VISITOR_METHOD_ALGO_1(Algo, TplParam) \ 74 template<typename JointModel> \ 75 static void algo(SE3_DETAILS_WRITE_ARGS_1(JointModel)) \ 76 { Algo<TplParam, JointModel>::run(jmodel, a0); } 78 #define SE3_DETAILS_VISITOR_METHOD_ALGO_2(Algo, TplParam) \ 79 template<typename JointModel> \ 80 static void algo(SE3_DETAILS_WRITE_ARGS_2(JointModel)) \ 81 { Algo<TplParam, JointModel>::run(jmodel, a0, a1); } 83 #define SE3_DETAILS_VISITOR_METHOD_ALGO_3(Algo, TplParam) \ 84 template<typename JointModel> \ 85 static void algo(SE3_DETAILS_WRITE_ARGS_3(JointModel)) \ 86 { Algo<TplParam, JointModel>::run(jmodel, a0, a1, a2); } 88 #define SE3_DETAILS_VISITOR_METHOD_ALGO_4(Algo, TplParam) \ 89 template<typename JointModel> \ 90 static void algo(SE3_DETAILS_WRITE_ARGS_4(JointModel)) \ 91 { Algo<TplParam, JointModel>::run(jmodel, a0, a1, a2, a3); } 97 template<
typename LieGroup_t>
100 typedef boost::fusion::vector<
const Eigen::VectorXd &,
101 const Eigen::VectorXd &,
110 template<
typename LieGroup_t,
typename Jo
intModel>
113 const Eigen::VectorXd & q,
114 const Eigen::VectorXd & v,
115 Eigen::VectorXd & result)
117 typename LieGroup_t::template operation<JointModel>::type lgo;
118 lgo.integrate(jmodel.jointConfigSelector (q),
119 jmodel.jointVelocitySelector(v),
120 jmodel.jointConfigSelector (result));
128 template<
typename LieGroup_t>
131 typedef boost::fusion::vector<
const Eigen::VectorXd &,
132 const Eigen::VectorXd &,
142 template<
typename LieGroup_t,
typename Jo
intModel>
145 const Eigen::VectorXd & q0,
146 const Eigen::VectorXd & q1,
148 Eigen::VectorXd & result)
150 typename LieGroup_t::template operation<JointModel>::type lgo;
151 lgo.interpolate(jmodel.jointConfigSelector(q0),
152 jmodel.jointConfigSelector(q1),
154 jmodel.jointConfigSelector(result));
162 template<
typename LieGroup_t>
165 typedef boost::fusion::vector<
const Eigen::VectorXd &,
166 const Eigen::VectorXd &,
175 template<
typename LieGroup_t,
typename Jo
intModel>
178 const Eigen::VectorXd & q0,
179 const Eigen::VectorXd & q1,
180 Eigen::VectorXd & result)
182 typename LieGroup_t::template operation<JointModel>::type lgo;
183 lgo.difference(jmodel.jointConfigSelector(q0),
184 jmodel.jointConfigSelector(q1),
185 jmodel.jointVelocitySelector(result));
193 template<
typename LieGroup_t>
196 typedef boost::fusion::vector<
const JointIndex,
197 const Eigen::VectorXd &,
198 const Eigen::VectorXd &,
207 template<
typename LieGroup_t,
typename Jo
intModel>
211 const Eigen::VectorXd & q0,
212 const Eigen::VectorXd & q1,
213 Eigen::VectorXd & distances)
215 typename LieGroup_t::template operation<JointModel>::type lgo;
216 distances[(long)i] += lgo.squaredDistance(jmodel.jointConfigSelector(q0),
217 jmodel.jointConfigSelector(q1));
225 template<
typename LieGroup_t>
228 typedef boost::fusion::vector<Eigen::VectorXd &,
229 const Eigen::VectorXd &,
230 const Eigen::VectorXd &
238 template<
typename LieGroup_t,
typename Jo
intModel>
242 const Eigen::VectorXd & lowerLimits,
243 const Eigen::VectorXd & upperLimits)
245 typename LieGroup_t::template operation<JointModel>::type lgo;
246 lgo.randomConfiguration(jmodel.jointConfigSelector(lowerLimits),
247 jmodel.jointConfigSelector(upperLimits),
248 jmodel.jointConfigSelector(q));
258 template<
typename LieGroup_t>
261 typedef boost::fusion::vector<Eigen::VectorXd &> ArgsType;
268 template<
typename LieGroup_t,
typename Jo
intModel>
272 Eigen::VectorXd & qout)
274 typename LieGroup_t::template operation<JointModel>::type lgo;
275 lgo.normalize(jmodel.jointConfigSelector(qout));
283 template<
typename LieGroup_t>
286 typedef boost::fusion::vector<
bool &,
287 const Eigen::VectorXd &,
288 const Eigen::VectorXd &,
289 const double&> ArgsType;
296 template<
typename LieGroup_t,
typename Jo
intModel>
300 const Eigen::VectorXd & q1,
301 const Eigen::VectorXd & q2,
304 typename LieGroup_t::template operation<JointModel>::type lgo;
305 isSame &= lgo.isSameConfiguration(jmodel.jointConfigSelector(q1),
306 jmodel.jointConfigSelector(q2),
315 template<
typename LieGroup_t>
318 typedef boost::fusion::vector<Eigen::VectorXd &> ArgsType;
325 template<
typename LieGroup_t,
typename Jo
intModel>
329 Eigen::VectorXd & neutral_elt)
331 typename LieGroup_t::template operation<JointModel>::type lgo;
332 jmodel.jointConfigSelector(neutral_elt) = lgo.neutral();
340 #endif // ifndef __se3_lie_group_algo_hxx__
JointModelVector joints
Vector of joints contained in the joint composite.