kdlTypekitOperators.cpp
Go to the documentation of this file.
1 #include "kdlTypekit.hpp"
2 #include <kdl/frames.hpp>
3 
4 namespace KDL{
5 
6  Rotation Inverse(const Rotation& rot){
7  return rot.Inverse();
8  }
9 
10  Frame Inverse(const Frame& f){
11  return f.Inverse();
12  }
13 
14  void GetQuaternion(const Rotation& rot,double& x, double& y, double& z, double& w){
15  rot.GetQuaternion(x,y,z,w);
16  }
17 
19  {
20  OperatorRepository::shared_ptr oreg = OperatorRepository::Instance();
21 
22  oreg->add( newBinaryOperator( "==", std::equal_to<Frame>() ) );
23  oreg->add( newBinaryOperator( "!=", std::not_equal_to<Frame>() ) );
24  oreg->add( newBinaryOperator( "==", std::equal_to<Vector>() ) );
25  oreg->add( newBinaryOperator( "!=", std::not_equal_to<Vector>() ) );
26  oreg->add( newBinaryOperator( "==", std::equal_to<Rotation>() ) );
27  oreg->add( newBinaryOperator( "!=", std::not_equal_to<Rotation>() ) );
28  oreg->add( newBinaryOperator( "==", std::equal_to<Wrench>() ) );
29  oreg->add( newBinaryOperator( "!=", std::not_equal_to<Wrench>() ) );
30  oreg->add( newBinaryOperator( "==", std::equal_to<Twist>() ) );
31  oreg->add( newBinaryOperator( "!=", std::not_equal_to<Twist>() ) );
32  oreg->add( newUnaryOperator( "-", std::negate<Vector>() ) );
33  oreg->add( newBinaryOperator( "*", std::multiplies<Vector>() ) );
34  oreg->add( newBinaryOperator( "*", std::multiplies<Frame>() ) );
35  oreg->add( newBinaryOperator( "*", std::multiplies<Rotation>() ) );
36  oreg->add( newBinaryOperator( "+", std::plus<Vector>() ) );
37  oreg->add( newBinaryOperator( "-", std::minus<Vector>() ) );
38  oreg->add( newBinaryOperator( "+", std::plus<Wrench>() ) );
39  oreg->add( newBinaryOperator( "-", std::minus<Wrench>() ) );
40  oreg->add( newBinaryOperator( "+", std::plus<Twist>() ) );
41  oreg->add( newBinaryOperator( "-", std::minus<Twist>() ) );
42  oreg->add( newBinaryOperator( "*", multiplies3<Vector,int, Vector>() ) );
43  oreg->add( newBinaryOperator( "*", multiplies3<Vector,Vector, int>() ) );
44  oreg->add( newBinaryOperator( "*", multiplies3<Vector,double, Vector>() ) );
45  oreg->add( newBinaryOperator( "*", multiplies3<Vector,Vector, double>() ) );
46  oreg->add( newBinaryOperator( "*", multiplies3<Wrench, Frame, Wrench>() ) );
47  oreg->add( newBinaryOperator( "*", multiplies3<Twist, Frame, Twist>() ) );
48  oreg->add( newBinaryOperator( "*", multiplies3<Vector, Frame, Vector>() ) );
49  oreg->add( newBinaryOperator( "*", multiplies3<Vector, Rotation, Vector>() ) );
50  oreg->add( newBinaryOperator( "/", divides3<Vector, Vector, double>() ) );
51  oreg->add( newBinaryOperator( "/", divides3<Wrench, Wrench, double>() ) );
52  oreg->add( newBinaryOperator( "/", divides3<Twist, Twist, double>() ) );
53 
55 
56  gs->provides("KDL")->provides("Vector")->addOperation("diff",(Vector (*) (const Vector&, const Vector&, double)) &diff).doc("");
57  gs->provides("KDL")->provides("Vector")->addOperation("addDelta",(Vector (*) (const Vector&, const Vector&, double)) &addDelta).doc("");
58 
59  gs->provides("KDL")->provides("Rotation")->addOperation("diff",(Vector (*) (const Rotation&, const Rotation&, double)) &diff).doc("");
60  gs->provides("KDL")->provides("Rotation")->addOperation("addDelta",(Rotation (*) (const Rotation&, const Vector&, double)) &addDelta).doc("");
61  gs->provides("KDL")->provides("Rotation")->addOperation("Inverse",(Rotation (*) (const Rotation&)) &Inverse).doc("");
62  gs->provides("KDL")->provides("Rotation")->addOperation("GetQuaternion",(void (*)(const Rotation&, double&, double&, double&, double&)) &GetQuaternion).doc("");
63 
64  gs->provides("KDL")->provides("Twist")->addOperation("diff",(Twist (*) (const Twist&, const Twist&, double)) &diff).doc("");
65  gs->provides("KDL")->provides("Wrench")->addOperation("diff",(Wrench (*) (const Wrench&, const Wrench&, double)) &diff).doc("");
66 
67  gs->provides("KDL")->provides("Frame")->addOperation("diff",(Twist (*) (const Frame&, const Frame&, double)) &diff)
68  .doc("Returns the twist that is needed to move from frame f1 to frame f2 in a time d. The resulting twist is represented in the same reference frame as f1 and f2, and has reference point at the origin of f1");
69  gs->provides("KDL")->provides("Frame")->addOperation("addDelta", (Frame (*) (const Frame&, const Twist&, double)) &addDelta)
70  .doc("Constructs a frame that is obtained by: starting from frame f, apply twist t, during time d");
71  gs->provides("KDL")->provides("Frame")->addOperation("Inverse",(Frame (*) (const Frame&)) &Inverse).doc("");
72  return true;
73  }
74 }
IMETHOD doubleVel diff(const doubleVel &a, const doubleVel &b, double dt=1.0)
Rotation Inverse() const
void GetQuaternion(double &x, double &y, double &z, double &w) const
boost::shared_ptr< Service > shared_ptr
BinaryOperator< function > * newBinaryOperator(const char *op, function f)
Frame Inverse() const
UnaryOperator< function > * newUnaryOperator(const char *op, function f)
Rotation Inverse(const Rotation &rot)
IMETHOD doubleVel addDelta(const doubleVel &a, const doubleVel &da, double dt=1.0)
void GetQuaternion(const Rotation &rot, double &x, double &y, double &z, double &w)
static RTT_API Service::shared_ptr Instance()


kdl_typekit
Author(s): Steven Bellens, Ruben Smits
autogenerated on Wed Jul 3 2019 19:39:45