Statistics
| Branch: | Tag: | Revision:

hlrc / server / include / MiddlewareROS.h @ 465c7ad7

History | View | Annotate | Download (3.327 KB)

1
/*
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
    #include <actionlib/client/simple_action_client.h>
34

    
35
    //messages
36
    #include "hlrc_server/phoneme.h"
37
    #include "hlrc_server/soundchunk.h"
38
    #include "hlrc_server/utterance.h"
39
    //actions
40
    #include "hlrc_server/gazetargetAction.h"
41
    #include "hlrc_server/lookattargetAction.h"
42
    #include "hlrc_server/ttsAction.h"
43

    
44
    #include "ROS/GazeCallbackWrapperROS.h"
45
    #include "ROS/LookatCallbackWrapperROS.h"
46
    #include "ROS/MouthCallbackWrapperROS.h"
47
    #include "ROS/UtteranceCallbackWrapperROS.h"
48
    #include "ROS/EmotionCallbackWrapperROS.h"
49
    #include "ROS/AnimationCallbackWrapperROS.h"
50
    #include "ROS/SpeechCallbackWrapperROS.h"
51
#endif
52
#include <boost/shared_ptr.hpp>
53

    
54
#define ROS_ACTION_CALL_TIMEOUT 30.0
55

    
56
class MiddlewareROS : public Middleware{
57
#ifndef ROS_SUPPORT
58
public:
59
    MiddlewareROS(Arbiter *a, std::string _base_scope) : Middleware(a, _base_scope){
60
        printf("> ERROR: hlrc was compiled without ROS middleware support. Please use MiddlewareRSB() instead!\n\n");
61
        exit(EXIT_FAILURE);
62
    }
63

    
64
    ~MiddlewareROS(){}
65
    void init(){};
66
    void tick(){};
67

    
68
    boost::shared_ptr<Utterance> tts_call(std::string text){
69
        return boost::shared_ptr<Utterance>(new Utterance());
70
    }
71

    
72
#else
73
public:
74
    MiddlewareROS(Arbiter *a, std::string _base_scope);
75
    ~MiddlewareROS();
76
    void init();
77
    void tick();
78
    boost::shared_ptr<Utterance> tts_call(std::string text);
79

    
80
private:
81
    //boost::shared_ptr<ros::NodeHandle> node_handle;
82
    ros::NodeHandle *ros_node_handle;
83
    bool tick_necessary;
84
    /*ros::ServiceServer animation_service;
85
    ros::ServiceServer utterance_service;
86
    ros::ServiceServer default_emotion_service;
87
    ros::ServiceServer current_emotion_service;
88
    ros::ServiceServer gaze_service;
89
    ros::ServiceServer tts_service;*/
90
    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
    LookatCallbackWrapper *lookat_action_server;
96
    MouthCallbackWrapper *mouth_action_server;
97
    SpeechCallbackWrapper *speech_action_server;
98
    actionlib::SimpleActionClient<hlrc_server::ttsAction> *tts_ac;
99
#endif
100
};
101

    
102

    
103

    
104