humotion / examples / yarp_icub / src / main.cpp @ 83864a21
History | View | Annotate | Download (2.455 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 |
using yarp::os::Network;
|
46 |
using yarp::os::Property;
|
47 |
|
48 |
// using namespace yarp::dev;
|
49 |
// using namespace yarp::sig;
|
50 |
// using namespace yarp::os;
|
51 |
// using namespace std;
|
52 |
|
53 |
|
54 |
int main(int argc, char *argv[]) { |
55 |
Network yarp; |
56 |
|
57 |
if (!yarp.checkNetwork()) {
|
58 |
cerr << "no yarp network, exiting\n";
|
59 |
return EXIT_FAILURE;
|
60 |
} |
61 |
|
62 |
Property params; |
63 |
params.fromCommand(argc, argv); |
64 |
|
65 |
if (!params.check("robot")) { |
66 |
cerr << "Please specify the name of the robot\n";
|
67 |
cerr << "--robot name (e.g. icub or icubSim)\n";
|
68 |
return EXIT_FAILURE;
|
69 |
} |
70 |
|
71 |
std::string robotName = params.find("robot").asString().c_str(); |
72 |
std::string scope = "/" + robotName; |
73 |
|
74 |
|
75 |
// create humotion interface
|
76 |
iCubJointInterface *icub_jointinterface = new iCubJointInterface(scope);
|
77 |
humotion::server::Server *humotion_server = |
78 |
new humotion::server::Server("/icub", "ROS", icub_jointinterface); |
79 |
|
80 |
icub_jointinterface->run(); |
81 |
|
82 |
while (humotion_server->ok()) {
|
83 |
usleep(1000);
|
84 |
} |
85 |
|
86 |
return EXIT_SUCCESS;
|
87 |
} |