iCub-main
icub-main
src
simulators
iCubSimulation
EyeLidsController.cpp
Go to the documentation of this file.
1
// -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
2
3
/*
4
* Copyright (C) 2010 RobotCub Consortium, European Commission FP6 Project IST-004370
5
* Author: Martin Peniak, Vadim Tikhanoff
6
* email: martin.peniak@plymouth.ac.uk, vadim.tikhanoff@iit.it
7
* website: www.robotcub.org
8
* Permission is granted to copy, distribute, and/or modify this program
9
* under the terms of the GNU General Public License, version 2 or any
10
* later version published by the Free Software Foundation.
11
*
12
* A copy of the license can be found at
13
* http://www.robotcub.org/icub/license/gpl.txt
14
*
15
* This program is distributed in the hope that it will be useful, but
16
* WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
18
* Public License for more details
19
*/
20
21
#include "
EyeLidsController.h
"
22
#include <yarp/os/LogStream.h>
23
24
using namespace
yarp::os;
25
using namespace
yarp::sig;
26
using namespace
std;
27
28
EyeLids::EyeLids
()
29
{
30
31
}
32
33
EyeLids::~EyeLids
()
34
{
35
ClosePort();
36
}
37
38
void
EyeLids::ClosePort
()
39
{
40
port.close();
41
}
42
43
void
EyeLids::setName
(
string
name) {
44
this->portName = name;
45
OpenPort();
46
}
47
48
bool
EyeLids::OpenPort
()
49
{
50
string
eyelidsName =
"/face/eyelids"
;
51
string
eyelicsPort = this->portName + eyelidsName;
52
port.open( eyelicsPort.c_str() );
53
return
true
;
54
}
55
56
57
void
EyeLids::checkPort
()
58
{
59
if
(port.getInputCount()>0)
60
{
61
Bottle *bot = port.read(
false
);
62
if
(bot!=NULL){
63
eyeLidsRotation = (float)bot->get(0).asFloat64();
64
yDebug(
"Message received: %s\n"
,bot->toString().c_str());
65
bot->clear();
66
}
67
}
68
}
EyeLidsController.h
EyeLids::ClosePort
void ClosePort()
Definition:
EyeLidsController.cpp:38
EyeLids::OpenPort
bool OpenPort()
Definition:
EyeLidsController.cpp:48
EyeLids::~EyeLids
~EyeLids()
Definition:
EyeLidsController.cpp:33
EyeLids::setName
void setName(std::string module)
Definition:
EyeLidsController.cpp:43
EyeLids::EyeLids
EyeLids()
Definition:
EyeLidsController.cpp:28
EyeLids::checkPort
void checkPort()
Definition:
EyeLidsController.cpp:57
Generated on Mon Jan 30 2023 11:20:16 for iCub-main by
1.9.1