icub-client
pasar.h
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) 2014 ICUBCLIENT Consortium, European Commission FP7 Project IST-270490
5 * Authors: Stéphane Lallée, Grégoire Pointeau
6 * email: stephane.lallee@gmail.com, gregoire.pointeau@inserm.fr
7 * website: https://github.com/robotology/icub-client/
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 * $icub-client/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 #ifndef _PASAR_MODULE_H_
22 #define _PASAR_MODULE_H_
23 
24 #include <utility>
27 
32 {
34  double speed;
35  double acceleration;
37  double lastTimeSeen;
38  bool present;
39 };
40 
41 
45 class PasarModule : public yarp::os::RFModule {
46 protected:
47  //Parameter
52  double pTopDownWaving;
55  double thresholdWaving;
61 
62  double lastTimeWaving;
64 
65  bool checkWaving;
68 
69  yarp::os::Port handlerPort;
70 
71  yarp::sig::VectorOf<double> rightHandt1;
72  yarp::sig::VectorOf<double> rightHandt2;
73  yarp::sig::VectorOf<double> leftHandt1;
74  yarp::sig::VectorOf<double> leftHandt2;
75 
76  std::pair<bool, bool> presentRightHand;
77  std::pair<bool, bool> presentLeftHand;
78 
79  std::map<int, ObjectModel> presentObjectsLastStep;
80  std::map<int, std::pair<double, double> > presentLastSpeed;
81  std::map<int, std::pair<double, double> > presentCurrentSpeed;
82  std::map<int, ObjectModel> OPCEntities;
83 
84  bool isPointing;
85  bool isWaving;
86  double initTime;
87 
91  void saliencyTopDown();
92 
96  void saliencyNormalize();
97 
102  void saliencyLeakyIntegration();
103 
108  bool saliencyPointing();
109 
114  bool saliencyWaving();
115  void initializeMapTiming();
116 
117 public:
118  bool configure(yarp::os::ResourceFinder &rf); // configure all the module parameters and return true if successful
119  bool interruptModule(); // interrupt, e.g., the ports
120  bool close(); // close and shut down the module
121  bool respond(const yarp::os::Bottle& command, yarp::os::Bottle& reply);
122  double getPeriod();
123  bool updateModule();
124 };
125 
126 #endif
bool checkWaving
whether to detect waving of an agent
Definition: pasar.h:65
double speed
Definition: pasar.h:34
double thresholdWaving
minimum waving detected
Definition: pasar.h:55
double initTime
Definition: pasar.h:86
bool present
Definition: pasar.h:38
Grants access to high level motor commands (grasp, touch, look, goto, etc) of the robot as well as it...
Definition: icubClient.h:66
double thresholdMovementAccelAgent
minimum acceleration to detect an agent
Definition: pasar.h:53
double lastTimeSeen
Definition: pasar.h:37
double thresholdPointing
maximum distance between hand and object to detect pointing
Definition: pasar.h:56
yarp::sig::VectorOf< double > rightHandt2
position of right at t2
Definition: pasar.h:72
double dBurstOfPointing
how much to increase saliency if object is pointed at
Definition: pasar.h:60
std::map< int, ObjectModel > OPCEntities
Definition: pasar.h:82
double lastTimePointing
last time point when the agent was pointing
Definition: pasar.h:63
std::pair< bool, bool > presentRightHand
first: whether right hand was present at t1; second: whether right hand is present at t2 ...
Definition: pasar.h:76
bool isWaving
if if the human is waving
Definition: pasar.h:85
Represent any physical entity (including objects and agents) that can be stored within the OPC...
Definition: object.h:35
yarp::sig::VectorOf< double > rightHandt1
position of right at t1
Definition: pasar.h:71
double pTopDownDisappearanceBurst
score of saliency for an diappereance
Definition: pasar.h:49
double dthresholdAppear
minimum time an object has to be present before it is detected as appeared
Definition: pasar.h:58
icubclient::Object o
Definition: pasar.h:33
double pTopDownWaving
increase of saliency if waving
Definition: pasar.h:52
yarp::sig::VectorOf< double > leftHandt2
position of left hand at t2
Definition: pasar.h:74
double thresholdMovementAccelObject
minimum acceleration to detect an object
Definition: pasar.h:54
bool isPointing
if the human is pointing
Definition: pasar.h:84
yarp::sig::VectorOf< double > leftHandt1
position of left hand at t1
Definition: pasar.h:73
std::map< int, ObjectModel > presentObjectsLastStep
Definition: pasar.h:79
double pExponentialDecrease
Speed of the decrease of the saliency over the time (should be less than 1)
Definition: pasar.h:51
std::map< int, std::pair< double, double > > presentCurrentSpeed
Definition: pasar.h:81
icubclient::ICubClient * iCub
Definition: pasar.h:67
bool checkPointing
whether to detect pointing of an agent
Definition: pasar.h:66
double acceleration
Definition: pasar.h:35
double thresholdSaliency
if object saliency is below this value, it is set to 0
Definition: pasar.h:57
yarp::os::Port handlerPort
a port to handle messages
Definition: pasar.h:69
int restingSteps
Definition: pasar.h:36
std::pair< bool, bool > presentLeftHand
first: whether left hand was present at t1; second: whether left hand is present at t2 ...
Definition: pasar.h:77
double pTopDownAccelerationCoef
score of saliency for an acceleration detected
Definition: pasar.h:50
std::map< int, std::pair< double, double > > presentLastSpeed
Definition: pasar.h:80
double pTopDownAppearanceBurst
score of saliency for an appereance
Definition: pasar.h:48
double lastTimeWaving
last time point when the agent was waving
Definition: pasar.h:62
double dthresholdDisappear
minimum time an object has to be absent before it is detected as disappeared
Definition: pasar.h:59