Revision 4bd3e852

View differences:

client/cpp/hlrc_clientConfigVersion.cmake.in
1
set(PACKAGE_VERSION "@HLRC_CLIENT_VERSION@")
2
 
3
# Check whether the requested PACKAGE_FIND_VERSION is compatible
4
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
5
  set(PACKAGE_VERSION_COMPATIBLE FALSE)
6
else()
7
  set(PACKAGE_VERSION_COMPATIBLE TRUE)
8
  if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
9
    set(PACKAGE_VERSION_EXACT TRUE)
10
  endif()
11
endif()
1
    set(PACKAGE_VERSION "@HLRC_CLIENT_VERSION@")
2

  
3
    # Check whether the requested PACKAGE_FIND_VERSION is compatible
4
    if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
5
      set(PACKAGE_VERSION_COMPATIBLE FALSE)
6
    else()
7
      set(PACKAGE_VERSION_COMPATIBLE TRUE)
8
      if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
9
        set(PACKAGE_VERSION_EXACT TRUE)
10
      endif()
11
    endif()
client/cpp/src/MiddlewareROS.cpp
25 25
* Excellence Initiative.
26 26
*
27 27
*/
28

  
29 28
#ifdef ROS_SUPPORT
30 29

  
31 30
#include "MiddlewareROS.h"
......
263 262
}
264 263

  
265 264
#endif
265

  
client/cpp/src/RobotController.cpp
28 28

  
29 29
#include "RobotController.h"
30 30
#include "Middleware.h"
31
#include "MiddlewareRSB.h"
32 31
#include "MiddlewareROS.h"
32
#include "MiddlewareRSB.h"
33

  
33 34
using namespace std;
34 35

  
35 36
RobotController::RobotController(string mw_name, string base_scope){
36
    if (mw_name == "ROS"){
37
        //intantiate ROS mw
38
        middleware = new MiddlewareROS(base_scope);
39
    }else if (mw_name == "RSB"){
40
        //intantiate RSB mw
41
        middleware = new MiddlewareRSB(base_scope);
37

  
38
     if (mw_name == "ROS"){
39
         //intantiate ROS mw
40
         middleware = new MiddlewareROS(base_scope);
41
     }else if (mw_name == "RSB"){
42
         //intantiate RSB mw
43
         middleware = new MiddlewareRSB(base_scope);
42 44
    }else{
43
        printf("ERROR: invalid middleware requested (%s). supported: {ROS, RSB}\n\n", mw_name.c_str());
45
         printf("ERROR: invalid middleware requested (%s). supported: {ROS, RSB}\n\n", mw_name.c_str());
44 46
        exit(EXIT_FAILURE);
45 47
    }
46 48
}
client/python/tools/dump_relative_gazetargets.py
11 11
small code snippet to dump humotion relative gaze targets
12 12
combined with the current gaze direction from tf
13 13
"""
14
USE_MEKA_TOPICS=False
14
USE_MEKA_TOPICS=True
15 15

  
16
humotion_gaze_topic = "/flobi/humotion/gaze/target"
17
tf_topic_base   = "BASE_LINK"
18
tf_topic_gaze_l = "EYES_LEFT_UD_VIRTUAL_LINK"
19
tf_topic_gaze_r = "EYES_RIGHT_UD_VIRTUAL_LINK"
20 16

  
21 17
#joint targets
22 18
if USE_MEKA_TOPICS:
19
    humotion_gaze_topic = "/flobi/humotion/gaze/target"
20
    tf_topic_base   = "BASE_LINK"
21
    tf_topic_gaze_l = "EYES_LEFT_UD_VIRTUAL_LINK"
22
    tf_topic_gaze_r = "EYES_RIGHT_UD_VIRTUAL_LINK"
23 23
    from trajectory.msg import *
24 24
    topic_joint_target = "/meka_roscontrol/head_position_trajectory_controller/command"
25 25
else:
26
    humotion_gaze_topic = "/flobi/humotion/gaze/target"
27
    tf_topic_base   = "BASE_LINK"
28
    tf_topic_gaze_l = "EYES_LEFT_UD_VIRTUAL_LINK"
29
    tf_topic_gaze_r = "EYES_RIGHT_UD_VIRTUAL_LINK"
26 30
    from xsc3_server.msg import *
27 31
    topic_joint_target = "/xsc3/custom_joint_state"
28 32

  
server/include/RSB/AnimationCallbackWrapper.h
31 31
#include "Animation.h"
32 32

  
33 33
//callback handler incoming animation requests:
34
class AnimationCallbackWrapper : public CallbackWrapper<rst::robot::Animation>{
34
class AnimationCallbackWrapper : public CallbackWrapper<rst::animation::HeadAnimation>{
35 35
    public:
36 36
       AnimationCallbackWrapper(Middleware *mw) : CallbackWrapper(mw){}
37 37

  
38
       void call(const std::string& method_name, boost::shared_ptr<rst::robot::Animation> input){
38
       void call(const std::string& method_name, boost::shared_ptr<rst::animation::HeadAnimation> input){
39 39
           printf("> incomint animation (method = %s)\n",method_name.c_str());
40 40

  
41 41
           //fetch animation passed by rsb:
42
           rst::robot::Animation *rst_ani = input.get();
42
           rst::animation::HeadAnimation *rst_ani = input.get();
43 43
           boost::shared_ptr<Animation> ani(new Animation());
44 44

  
45
           switch ((int) rst_ani->target()){
46
               case(rst_ani->IDLE):         ani->target = Animation::IDLE; break;
47
               case(rst_ani->HEAD_NOD):     ani->target = Animation::HEAD_NOD; break;
48
               case(rst_ani->HEAD_SHAKE):   ani->target = Animation::HEAD_SHAKE; break;
49
               case(rst_ani->EYEBLINK_L):   ani->target = Animation::EYEBLINK_L; break;
50
               case(rst_ani->EYEBLINK_R):   ani->target = Animation::EYEBLINK_R; break;
51
               case(rst_ani->EYEBLINK_BOTH):ani->target = Animation::EYEBLINK_BOTH; break;
52
               case(rst_ani->EYEBROWS_RAISE):ani->target = Animation::EYEBROWS_RAISE;break;
53
               case(rst_ani->EYEBROWS_LOWER):ani->target = Animation::EYEBROWS_LOWER;break;
45
           switch ((int) rst_ani->animation()){
46
               case(rst_ani->IDLE):             ani->target = Animation::IDLE; break;
47
               case(rst_ani->HEAD_NOD):         ani->target = Animation::HEAD_NOD; break;
48
               case(rst_ani->HEAD_SHAKE):       ani->target = Animation::HEAD_SHAKE; break;
49
               case(rst_ani->EYEBLINK_LEFT):    ani->target = Animation::EYEBLINK_L; break;
50
               case(rst_ani->EYEBLINK_RIGHT):   ani->target = Animation::EYEBLINK_R; break;
51
               case(rst_ani->EYEBLINK_BOTH):    ani->target = Animation::EYEBLINK_BOTH; break;
52
               case(rst_ani->EYEBROWS_RAISE):   ani->target = Animation::EYEBROWS_RAISE;break;
53
               case(rst_ani->EYEBROWS_LOWER):   ani->target = Animation::EYEBROWS_LOWER;break;
54
               case(rst_ani->ENGAGEMENT_LEFT):  ani->target = Animation::ENGAGEMENT_LEFT;break;
55
               case(rst_ani->ENGAGEMENT_RIGHT): ani->target = Animation::ENGAGEMENT_RIGHT;break;
54 56
               default:
55 57
                   ani->target = Animation::IDLE;
56
                   printf("> unhandled animatin target %d\n",(int)rst_ani->target());
58
                   printf("> unhandled animatin target %d\n",(int)rst_ani->animation());
57 59
                   throw std::runtime_error("AnimationCallback: invalid animation id");
58 60
                   return;
59 61
           }
60 62
           ani->repetitions   = rst_ani->repetitions();
61 63
           ani->duration_each = rst_ani->duration_each();
62
           ani->scale         = rst_ani->scale();
64
           ani->scale         = rst_ani->emphasis_scale();
63 65

  
64 66
           printf("> new Animation: %s\n", ani->as_string().c_str());
65 67

  
server/include/RSB/CallbackWrapper.h
28 28

  
29 29
#pragma once
30 30
#include "Middleware.h"
31
#include <rst/robot/EmotionState.pb.h>
32
#include <rst/robot/GazeTarget.pb.h>
33
#include <rst/robot/MouthTarget.pb.h>
34
#include <rst/robot/Animation.pb.h>
31
//#include <rst/robot/MouthTarget.pb.h>
32
#include <rst/animation/EmotionExpression.pb.h>
33
#include <rst/animation/BinocularHeadGaze.pb.h>
34
#include <rst/animation/HeadAnimation.pb.h>
35 35
#include <rst/audition/Utterance.pb.h>
36 36
#include <rst/audition/SoundChunk.pb.h>
37 37
#include <rsb/Factory.h>
server/include/RSB/EmotionCallbackWrapper.h
30 30
#include "CallbackWrapper.h"
31 31

  
32 32
//callback handler incoming emotion requests:
33
class EmotionCallbackWrapper : public CallbackWrapper<rst::robot::EmotionState>{
33
class EmotionCallbackWrapper : public CallbackWrapper<rst::animation::EmotionExpression>{
34 34
    public:
35 35
       EmotionCallbackWrapper(Middleware *mw) : CallbackWrapper(mw){}
36 36

  
37
       void call(const std::string& method_name, boost::shared_ptr<rst::robot::EmotionState> input){
38
           printf("> incoming emotion (%s = %d)\n", method_name.c_str(),(int)input->value());
37
       void call(const std::string& method_name, boost::shared_ptr<rst::animation::EmotionExpression> input){
38
           printf("> incoming emotion (%s = %d)\n", method_name.c_str(),(int)input->emotion());
39 39

  
40 40
           EmotionState emotion_state;
41
           rst::robot::EmotionState *emotion = input.get();
41
           rst::animation::EmotionExpression *emotion = input.get();
42 42

  
43 43
           //extract data & copy it to our datatype (might be good when we allow multiple middlewares in the feature)
44
           switch ((int)emotion->value()){
45
               case(rst::robot::EmotionState_EmotionType_NEUTRAL):   emotion_state.value = EmotionConfig::NEUTRAL; break;
46
               case(rst::robot::EmotionState_EmotionType_HAPPY):     emotion_state.value = EmotionConfig::HAPPY; break;
47
               case(rst::robot::EmotionState_EmotionType_SAD):       emotion_state.value = EmotionConfig::SAD; break;
48
               case(rst::robot::EmotionState_EmotionType_ANGRY):     emotion_state.value = EmotionConfig::ANGRY; break;
49
               case(rst::robot::EmotionState_EmotionType_SURPRISED): emotion_state.value = EmotionConfig::SURPRISED; break;
50
               case(rst::robot::EmotionState_EmotionType_FEAR):      emotion_state.value = EmotionConfig::FEAR; break;
44
           switch ((int)emotion->emotion()){
45
               case(rst::animation::EmotionExpression_Emotion_NEUTRAL):   emotion_state.value = EmotionConfig::NEUTRAL; break;
46
               case(rst::animation::EmotionExpression_Emotion_HAPPY):     emotion_state.value = EmotionConfig::HAPPY; break;
47
               case(rst::animation::EmotionExpression_Emotion_SAD):       emotion_state.value = EmotionConfig::SAD; break;
48
               case(rst::animation::EmotionExpression_Emotion_ANGRY):     emotion_state.value = EmotionConfig::ANGRY; break;
49
               case(rst::animation::EmotionExpression_Emotion_SURPRISED): emotion_state.value = EmotionConfig::SURPRISED; break;
50
               case(rst::animation::EmotionExpression_Emotion_FEAR):      emotion_state.value = EmotionConfig::FEAR; break;
51 51
               default:
52
               printf("> invalid EmotionState value. exiting\n"); exit(EXIT_FAILURE);
52
               printf("> invalid EmotionExpression emotion value. exiting\n"); exit(EXIT_FAILURE);
53 53
           }
54 54

  
55 55
           emotion_state.duration = emotion->duration();
server/include/RSB/GazeCallbackWrapper.h
30 30
#include "CallbackWrapper.h"
31 31

  
32 32
//callback handler incoming gaze requests:
33
class GazeCallbackWrapper : public CallbackWrapper<rst::robot::GazeTarget>{
33
class GazeCallbackWrapper : public CallbackWrapper<rst::animation::BinocularHeadGaze>{
34 34
    public:
35 35
        GazeCallbackWrapper(Middleware *mw) : CallbackWrapper(mw){}
36
        void call(const std::string& method_name, boost::shared_ptr<rst::robot::GazeTarget> input){
37
            rst::robot::GazeTarget *gaze = input.get();
36
        void call(const std::string& method_name, boost::shared_ptr<rst::animation::BinocularHeadGaze> input){
37
            rst::animation::BinocularHeadGaze *gaze = input.get();
38 38
            //printf("> incoming gaze (p=%3.1f t=%3.1f r=%3.1f / v=%3.1f)\n", gaze->pan(), gaze->tilt(), gaze->roll(), gaze->vergence());
39 39

  
40 40
            humotion::GazeState gaze_state;
41 41

  
42 42
            //fill in gaze
43
            gaze_state.pan   = gaze->pan();
44
            gaze_state.tilt  = gaze->tilt();
45
            gaze_state.roll  = gaze->roll();
43
            gaze_state.pan   = gaze->target().azimuth();
44
            gaze_state.tilt  = gaze->target().elevation();
45
            gaze_state.roll  = 0.0;
46

  
46 47
            //RSB supports only absolute targets for now...
47 48
            gaze_state.timestamp = 123.45; //FIXME!!
48
            gaze_state.type  = humotion::GazeState::ABSOLUTE;
49
            gaze_state.gaze_type = humotion::GazeState::GAZETYPE_ABSOLUTE;
50

  
49 51
            //vergence
50
            gaze_state.vergence  = (gaze->has_vergence())?gaze->vergence():0.0;
52
            gaze_state.vergence  = (gaze->has_eye_vergence())?gaze->eye_vergence():0.0;
53

  
51 54
            //offsets
52
            gaze_state.pan_offset  = (gaze->has_pan_offset())?gaze->pan_offset():0.0;
53
            gaze_state.tilt_offset = (gaze->has_tilt_offset())?gaze->tilt_offset():0.0;
54
            
55
            gaze_state.pan_offset  = (gaze->has_offset())?gaze->offset().azimuth():0.0;
56
            gaze_state.tilt_offset = (gaze->has_offset())?gaze->offset().elevation():0.0;
57

  
55 58
            //send to application:
56 59
            mw->gaze_callback(gaze_state);
57 60
        }
server/include/RSB/MouthCallbackWrapper.h
28 28

  
29 29
#pragma once
30 30
#include "CallbackWrapper.h"
31

  
31
#if 0
32
DISABLED MOUTH TARGET IN RSB FOR NOW
32 33
//callback handler incoming gaze requests:
33 34
class MouthCallbackWrapper : public CallbackWrapper<rst::robot::MouthTarget>{
34 35
    public:
......
51 52
            mw->mouth_callback(mouth_state);
52 53
        }
53 54
};
55
#endif
server/include/RSB/UtteranceCallbackWrapper.h
37 37
        void call(const std::string&, boost::shared_ptr<rst::audition::Utterance> param){
38 38
            //convert rsb utterance to out own:
39 39
            rst::audition::Utterance *rst_utterance = param.get();
40
            printf("> incoming utterance '%s' (%d phone symbols)\n", param->text().c_str(), (int)rst_utterance->phonemes().size());
40
            printf("> incoming utterance '%s' (%d phone symbols)\n", param->textual_representation().c_str(), (int)rst_utterance->phonemes().element().size());
41 41

  
42 42
            boost::shared_ptr<Utterance> utterance(new UtteranceRSB(*rst_utterance));
43 43

  
server/include/RSB/UtteranceRSB.h
37 37
    public:
38 38
        UtteranceRSB(rst::audition::Utterance rst_utterance){
39 39
            //set text:
40
            set_text(rst_utterance.text());
40
            set_text(rst_utterance.textual_representation());
41 41

  
42 42
            //convert soundchunk to audio data:
43 43
            extract_audio_data(rst_utterance.audio());
......
100 100
    void extract_phonemes(rst::audition::Utterance rst_utterance){
101 101
        //extract phoneme vector
102 102
        phonemes_vector.clear();
103
        for(int i=0; i<rst_utterance.phonemes().size(); i++){
104
            rst::audition::Phoneme rst_phoneme = rst_utterance.phonemes().Get(i);
103
        for(int i=0; i<rst_utterance.phonemes().element().size(); i++){
104
            rst::audition::Phoneme rst_phoneme = rst_utterance.phonemes().element().Get(i);
105 105
            Utterance::symbol_duration_pair_t phoneme = make_pair(rst_phoneme.symbol(), rst_phoneme.duration());
106 106
            phonemes_vector.push_back(phoneme);
107 107
        }
server/src/MiddlewareRSB.cpp
45 45
using namespace rsb;
46 46
using namespace rsb::patterns;
47 47

  
48
WARNING: RSB interface might be deprtecated and needs some backporting
49
from the ROS code. [todo]
50

  
51 48

  
52 49
MiddlewareRSB::MiddlewareRSB(Arbiter *arbiter, std::string scope) : Middleware(arbiter, scope){
53 50
    init();
......
65 62
    printf("> registering converters\n");
66 63

  
67 64
    //converter for EmotionState
68
    rsb::converter::Converter<string>::Ptr emotionStateConverter(new rsb::converter::ProtocolBufferConverter<rst::robot::EmotionState>());
65
    rsb::converter::Converter<string>::Ptr emotionStateConverter(new rsb::converter::ProtocolBufferConverter<rst::animation::EmotionExpression>());
69 66
    rsb::converter::converterRepository<string>()->registerConverter(emotionStateConverter);
70 67

  
71 68
    //converter for SoundChunk
......
77 74
    rsb::converter::converterRepository<string>()->registerConverter(UtteranceConverter);
78 75

  
79 76
    //converter for GazeTarget
80
    rsb::converter::Converter<string>::Ptr gazeTargetConverter(new rsb::converter::ProtocolBufferConverter<rst::robot::GazeTarget>());
77
    rsb::converter::Converter<string>::Ptr gazeTargetConverter(new rsb::converter::ProtocolBufferConverter<rst::animation::BinocularHeadGaze>());
81 78
    rsb::converter::converterRepository<string>()->registerConverter(gazeTargetConverter);
82 79

  
83 80
    //converter for MouthTarget
84
    rsb::converter::Converter<string>::Ptr mouthTargetConverter(new rsb::converter::ProtocolBufferConverter<rst::robot::MouthTarget>());
85
    rsb::converter::converterRepository<string>()->registerConverter(mouthTargetConverter);
81
    //rsb::converter::Converter<string>::Ptr mouthTargetConverter(new rsb::converter::ProtocolBufferConverter<rst::robot::MouthTarget>());
82
    //rsb::converter::converterRepository<string>()->registerConverter(mouthTargetConverter);
86 83

  
87 84
    //converter for Animation
88
    rsb::converter::Converter<string>::Ptr animationConverter(new rsb::converter::ProtocolBufferConverter<rst::robot::Animation>());
85
    rsb::converter::Converter<string>::Ptr animationConverter(new rsb::converter::ProtocolBufferConverter<rst::animation::HeadAnimation>());
89 86
    rsb::converter::converterRepository<string>()->registerConverter(animationConverter);
90 87

  
91 88
    //first get a factory instance that is used to create RSB domain objects
......
132 129
    init_callback("speech",    LocalServer::CallbackPtr(new SpeechCallbackWrapper(this)));
133 130
    init_callback("utterance", LocalServer::CallbackPtr(new UtteranceCallbackWrapper(this)));
134 131
    init_callback("gaze",      LocalServer::CallbackPtr(new GazeCallbackWrapper(this)));
135
    init_callback("mouth",     LocalServer::CallbackPtr(new MouthCallbackWrapper(this)));
132
    ///init_callback("mouth",     LocalServer::CallbackPtr(new MouthCallbackWrapper(this)));
136 133

  
137 134
    EmotionCallbackWrapper *emotion_cb = new EmotionCallbackWrapper(this);
138 135
    init_callback("defaultEmotion", LocalServer::CallbackPtr(emotion_cb));

Also available in: Unified diff