Fawkes API Fawkes Development Version
clips_tf_thread.h
1
2/***************************************************************************
3 * clips_tf_thread.h - Transforms feature for CLIPS
4 *
5 * Created: Sat Apr 11 17:28:18 2015
6 * Copyright 2015 Tim Niemueller [www.niemueller.de]
7 ****************************************************************************/
8
9/* This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Library General Public License for more details.
18 *
19 * Read the full text in the LICENSE.GPL file in the doc directory.
20 */
21
22#ifndef _PLUGINS_CLIPS_TF_CLIPS_TF_THREAD_H_
23#define _PLUGINS_CLIPS_TF_CLIPS_TF_THREAD_H_
24
25#include <aspect/configurable.h>
26#include <aspect/logging.h>
27#include <aspect/tf.h>
28#include <core/threading/thread.h>
29#include <plugins/clips/aspect/clips_feature.h>
30
31#include <clipsmm.h>
32
39{
40public:
42 virtual ~ClipsTFThread();
43
44 virtual void init();
45 virtual void loop();
46 virtual void finalize();
47
48 // for CLIPSFeature
49 virtual void clips_context_init(const std::string & env_name,
51 virtual void clips_context_destroyed(const std::string &env_name);
52
53 /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
54protected:
55 virtual void
57 {
58 Thread::run();
59 }
60
61private:
62 bool validate_time(const CLIPS::Values &time);
63 fawkes::Time convert_time(const CLIPS::Values &time);
64 bool validate_point(const CLIPS::Values &point);
65 bool validate_vector3(const CLIPS::Values &vector3);
66 bool validate_quat(const CLIPS::Values &quat);
67
68 CLIPS::Values clips_tf_quat_from_yaw(double yaw);
69 double clips_tf_yaw_from_quat(CLIPS::Values quat);
70
71 CLIPS::Value clips_tf_frame_exists(std::string frame_id);
72 CLIPS::Value
73 clips_tf_can_transform(std::string target_frame, std::string source_frame, CLIPS::Values time);
74 CLIPS::Values clips_tf_transform_point(std::string target_frame,
75 std::string source_frame,
76 CLIPS::Values time,
77 CLIPS::Values point);
78 CLIPS::Values clips_tf_transform_vector(std::string target_frame,
79 std::string source_frame,
80 CLIPS::Values time,
81 CLIPS::Values vector);
82 CLIPS::Values clips_tf_transform_quaternion(std::string target_frame,
83 std::string source_frame,
84 CLIPS::Values time,
85 CLIPS::Values quat);
86
87 CLIPS::Values clips_tf_transform_pose(std::string target_frame,
88 std::string source_frame,
89 CLIPS::Values time,
90 CLIPS::Values translation,
91 CLIPS::Values rotation_quat);
92
93private:
94 std::map<std::string, fawkes::LockPtr<CLIPS::Environment>> envs_;
95 bool debug_;
96};
97
98#endif
Provide protobuf functionality to CLIPS environment.
virtual void clips_context_init(const std::string &env_name, fawkes::LockPtr< CLIPS::Environment > &clips)
Initialize a CLIPS context to use the provided feature.
virtual ~ClipsTFThread()
Destructor.
ClipsTFThread()
Constructor.
virtual void finalize()
Finalize the thread.
virtual void loop()
Code to execute in the thread.
virtual void init()
Initialize the thread.
virtual void run()
Stub to see name in backtrace for easier debugging.
virtual void clips_context_destroyed(const std::string &env_name)
Notification that a CLIPS environment has been destroyed.
Thread aspect to provide a feature to CLIPS environments.
Definition: clips_feature.h:58
CLIPS feature maintainer.
Definition: clips_feature.h:42
Thread aspect to access configuration data.
Definition: configurable.h:33
Thread aspect to log output.
Definition: logging.h:33
Thread class encapsulation of pthreads.
Definition: thread.h:46
A class for handling time.
Definition: time.h:93
Thread aspect to access the transform system.
Definition: tf.h:39