Fawkes API  Fawkes Development Version
qa_tf_transformer.cpp
1 
2 /***************************************************************************
3  * qa_tf_transformer.cpp - QA for tf transformer
4  *
5  * Created: Thu Oct 20 18:18:39 2011
6  * Copyright 2011 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 // Do not include in api reference
25 ///@cond QA
26 
27 #include <tf/transformer.h>
28 #include <cstdio>
29 
30 using namespace fawkes::tf;
31 
32 int
33 main(int argc, char **argv)
34 {
35 
36  printf("Populating data\n");
37  Quaternion q(0, 0, 0, 1);
38  Vector3 v(1, 0, 0);
39  Transform t(q, v);
40 
41  fawkes::Time time;
42 
43  StampedTransform st(t, time, "/world", "/robot");
44 
45  printf("Setting transform\n");
46  Transformer transformer;
47  transformer.set_transform(st);
48 
49  printf("Looking up transform\n");
50  StampedTransform res;
51  transformer.lookupTransform("/robot", "/world", time, res);
52 
53  Quaternion res_q(res.getRotation());
54  Vector3 res_v(res.getOrigin());
55  printf("Read transform Q (%f,%f,%f,%f) V (%f,%f,%f)\n",
56  res_q.x(), res_q.y(), res_q.z(), res_q.w(),
57  res_v.x(), res_v.y(), res_v.z());
58  printf("Done\n");
59 
60  return 0;
61 }
62 
63 /// @endcond
bool set_transform(const StampedTransform &transform, const std::string &authority, bool is_static=false)
Add transform information to the tf data structure.
A class for handling time.
Definition: time.h:91
Transform that contains a timestamp and frame IDs.
Definition: types.h:96
Coordinate transforms between any two frames in a system.
Definition: transformer.h:68