Revision b47687f8
| server/CMakeLists.txt | ||
|---|---|---|
| 55 | 55 |
IF (catkin_FOUND) |
| 56 | 56 |
SET(ROS_FOUND 1) |
| 57 | 57 |
|
| 58 |
find_package(catkin REQUIRED COMPONENTS roscpp std_msgs sensor_msgs message_generation genmsg actionlib_msgs actionlib) |
|
| 58 |
find_package(catkin REQUIRED COMPONENTS roscpp std_msgs geometry_msgs sensor_msgs message_generation genmsg actionlib_msgs actionlib)
|
|
| 59 | 59 |
|
| 60 | 60 |
message(STATUS "ROS Support is ON") |
| 61 | 61 |
add_definitions(-DROS_SUPPORT=1) |
| ... | ... | |
| 64 | 64 |
FILES |
| 65 | 65 |
phoneme.msg |
| 66 | 66 |
soundchunk.msg |
| 67 |
utterance.msg
|
|
| 67 |
utterance.msg
|
|
| 68 | 68 |
) |
| 69 | 69 |
|
| 70 | 70 |
add_service_files( |
| ... | ... | |
| 77 | 77 |
animation.action |
| 78 | 78 |
speech.action |
| 79 | 79 |
utterance.action |
| 80 |
tts.action
|
|
| 80 |
tts.action
|
|
| 81 | 81 |
emotionstate.action |
| 82 | 82 |
gazetarget.action |
| 83 |
lookattarget.action |
|
| 83 | 84 |
mouthtarget.action |
| 84 | 85 |
) |
| 85 | 86 |
|
| ... | ... | |
| 87 | 88 |
DEPENDENCIES |
| 88 | 89 |
actionlib_msgs |
| 89 | 90 |
std_msgs |
| 91 |
geometry_msgs |
|
| 90 | 92 |
hlrc_server |
| 91 | 93 |
) |
| 92 | 94 |
|
| server/action/lookattarget.action | ||
|---|---|---|
| 1 |
std_msgs/Header header |
|
| 2 |
geometry_msgs/Point point |
|
| 3 |
|
|
| 4 |
# roll angle |
|
| 5 |
float32 roll |
|
| 6 |
|
|
| 7 |
--- |
|
| 8 |
#result |
|
| 9 |
uint32 result |
|
| 10 |
|
|
| 11 |
--- |
|
| 12 |
#feedback |
|
| 13 |
uint32 result |
|
| server/include/MiddlewareROS.h | ||
|---|---|---|
| 38 | 38 |
#include "hlrc_server/utterance.h" |
| 39 | 39 |
//actions |
| 40 | 40 |
#include "hlrc_server/gazetargetAction.h" |
| 41 |
#include "hlrc_server/lookattargetAction.h" |
|
| 41 | 42 |
#include "hlrc_server/ttsAction.h" |
| 42 | 43 |
|
| 43 | 44 |
#include "ROS/GazeCallbackWrapperROS.h" |
| 45 |
#include "ROS/LookatCallbackWrapperROS.h" |
|
| 44 | 46 |
#include "ROS/MouthCallbackWrapperROS.h" |
| 45 | 47 |
#include "ROS/UtteranceCallbackWrapperROS.h" |
| 46 | 48 |
#include "ROS/EmotionCallbackWrapperROS.h" |
| ... | ... | |
| 90 | 92 |
EmotionCallbackWrapper *current_emotion_action_server; |
| 91 | 93 |
EmotionCallbackWrapper *default_emotion_action_server; |
| 92 | 94 |
GazeCallbackWrapper *gaze_action_server; |
| 95 |
LookatCallbackWrapper *lookat_action_server; |
|
| 93 | 96 |
MouthCallbackWrapper *mouth_action_server; |
| 94 | 97 |
SpeechCallbackWrapper *speech_action_server; |
| 95 | 98 |
actionlib::SimpleActionClient<hlrc_server::ttsAction> *tts_ac; |
| server/include/ROS/LookatCallbackWrapperROS.h | ||
|---|---|---|
| 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 "hlrc_server/lookattargetAction.h" |
|
| 31 |
#include "CallbackWrapperROS.h" |
|
| 32 |
|
|
| 33 |
//callback handler incoming lookat requests: |
|
| 34 |
class LookatCallbackWrapper : CallbackWrapper<hlrc_server::lookattargetAction>{
|
|
| 35 |
protected: |
|
| 36 |
hlrc_server::lookattargetFeedback feedback; |
|
| 37 |
hlrc_server::lookattargetResult result; |
|
| 38 |
|
|
| 39 |
public: |
|
| 40 |
|
|
| 41 |
LookatCallbackWrapper(Middleware *mw, std::string scope, std::string name) |
|
| 42 |
: CallbackWrapper<hlrc_server::lookattargetAction>(mw, scope, name, boost::bind(&LookatCallbackWrapper::call, this, _1)) |
|
| 43 |
{
|
|
| 44 |
// |
|
| 45 |
} |
|
| 46 |
|
|
| 47 |
void call(const GoalConstPtr &goal){
|
|
| 48 |
feedback.result = 1; |
|
| 49 |
|
|
| 50 |
hlrc_server::lookattargetGoalConstPtr request = goal; |
|
| 51 |
humotion::GazeState gaze_state; |
|
| 52 |
|
|
| 53 |
// fill in lookat |
|
| 54 |
gaze_state.pan = 20; |
|
| 55 |
gaze_state.tilt = 30; |
|
| 56 |
gaze_state.roll = 10; |
|
| 57 |
|
|
| 58 |
// use timestamp from request |
|
| 59 |
gaze_state.timestamp.set(request->header.stamp.sec, request->header.stamp.nsec); |
|
| 60 |
gaze_state.gaze_type = humotion::GazeState::GAZETYPE_ABSOLUTE; |
|
| 61 |
|
|
| 62 |
gaze_state.vergence = 0; |
|
| 63 |
gaze_state.pan_offset = 0; |
|
| 64 |
gaze_state.tilt_offset = 0; |
|
| 65 |
|
|
| 66 |
// processing |
|
| 67 |
feedback.result = 1; |
|
| 68 |
as_.publishFeedback(feedback); |
|
| 69 |
|
|
| 70 |
// send to application: |
|
| 71 |
mw->gaze_callback(gaze_state); |
|
| 72 |
|
|
| 73 |
if (feedback.result){
|
|
| 74 |
result.result = feedback.result; |
|
| 75 |
as_.setSucceeded(result); |
|
| 76 |
}else{
|
|
| 77 |
as_.setAborted(result); |
|
| 78 |
} |
|
| 79 |
|
|
| 80 |
} |
|
| 81 |
}; |
|
| server/package.xml | ||
|---|---|---|
| 33 | 33 |
<!-- Use build_depend for packages you need at compile time: --> |
| 34 | 34 |
<build_depend>roscpp</build_depend> |
| 35 | 35 |
<build_depend>std_msgs</build_depend> |
| 36 |
<build_depend>geometry_msgs</build_depend> |
|
| 36 | 37 |
<build_depend>actionlib_msgs</build_depend> |
| 37 | 38 |
<build_depend>humotion</build_depend> |
| 38 | 39 |
<!-- Use run_depend for packages you need at runtime: --> |
| 40 |
<run_depend>std_msgs</run_depend> |
|
| 41 |
<run_depend>geometry_msgs</run_depend> |
|
| 39 | 42 |
<run_depend>actionlib_msgs</run_depend> |
| 40 | 43 |
<!-- Use test_depend for packages you need only for testing: --> |
| 41 | 44 |
<!-- <test_depend>gtest</test_depend> --> |
| server/src/MiddlewareROS.cpp | ||
|---|---|---|
| 96 | 96 |
current_emotion_action_server = new EmotionCallbackWrapper(this, scope, "currentEmotion"); |
| 97 | 97 |
default_emotion_action_server = new EmotionCallbackWrapper(this, scope, "defaultEmotion"); |
| 98 | 98 |
gaze_action_server = new GazeCallbackWrapper(this, scope, "gaze"); |
| 99 |
lookat_action_server = new LookatCallbackWrapper(this, scope, "lookat"); |
|
| 99 | 100 |
mouth_action_server = new MouthCallbackWrapper(this, scope, "mouth"); |
| 100 | 101 |
speech_action_server = new SpeechCallbackWrapper(this, scope, "speech"); |
| 101 | 102 |
|
Also available in: Unified diff