Statistics
| Branch: | Tag: | Revision:

humotion / examples / yarp_icub / src / main.cpp @ 6e23ab1a

History | View | Annotate | Download (1.396 KB)

1
#include <stdio.h>
2
#include <yarp/os/Network.h>
3
#include <yarp/dev/ControlBoardInterfaces.h>
4
#include <yarp/dev/PolyDriver.h>
5
#include <yarp/os/Time.h>
6
#include <yarp/sig/Vector.h>
7
#include "icub_jointinterface.h"
8
#include <humotion/server/server.h>
9
#include <yarp/os/Network.h>
10
#include <yarp/os/RateThread.h>
11
#include <yarp/os/Time.h>
12
#include <yarp/os/Property.h>
13
#include <yarp/dev/ControlBoardInterfaces.h>
14
#include <string>
15
#include <iostream>
16
#include <icub_data_receiver.h>
17

    
18

    
19
using namespace yarp::dev;
20
using namespace yarp::sig;
21
using namespace yarp::os;
22
using namespace std;
23

    
24

    
25
int main(int argc, char *argv[]){
26
    Network yarp;
27

    
28
    if (!yarp.checkNetwork()){
29
        printf("No yarp network, quitting\n");
30
        return false;
31
    }
32

    
33
    Property params;
34
    params.fromCommand(argc, argv);
35

    
36
    if (!params.check("robot")){
37
        fprintf(stderr, "Please specify the name of the robot\n");
38
        fprintf(stderr, "--robot name (e.g. icub or icubSim)\n");
39
        return -1;
40
    }
41

    
42
    string robotName=params.find("robot").asString().c_str();
43
    string scope="/"+robotName;
44

    
45

    
46
    //create humotion interface
47
    iCubJointInterface *icub_jointinterface = new iCubJointInterface(scope);
48
    humotion::server::Server *humotion_server = new humotion::server::Server("/icub", "ROS", icub_jointinterface);
49
    icub_jointinterface->run();
50

    
51
    while(humotion_server->ok()){
52
        usleep(100000);
53
    }
54
    return 0;
55
}