Revision b1a51350

View differences:

server/action/gazetarget.action
14 14
float32 pan_offset
15 15
float32 tilt_offset
16 16

  
17
#relative or absolute gaze target?
18
uint8 GAZETARGET_RELATIVE  = 0
19
uint8 GAZETARGET_ABSOLUTE  = 0
20
uint8 type
21

  
22
#timestamp of the target (important in case of relative targets)
23
time timestamp
24

  
17 25
---
18 26
#result
19 27
uint32 result
server/include/ROS/GazeCallbackWrapperROS.h
42 42
        //
43 43
    };
44 44

  
45
    //! this provides a consistent transformation of ros ts to double
46
    double convert_ros_to_timestamp_ms(ros::Time t){
47
            return t.sec + t.nsec/1000000000.0;
48
    }
49

  
50

  
45 51
    void call(const GoalConstPtr &goal){
46 52
        feedback.result = 1;
47 53

  
......
55 61
        gaze_state.tilt  = request->tilt;
56 62
        gaze_state.roll  = request->roll;
57 63

  
58
        gaze_state.timestamp = get_timestamp(); //FIXME!!
64
        //use timestamp from request
65
        gaze_state.timestamp = convert_ros_to_timestamp_ms(request->timestamp); //get_timestamp();
66
        if (request->type == hlrc_server::gazetargetGoal::GAZETARGET_RELATIVE){
67
            gaze_state.type = humotion::GazeState::RELATIVE;
68
        }else{
69
            gaze_state.type = humotion::GazeState::ABSOLUTE;
70
        }
59 71

  
60 72
        //default:
61 73
        gaze_state.vergence  = request->vergence;
server/include/RSB/GazeCallbackWrapper.h
43 43
            gaze_state.pan   = gaze->pan();
44 44
            gaze_state.tilt  = gaze->tilt();
45 45
            gaze_state.roll  = gaze->roll();
46
            //RSB supports only absolute targets for now...
46 47
            gaze_state.timestamp = 123.45; //FIXME!!
48
            gaze_state.type  = humotion::GazeState::ABSOLUTE;
47 49
            //vergence
48 50
            gaze_state.vergence  = (gaze->has_vergence())?gaze->vergence():0.0;
49 51
            //offsets
server/src/MiddlewareROS.cpp
48 48
    actionlib::SimpleActionClient<actionspec> *ac = new actionlib::SimpleActionClient<actionspec>(scope, true);
49 49

  
50 50
    if (!ac->waitForServer(ros::Duration(1))){
51
        char buf[256];
52
        snprintf(buf, 256, "ERROR: action service %s not ready", scope.c_str());
53
        throw runtime_error(buf);
51
        printf("> ERROR: action service %s not ready, wait timed out...\n", scope.c_str());
52
        return NULL;
54 53
    }
55 54
    return ac;
56 55
}
......
102 101

  
103 102
    //create tts client
104 103
    tts_ac = create_action_client<hlrc_server::ttsAction>(base_scope + "/tts_provider");
104
    if (tts_ac == NULL){
105
        printf("> tts action service not available, will not do any TTS !\n");
106
    }
105 107

  
106 108

  
107 109

  
......
116 118

  
117 119
//call a tts system to convert a string to an utterance
118 120
boost::shared_ptr<Utterance> MiddlewareROS::tts_call(string text){
119
    //double tts_timeout = 1.0; //seconds. DO NOT CHANGE THIS!
120

  
121 121
    boost::shared_ptr<Utterance> utterance(new Utterance());
122 122

  
123
    //double tts_timeout = 1.0; //seconds. DO NOT CHANGE THIS!
124
    if (tts_ac == NULL){
125
        printf("> tts action service not available. will not speak '%s'\n", text.c_str());
126
        return utterance;
127
    }
128

  
123 129
    hlrc_server::ttsGoal goal;
124 130

  
125 131
    goal.text = text;

Also available in: Unified diff