humotion / examples / humotion_yarp_icub / src / main.cpp @ 6a2d467f
History | View | Annotate | Download (2.396 KB)
1 |
/*
|
---|---|
2 |
* This file is part of humotion
|
3 |
*
|
4 |
* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
|
5 |
* http://opensource.cit-ec.de/projects/humotion
|
6 |
*
|
7 |
* This file may be licensed under the terms of the
|
8 |
* GNU Lesser General Public License Version 3 (the ``LGPL''),
|
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 LGPL for the specific language
|
14 |
* governing rights and limitations.
|
15 |
*
|
16 |
* You should have received a copy of the LGPL along with this
|
17 |
* program. If not, go to http://www.gnu.org/licenses/lgpl.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 |
#include <humotion/server/server.h> |
29 |
#include <stdio.h> |
30 |
#include <yarp/dev/ControlBoardInterfaces.h> |
31 |
#include <yarp/dev/PolyDriver.h> |
32 |
#include <yarp/os/Network.h> |
33 |
#include <yarp/os/Property.h> |
34 |
#include <yarp/os/RateThread.h> |
35 |
#include <yarp/os/Time.h> |
36 |
#include <yarp/sig/Vector.h> |
37 |
|
38 |
#include <iostream> |
39 |
#include <string> |
40 |
|
41 |
#include "humotion_yarp_icub/icub_data_receiver.h" |
42 |
#include "humotion_yarp_icub/icub_jointinterface.h" |
43 |
|
44 |
using std::cerr;
|
45 |
|
46 |
// using namespace yarp::dev;
|
47 |
// using namespace yarp::sig;
|
48 |
// using namespace yarp::os;
|
49 |
// using namespace std;
|
50 |
|
51 |
|
52 |
int main(int argc, char *argv[]) { |
53 |
Network yarp; |
54 |
|
55 |
if (!yarp.checkNetwork()) {
|
56 |
cerr << "no yarp network, exiting\n";
|
57 |
return EXIT_FAILURE;
|
58 |
} |
59 |
|
60 |
Property params; |
61 |
params.fromCommand(argc, argv); |
62 |
|
63 |
if (!params.check("robot")) { |
64 |
cerr << "Please specify the name of the robot\n";
|
65 |
cerr << "--robot name (e.g. icub or icubSim)\n";
|
66 |
return EXIT_FAILURE;
|
67 |
} |
68 |
|
69 |
string robotName = params.find("robot").asString().c_str(); |
70 |
string scope = "/" + robotName; |
71 |
|
72 |
|
73 |
// create humotion interface
|
74 |
iCubJointInterface *icub_jointinterface = new iCubJointInterface(scope);
|
75 |
humotion::server::Server *humotion_server = |
76 |
new humotion::server::Server("/icub", "ROS", icub_jointinterface); |
77 |
|
78 |
icub_jointinterface->run(); |
79 |
|
80 |
while (humotion_server->ok()) {
|
81 |
usleep(1000);
|
82 |
} |
83 |
|
84 |
return EXIT_SUCCESS;
|
85 |
} |