hlrc / server / include / MiddlewareROS.h @ 8eb31bd3
History | View | Annotate | Download (3.188 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 | |||
| 35 | 0c286af0 | Simon Schulz | //messages
|
| 36 | #include "hlrc_server/phoneme.h" |
||
| 37 | #include "hlrc_server/soundchunk.h" |
||
| 38 | 0c15613f | Simon Schulz | #include "hlrc_server/utterance.h" |
| 39 | 0c286af0 | Simon Schulz | //actions
|
| 40 | #include "hlrc_server/gazetargetAction.h" |
||
| 41 | 0c15613f | Simon Schulz | #include "hlrc_server/ttsAction.h" |
| 42 | 0c286af0 | Simon Schulz | |
| 43 | #include "ROS/GazeCallbackWrapperROS.h" |
||
| 44 | #include "ROS/MouthCallbackWrapperROS.h" |
||
| 45 | #include "ROS/UtteranceCallbackWrapperROS.h" |
||
| 46 | #include "ROS/EmotionCallbackWrapperROS.h" |
||
| 47 | #include "ROS/AnimationCallbackWrapperROS.h" |
||
| 48 | #include "ROS/SpeechCallbackWrapperROS.h" |
||
| 49 | #endif
|
||
| 50 | #include <boost/shared_ptr.hpp> |
||
| 51 | |||
| 52 | 0c15613f | Simon Schulz | #define ROS_ACTION_CALL_TIMEOUT 30.0 |
| 53 | 0c286af0 | Simon Schulz | |
| 54 | class MiddlewareROS : public Middleware{
|
||
| 55 | #ifndef ROS_SUPPORT
|
||
| 56 | public:
|
||
| 57 | MiddlewareROS(Arbiter *a, std::string _base_scope) : Middleware(a, _base_scope){
|
||
| 58 | printf("> ERROR: hlrc was compiled without ROS middleware support. Please use MiddlewareRSB() instead!\n\n");
|
||
| 59 | exit(EXIT_FAILURE); |
||
| 60 | } |
||
| 61 | |||
| 62 | ~MiddlewareROS(){}
|
||
| 63 | void init(){};
|
||
| 64 | void tick(){};
|
||
| 65 | |||
| 66 | 2e526a15 | Simon Schulz | boost::shared_ptr<Utterance> tts_call(std::string text){
|
| 67 | return boost::shared_ptr<Utterance>(new Utterance());
|
||
| 68 | 0c286af0 | Simon Schulz | } |
| 69 | |||
| 70 | #else
|
||
| 71 | public:
|
||
| 72 | MiddlewareROS(Arbiter *a, std::string _base_scope); |
||
| 73 | ~MiddlewareROS(); |
||
| 74 | void init();
|
||
| 75 | void tick();
|
||
| 76 | 2e526a15 | Simon Schulz | boost::shared_ptr<Utterance> tts_call(std::string text); |
| 77 | 0c286af0 | Simon Schulz | |
| 78 | private:
|
||
| 79 | //boost::shared_ptr<ros::NodeHandle> node_handle;
|
||
| 80 | ros::NodeHandle *ros_node_handle; |
||
| 81 | bool tick_necessary;
|
||
| 82 | /*ros::ServiceServer animation_service;
|
||
| 83 | ros::ServiceServer utterance_service;
|
||
| 84 | ros::ServiceServer default_emotion_service;
|
||
| 85 | ros::ServiceServer current_emotion_service;
|
||
| 86 | ros::ServiceServer gaze_service;
|
||
| 87 | ros::ServiceServer tts_service;*/
|
||
| 88 | AnimationCallbackWrapper *animation_action_server; |
||
| 89 | UtteranceCallbackWrapper *utterance_action_server; |
||
| 90 | EmotionCallbackWrapper *current_emotion_action_server; |
||
| 91 | EmotionCallbackWrapper *default_emotion_action_server; |
||
| 92 | GazeCallbackWrapper *gaze_action_server; |
||
| 93 | MouthCallbackWrapper *mouth_action_server; |
||
| 94 | SpeechCallbackWrapper *speech_action_server; |
||
| 95 | 0c15613f | Simon Schulz | actionlib::SimpleActionClient<hlrc_server::ttsAction> *tts_ac; |
| 96 | 0c286af0 | Simon Schulz | #endif
|
| 97 | }; |
||
| 98 | |||
| 99 | |||
| 100 |