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
29#include <cstdio>
30
31using namespace fawkes::tf;
32
33int
34main(int argc, char **argv)
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");
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(),
57 res_q.y(),
58 res_q.z(),
59 res_q.w(),
60 res_v.x(),
61 res_v.y(),
62 res_v.z());
63 printf("Done\n");
64
65 return 0;
66}
67
68/// @endcond
A class for handling time.
Definition: time.h:93
bool set_transform(const StampedTransform &transform, const std::string &authority, bool is_static=false)
Add transform information to the tf data structure.
Transform that contains a timestamp and frame IDs.
Definition: types.h:92
Coordinate transforms between any two frames in a system.
Definition: transformer.h:65