testcomponent.cpp
Go to the documentation of this file.
1 #include <kdl/frames.hpp>
2 #include <rtt/RTT.hpp>
3 #include <rtt/Component.hpp>
4 
5 using namespace RTT;
6 using namespace KDL;
7 using namespace std;
8 
10 private:
16 
22 
28 
29  Vector vectorOperation(const Vector& vector_in)
30  {
31  Vector vector_tmp=prop_vector;
32  prop_vector=vector_in;
33  return vector_tmp;
34  }
35 
36  Rotation rotationOperation(const Rotation& rotation_in)
37  {
38  Rotation rotation_tmp=prop_rotation;
39  prop_rotation=rotation_in;
40  return rotation_tmp;
41  }
42 
43  Frame frameOperation(const Frame& frame_in)
44  {
45  Frame frame_tmp=prop_frame;
46  prop_frame=frame_in;
47  return frame_tmp;
48  }
49 
50  Wrench wrenchOperation(const Wrench& wrench_in)
51  {
52  Wrench wrench_tmp=prop_wrench;
53  prop_wrench=wrench_in;
54  return wrench_tmp;
55  }
56 
57  Twist twistOperation(const Twist& twist_in)
58  {
59  Twist twist_tmp=prop_twist;
60  prop_twist=twist_in;
61  return twist_tmp;
62  }
63 
64 public:
65  KDLTypekitTestComponent(const string& name) : TaskContext(name)
66  {
67  this->addPort("VectorOut", port_vector_out);
68  this->addPort("RotationOut", port_rotation_out);
69  this->addPort("FrameOut", port_frame_out);
70  this->addPort("WrenchOut", port_wrench_out);
71  this->addPort("TwistOut", port_twist_out);
72 
73  this->addEventPort("VectorIn", port_vector_in);
74  this->addEventPort("RotationIn", port_rotation_in);
75  this->addEventPort("FrameIn", port_frame_in);
76  this->addEventPort("WrenchIn", port_wrench_in);
77  this->addEventPort("TwistIn", port_twist_in);
78 
79  this->addOperation("vectorOperation", &KDLTypekitTestComponent::vectorOperation, this);
80  this->addOperation("rotationOperation", &KDLTypekitTestComponent::rotationOperation,this);
81  this->addOperation("frameOperation", &KDLTypekitTestComponent::frameOperation, this);
82  this->addOperation("wrenchOperation", &KDLTypekitTestComponent::wrenchOperation, this);
83  this->addOperation("twistOperation", &KDLTypekitTestComponent::twistOperation, this);
84 
85  this->addProperty("vectorProperty", prop_vector);
86  this->addProperty("rotationProperty", prop_rotation);
87  this->addProperty("frameProperty", prop_frame);
88  this->addProperty("wrenchProperty", prop_wrench);
89  this->addProperty("twistProperty", prop_twist);
90  }
91 
92  void updateHook()
93  {
94  KDL::Vector tmp_vector;
95  if(port_vector_in.read(tmp_vector)==NewData){
96  port_vector_out.write(prop_vector);
97  prop_vector = tmp_vector;
98  }
99 
100  KDL::Rotation tmp_rotation;
101  if(port_rotation_in.read(tmp_rotation)==NewData){
102  port_rotation_out.write(prop_rotation);
103  prop_rotation = tmp_rotation;
104  }
105 
106  KDL::Frame tmp_frame;
107  if(port_frame_in.read(tmp_frame)==NewData){
108  port_frame_out.write(prop_frame);
109  prop_frame = tmp_frame;
110  }
111 
112  KDL::Wrench tmp_wrench;
113  if(port_wrench_in.read(tmp_wrench)==NewData){
114  port_wrench_out.write(prop_wrench);
115  prop_wrench = tmp_wrench;
116  }
117 
118  KDL::Twist tmp_twist;
119  if(port_twist_in.read(tmp_twist)==NewData){
120  port_twist_out.write(prop_twist);
121  prop_twist = tmp_twist;
122  }
123 
124  return;
125  }
126 
127 };
128 
InputPort< Rotation > port_rotation_in
Wrench wrenchOperation(const Wrench &wrench_in)
InputPort< Frame > port_frame_in
OutputPort< Rotation > port_rotation_out
InputPort< Vector > port_vector_in
KDLTypekitTestComponent(const string &name)
OutputPort< Wrench > port_wrench_out
FlowStatus read(base::DataSourceBase::shared_ptr source)
OutputPort< Frame > port_frame_out
OutputPort< Vector > port_vector_out
OutputPort< Twist > port_twist_out
WriteStatus write(const T &sample)
InputPort< Twist > port_twist_in
InputPort< Wrench > port_wrench_in
Twist twistOperation(const Twist &twist_in)
Rotation rotationOperation(const Rotation &rotation_in)
ORO_CREATE_COMPONENT(OCL::logging::Log4cxxAppender)
Vector vectorOperation(const Vector &vector_in)
Frame frameOperation(const Frame &frame_in)


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