hlrc / server / include / MiddlewareROS.h @ c6fcfba9
History | View | Annotate | Download (3.284 KB)
1 | 0c286af0 | Simon Schulz | /*
|
---|---|---|---|
2 | * This file is part of hlrc_server
|
||
3 | *
|
||
4 | * Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
|
||
5 | * http://opensource.cit-ec.de/projects/hlrc_server
|
||
6 | *
|
||
7 | * This file may be licensed under the terms of the
|
||
8 | * GNU General Public License Version 3 (the ``GPL''),
|
||
9 | * or (at your option) any later version.
|
||
10 | *
|
||
11 | * Software distributed under the License is distributed
|
||
12 | * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
|
||
13 | * express or implied. See the GPL for the specific language
|
||
14 | * governing rights and limitations.
|
||
15 | *
|
||
16 | * You should have received a copy of the GPL along with this
|
||
17 | * program. If not, go to http://www.gnu.org/licenses/gpl.html
|
||
18 | * or write to the Free Software Foundation, Inc.,
|
||
19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
20 | *
|
||
21 | * The development of this software was supported by the
|
||
22 | * Excellence Cluster EXC 277 Cognitive Interaction Technology.
|
||
23 | * The Excellence Cluster EXC 277 is a grant of the Deutsche
|
||
24 | * Forschungsgemeinschaft (DFG) in the context of the German
|
||
25 | * Excellence Initiative.
|
||
26 | *
|
||
27 | */
|
||
28 | |||
29 | #pragma once
|
||
30 | #include "Middleware.h" |
||
31 | #ifdef ROS_SUPPORT
|
||
32 | #include "ros/ros.h" |
||
33 | 0c15613f | Simon Schulz | #include <actionlib/client/simple_action_client.h> |
34 | 2cf3c285 | Robert Haschke | #include <tf2_ros/transform_listener.h> |
35 | 0c15613f | Simon Schulz | |
36 | 0c286af0 | Simon Schulz | //messages
|
37 | #include "hlrc_server/phoneme.h" |
||
38 | #include "hlrc_server/soundchunk.h" |
||
39 | 0c15613f | Simon Schulz | #include "hlrc_server/utterance.h" |
40 | 0c286af0 | Simon Schulz | //actions
|
41 | #include "hlrc_server/gazetargetAction.h" |
||
42 | b47687f8 | Robert Haschke | #include "hlrc_server/lookattargetAction.h" |
43 | 0c15613f | Simon Schulz | #include "hlrc_server/ttsAction.h" |
44 | 0c286af0 | Simon Schulz | |
45 | #include "ROS/GazeCallbackWrapperROS.h" |
||
46 | b47687f8 | Robert Haschke | #include "ROS/LookatCallbackWrapperROS.h" |
47 | 0c286af0 | Simon Schulz | #include "ROS/MouthCallbackWrapperROS.h" |
48 | #include "ROS/UtteranceCallbackWrapperROS.h" |
||
49 | #include "ROS/EmotionCallbackWrapperROS.h" |
||
50 | #include "ROS/AnimationCallbackWrapperROS.h" |
||
51 | #include "ROS/SpeechCallbackWrapperROS.h" |
||
52 | #endif
|
||
53 | 888a909b | Robert Haschke | #include <memory> |
54 | 0c286af0 | Simon Schulz | |
55 | 0c15613f | Simon Schulz | #define ROS_ACTION_CALL_TIMEOUT 30.0 |
56 | 0c286af0 | Simon Schulz | |
57 | class MiddlewareROS : public Middleware{ |
||
58 | #ifndef ROS_SUPPORT
|
||
59 | public:
|
||
60 | MiddlewareROS(Arbiter *a, std::string _base_scope) : Middleware(a, _base_scope){ |
||
61 | printf("> ERROR: hlrc was compiled without ROS middleware support. Please use MiddlewareRSB() instead!\n\n");
|
||
62 | exit(EXIT_FAILURE); |
||
63 | } |
||
64 | |||
65 | ~MiddlewareROS(){} |
||
66 | void init(){};
|
||
67 | void tick(){};
|
||
68 | |||
69 | 888a909b | Robert Haschke | std::shared_ptr<Utterance> tts_call(std::string text){ |
70 | return std::shared_ptr<Utterance>(new Utterance());
|
||
71 | 0c286af0 | Simon Schulz | } |
72 | |||
73 | #else
|
||
74 | public:
|
||
75 | MiddlewareROS(Arbiter *a, std::string _base_scope); |
||
76 | ~MiddlewareROS(); |
||
77 | void init();
|
||
78 | void tick();
|
||
79 | 888a909b | Robert Haschke | std::shared_ptr<Utterance> tts_call(std::string text); |
80 | 0c286af0 | Simon Schulz | |
81 | private:
|
||
82 | 888a909b | Robert Haschke | //std::shared_ptr<ros::NodeHandle> node_handle;
|
83 | 0c286af0 | Simon Schulz | ros::NodeHandle *ros_node_handle; |
84 | bool tick_necessary;
|
||
85 | 2cf3c285 | Robert Haschke | //listen to tf tree
|
86 | tf2_ros::Buffer tfBuffer; |
||
87 | 888a909b | Robert Haschke | std::shared_ptr<tf2_ros::TransformListener> tfListener; |
88 | 2cf3c285 | Robert Haschke | |
89 | //FIXME: These pointers are never destroyed. Shouldn't they be shared_ptrs?
|
||
90 | 0c286af0 | Simon Schulz | AnimationCallbackWrapper *animation_action_server; |
91 | UtteranceCallbackWrapper *utterance_action_server; |
||
92 | EmotionCallbackWrapper *current_emotion_action_server; |
||
93 | EmotionCallbackWrapper *default_emotion_action_server; |
||
94 | GazeCallbackWrapper *gaze_action_server; |
||
95 | b47687f8 | Robert Haschke | LookatCallbackWrapper *lookat_action_server; |
96 | 0c286af0 | Simon Schulz | MouthCallbackWrapper *mouth_action_server; |
97 | SpeechCallbackWrapper *speech_action_server; |
||
98 | 0c15613f | Simon Schulz | actionlib::SimpleActionClient<hlrc_server::ttsAction> *tts_ac; |
99 | 0c286af0 | Simon Schulz | #endif
|
100 | }; |