Revision f150aab5 server/include/MiddlewareROS.h
| server/include/MiddlewareROS.h | ||
|---|---|---|
| 1 | 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 |
*/ |
|
| 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 | 28 |
|
| 29 | 29 |
#pragma once |
| 30 | 30 |
#include "Middleware.h" |
| 31 | 31 |
#ifdef ROS_SUPPORT |
| 32 |
#include "ros/ros.h"
|
|
| 33 |
#include <actionlib/client/simple_action_client.h>
|
|
| 34 |
#include <tf2_ros/transform_listener.h>
|
|
| 32 |
#include "ros/ros.h" |
|
| 33 |
#include <actionlib/client/simple_action_client.h> |
|
| 34 |
#include <tf2_ros/transform_listener.h> |
|
| 35 | 35 |
|
| 36 |
//messages
|
|
| 37 |
#include "hlrc_server/phoneme.h"
|
|
| 38 |
#include "hlrc_server/soundchunk.h"
|
|
| 39 |
#include "hlrc_server/utterance.h"
|
|
| 40 |
//actions
|
|
| 41 |
#include "hlrc_server/gazetargetAction.h"
|
|
| 42 |
#include "hlrc_server/lookattargetAction.h"
|
|
| 43 |
#include "hlrc_server/ttsAction.h"
|
|
| 36 |
// messages
|
|
| 37 |
#include "hlrc_server/phoneme.h" |
|
| 38 |
#include "hlrc_server/soundchunk.h" |
|
| 39 |
#include "hlrc_server/utterance.h" |
|
| 40 |
// actions
|
|
| 41 |
#include "hlrc_server/gazetargetAction.h" |
|
| 42 |
#include "hlrc_server/lookattargetAction.h" |
|
| 43 |
#include "hlrc_server/ttsAction.h" |
|
| 44 | 44 |
|
| 45 |
#include "ROS/GazeCallbackWrapperROS.h"
|
|
| 46 |
#include "ROS/LookatCallbackWrapperROS.h"
|
|
| 47 |
#include "ROS/MouthCallbackWrapperROS.h"
|
|
| 48 |
#include "ROS/UtteranceCallbackWrapperROS.h"
|
|
| 49 |
#include "ROS/EmotionCallbackWrapperROS.h"
|
|
| 50 |
#include "ROS/AnimationCallbackWrapperROS.h"
|
|
| 51 |
#include "ROS/SpeechCallbackWrapperROS.h"
|
|
| 45 |
#include "ROS/GazeCallbackWrapperROS.h" |
|
| 46 |
#include "ROS/LookatCallbackWrapperROS.h" |
|
| 47 |
#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 | 52 |
#endif |
| 53 | 53 |
#include <boost/shared_ptr.hpp> |
| 54 | 54 |
|
| 55 | 55 |
#define ROS_ACTION_CALL_TIMEOUT 30.0 |
| 56 | 56 |
|
| 57 |
class MiddlewareROS : public Middleware{
|
|
| 57 |
class MiddlewareROS : public Middleware {
|
|
| 58 | 58 |
#ifndef ROS_SUPPORT |
| 59 | 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 |
}
|
|
| 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 | 64 |
|
| 65 |
~MiddlewareROS(){}
|
|
| 66 |
void init(){};
|
|
| 67 |
void tick(){};
|
|
| 65 |
~MiddlewareROS() {
|
|
| 66 |
} |
|
| 67 |
void init(){};
|
|
| 68 |
void tick(){};
|
|
| 68 | 69 |
|
| 69 |
boost::shared_ptr<Utterance> tts_call(std::string text){
|
|
| 70 |
return boost::shared_ptr<Utterance>(new Utterance());
|
|
| 71 |
}
|
|
| 70 |
boost::shared_ptr<Utterance> tts_call(std::string text) {
|
|
| 71 |
return boost::shared_ptr<Utterance>(new Utterance());
|
|
| 72 |
}
|
|
| 72 | 73 |
|
| 73 | 74 |
#else |
| 74 | 75 |
public: |
| 75 |
MiddlewareROS(Arbiter *a, std::string _base_scope);
|
|
| 76 |
~MiddlewareROS();
|
|
| 77 |
void init();
|
|
| 78 |
void tick();
|
|
| 79 |
boost::shared_ptr<Utterance> tts_call(std::string text);
|
|
| 76 |
MiddlewareROS(Arbiter* a, std::string _base_scope);
|
|
| 77 |
~MiddlewareROS();
|
|
| 78 |
void init();
|
|
| 79 |
void tick();
|
|
| 80 |
boost::shared_ptr<Utterance> tts_call(std::string text);
|
|
| 80 | 81 |
|
| 81 | 82 |
private: |
| 82 |
//boost::shared_ptr<ros::NodeHandle> node_handle;
|
|
| 83 |
ros::NodeHandle *ros_node_handle;
|
|
| 84 |
bool tick_necessary;
|
|
| 85 |
//listen to tf tree
|
|
| 86 |
tf2_ros::Buffer tfBuffer;
|
|
| 87 |
boost::shared_ptr<tf2_ros::TransformListener> tfListener;
|
|
| 83 |
// boost::shared_ptr<ros::NodeHandle> node_handle;
|
|
| 84 |
ros::NodeHandle* ros_node_handle;
|
|
| 85 |
bool tick_necessary;
|
|
| 86 |
// listen to tf tree
|
|
| 87 |
tf2_ros::Buffer tfBuffer;
|
|
| 88 |
boost::shared_ptr<tf2_ros::TransformListener> tfListener;
|
|
| 88 | 89 |
|
| 89 |
//FIXME: These pointers are never destroyed. Shouldn't they be shared_ptrs?
|
|
| 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;
|
|
| 90 |
// FIXME: These pointers are never destroyed. Shouldn't they be shared_ptrs?
|
|
| 91 |
AnimationCallbackWrapper* animation_action_server;
|
|
| 92 |
UtteranceCallbackWrapper* utterance_action_server;
|
|
| 93 |
EmotionCallbackWrapper* current_emotion_action_server;
|
|
| 94 |
EmotionCallbackWrapper* default_emotion_action_server;
|
|
| 95 |
GazeCallbackWrapper* gaze_action_server;
|
|
| 96 |
LookatCallbackWrapper* lookat_action_server;
|
|
| 97 |
MouthCallbackWrapper* mouth_action_server;
|
|
| 98 |
SpeechCallbackWrapper* speech_action_server;
|
|
| 99 |
actionlib::SimpleActionClient<hlrc_server::ttsAction>* tts_ac;
|
|
| 99 | 100 |
#endif |
| 100 | 101 |
}; |
Also available in: Unified diff