Revision 07e68eb7 examples/humotion_yarp_icub/src/icub_faceinterface.cpp

View differences:

examples/humotion_yarp_icub/src/icub_faceinterface.cpp
28 28
#include "humotion_yarp_icub/icub_faceinterface.h"
29 29

  
30 30
#include <boost/format.hpp>
31
#include <boost/lexical_cast.hpp>
31 32

  
32 33
#include <algorithm>
33 34
#include <string>
......
46 47
    std::string emotion_scope = scope + "/face/raw/in";
47 48
    cout << "opening connection to '"<< emotion_scope << "'\n";
48 49

  
50
    bool init_ok = true;
49 51
    for (int i = 0; i < 4; i++) {
50 52
        // strange, if we use one output port only the first command is executed?! flushing issues?
51
        std::string emotion_port_out = "/emotionwriter" + std::to_string((unsigned long long)i);
53
        std::string emotion_port_out = "/emotionwriter" + boost::lexical_cast<std::string>(i);
52 54
        if (!emotion_port[i].open(emotion_port_out.c_str())) {
53 55
            cerr << "ERROR: failed to open emotion port '" << emotion_port_out << "'\n";
54
            exit(EXIT_FAILURE);
56
            init_ok = false;
55 57
        }
56 58
        if (!Network::connect(emotion_port_out.c_str(), emotion_scope.c_str())) {
57 59
            cerr << "ERROR: failed to connect to emotion port '" << emotion_port_out << "'\n";
58
            exit(EXIT_FAILURE);
60
            init_ok = false;
59 61
        }
60 62
    }
63

  
64
    if (!init_ok) {
65
        cerr << "ERROR: failed to set up emotion component\n";
66
        cerr << "       please make sure that the faceExpressions yarpdev is started\n";
67
        cerr << "       (e.g.  yarpdev --name /icub/face/raw --device serial ... is running)\n";
68
        exit(EXIT_FAILURE);
69
    }
61 70
}
62 71

  
63 72
//! destructor
......
138 147

  
139 148
        std::string cmd_s;
140 149
        if (id == iCubJointInterface::ICUB_ID_EYES_LEFT_BROW) {
141
            cmd_s = "L0" + std::to_string((unsigned long long)icub_val);
150
            cmd_s = "L0" + boost::lexical_cast<std::string>(icub_val);
142 151
        } else {
143
            cmd_s = "R0" + std::to_string((unsigned long long)icub_val);
152
            cmd_s = "R0" + boost::lexical_cast<std::string>(icub_val);
144 153
        }
145 154

  
146 155
        cout << "SETTING EYEBROW " << id << " (" << angle << " -> " << cmd_s << ")\n";

Also available in: Unified diff