d4c
Main Page
Modules
Data Structures
Files
File List
modules
d4cServer
main.cpp
1
/*
2
* Copyright (C) 2013 iCub Facility - Istituto Italiano di Tecnologia
3
* Author: Ilaria Gori, Ugo Pattacini
4
* email: ilaria.gori@iit.it, ugo.pattacini@iit.it
5
* Permission is granted to copy, distribute, and/or modify this program
6
* under the terms of the GNU General Public License, version 2 or any
7
* later version published by the Free Software Foundation.
8
*
9
* A copy of the license can be found at
10
* http://www.robotcub.org/icub/license/gpl.txt
11
*
12
* This program is distributed in the hope that it will be useful, but
13
* WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
15
* Public License for more details
16
*/
17
64
#include <string>
65
66
#include <yarp/os/Network.h>
67
#include <yarp/os/RFModule.h>
68
#include <yarp/os/Log.h>
69
#include <yarp/dev/Drivers.h>
70
71
#include <iCub/d4c/d4c_server.h>
72
73
using namespace
std
;
74
using namespace
yarp::os
;
75
using namespace
iCub::d4c
;
76
77
78
/************************************************************************/
79
class
ServerModule:
public
RFModule
80
{
81
protected
:
82
D4CServer server;
83
84
public
:
85
/************************************************************************/
86
bool
configure(ResourceFinder &rf)
87
{
88
int
verbosity=rf.check(
"verbosity"
,Value(0)).asInt();
89
int
period=rf.check(
"period"
,Value(20)).asInt();
90
string
device=rf.check(
"device"
,Value(
"cartesiancontrollerclient"
)).asString().c_str();
91
string
name=rf.check(
"name"
,Value(
"d4c_server"
)).asString().c_str();
92
string
robot=rf.check(
"robot"
,Value(
"icub"
)).asString().c_str();
93
string
part=rf.check(
"part"
,Value(
"both_arms"
)).asString().c_str();
94
95
Property options;
96
options.put(
"verbosity"
,verbosity);
97
options.put(
"period"
,period);
98
options.put(
"device"
,device.c_str());
99
options.put(
"name"
,name.c_str());
100
options.put(
"robot"
,robot.c_str());
101
options.put(
"part"
,part.c_str());
102
103
return
server.open(options);
104
}
105
106
/************************************************************************/
107
bool
close()
108
{
109
server.close();
110
return
true
;
111
}
112
113
/************************************************************************/
114
double
getPeriod()
115
{
116
return
1.0;
117
}
118
119
/************************************************************************/
120
bool
updateModule()
121
{
122
return
true
;
123
}
124
};
125
126
127
/************************************************************************/
128
int
main(
int
argc,
char
*argv[])
129
{
130
Network yarp;
131
if
(!yarp.checkNetwork())
132
{
133
yError(
"YARP server not available!"
);
134
return
-1;
135
}
136
137
ResourceFinder rf;
138
rf.setVerbose(
true
);
139
rf.configure(argc,argv);
140
141
ServerModule mod;
142
return
mod.runModule(rf);
143
}
144
145
146
std
iCub::d4c
Definition:
d4c.h:46
os
Generated on Sun May 31 2015 15:17:45 for d4c by
1.8.9