icub-client
object.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 WYSIWYD Consortium, European Commission FP7 Project ICT-612139
3  * Authors: Stéphane Lallée
4  * email: stephane.lallee@gmail.com
5  * website: https://github.com/robotology/icub-client/
6  * Permission is granted to copy, distribute, and/or modify this program
7  * under the terms of the GNU General Public License, version 2 or any
8  * later version published by the Free Software Foundation.
9  *
10  * A copy of the license can be found at
11  * icub-client/license/gpl.txt
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
16  * Public License for more details
17  */
18 
19 #ifndef __ICUBCLIENT_OBJECT_H__
20 #define __ICUBCLIENT_OBJECT_H__
21 
22 #include <yarp/sig/all.h>
23 #include "entity.h"
24 #include "icubclient/tags.h"
25 
26 namespace icubclient{
27 
28 enum class ObjectArea : int {HUMAN = 1, ROBOT = 2, SHARED = 3, NOTREACHABLE = 4};
29 
35 class Object: public Entity
36 {
37  friend class OPCClient;
38 
39 public:
40  Object();
41  Object(const Object &b);
42 
46  yarp::sig::VectorOf<double> m_ego_position;
47 
51  yarp::sig::VectorOf<double> m_ego_orientation;
52 
56  yarp::sig::VectorOf<double> m_dimensions;
57 
61  yarp::sig::VectorOf<double> m_color;
62 
69  double m_present;
70 
74  double m_saliency;
75 
80 
84  double m_value;
85 
86  virtual bool isType(std::string _entityType) const
87  {
88  if (_entityType == ICUBCLIENT_OPC_ENTITY_OBJECT) {
89  return true;
90  } else {
91  return this->Entity::isType(_entityType);
92  }
93  }
94 
95  virtual yarp::os::Bottle asBottle() const;
96  virtual bool fromBottle(const yarp::os::Bottle &b);
97  virtual std::string toString() const;
98 
104  yarp::sig::VectorOf<double> getSelfRelativePosition(const yarp::sig::VectorOf<double> &vInitialRoot) const;
105 
106  std::string objectAreaAsString() const {
107  return objectAreaAsString(m_objectarea);
108  }
109 
110  static std::string objectAreaAsString(const icubclient::ObjectArea &o);
111  static icubclient::ObjectArea stringToObjectArea(const std::string &o);
112 
117  double saliency() const;
118 
123  void setSaliency(double saliency);
124 
129  double value() const;
130 
135  void setValue(double value);
136 };
137 
138 } //namespace
139 
140 #endif
141 
yarp::sig::VectorOf< double > m_color
Mean color of the object (r,g,b) used mainly for debugging/displaying purposes in the iCubGUI...
Definition: object.h:61
Represent any entity that can be stored within the OPC.
Definition: entity.h:40
std::string objectAreaAsString() const
Definition: object.h:106
yarp::sig::VectorOf< double > m_ego_orientation
Orientation of the Object, in the initial ego-centered reference frame of the agent mainting the OPC ...
Definition: object.h:51
ObjectArea
Definition: object.h:28
virtual bool isType(std::string _entityType) const
Test if an entity is inheriting a given type.
Definition: entity.h:67
double m_present
Is the object present in the scene A value of 1.0 means that the object currently is in the scene A v...
Definition: object.h:69
Represent any physical entity (including objects and agents) that can be stored within the OPC...
Definition: object.h:35
yarp::sig::VectorOf< double > m_ego_position
Position of the Object, in the initial ego-centered reference frame of the agent mainting the OPC (in...
Definition: object.h:46
virtual bool isType(std::string _entityType) const
Test if an entity is inheriting a given type.
Definition: object.h:86
yarp::sig::VectorOf< double > m_dimensions
Dimensions of the Object, in meters.
Definition: object.h:56
An OPC client using the datastructures defined within the icub-client library.
Definition: opcClient.h:35
ObjectArea m_objectarea
Whether the object is accessible by only the robot, only the human, both or neither agent...
Definition: object.h:79
#define ICUBCLIENT_OPC_ENTITY_OBJECT
Definition: tags.h:38
double m_saliency
A measurement of the object saliency [0,1].
Definition: object.h:74
double m_value
A measurement of the object subjective value [0,1].
Definition: object.h:84