iCub-main
Loading...
Searching...
No Matches
sensors.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2011 Department of Robotics Brain and Cognitive Sciences - Istituto Italiano di Tecnologia
3 * Author: Ugo Pattacini
4 * email: 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
94#ifndef __PERCEPTIVEMODELS_SENSORS_H__
95#define __PERCEPTIVEMODELS_SENSORS_H__
96
97#include <string>
98
99#include <yarp/os/Value.h>
100#include <yarp/os/Property.h>
101
102
103namespace iCub
104{
105
106namespace perception
107{
108
116{
117protected:
118 std::string name;
120 void *source;
121
122public:
126 Sensor();
127
132 std::string getName() const
133 {
134 return name;
135 }
136
145 virtual bool configure(void *source, const yarp::os::Property &options) = 0;
146
152 virtual bool getOutput(yarp::os::Value &in) const = 0;
153
157 virtual ~Sensor() { }
158};
159
160
166class SensorEncoders : public Sensor
167{
168protected:
169 int size;
170 int index;
171
172public:
184 bool configure(void *source, const yarp::os::Property &options);
185
191 bool getOutput(yarp::os::Value &in) const;
192};
193
194
202{
203protected:
207 mutable yarp::os::Value latch;
208
209public:
222 bool configure(void *source, const yarp::os::Property &options);
223
229 bool getOutput(yarp::os::Value &in) const;
230};
231
232
238class SensorPort : public Sensor
239{
240protected:
241 int index;
242
243public:
254 bool configure(void *source, const yarp::os::Property &options);
255
261 bool getOutput(yarp::os::Value &in) const;
262};
263
264
265}
266
267}
268
269#endif
270
271
This class implements the reading of encoders through MultipleAnalogSensors (MAS) interfaces.
Definition sensors.h:202
bool configure(void *source, const yarp::os::Property &options)
Configure the sensor.
Definition sensors.cpp:74
bool getOutput(yarp::os::Value &in) const
Retrieve the sensor encoder value.
Definition sensors.cpp:91
This class implements the reading of joints encoders.
Definition sensors.h:167
bool configure(void *source, const yarp::os::Property &options)
Configure the sensor.
Definition sensors.cpp:44
bool getOutput(yarp::os::Value &in) const
Retrieve the sensor joint value.
Definition sensors.cpp:60
This class implements the reading of a value from a port.
Definition sensors.h:239
bool getOutput(yarp::os::Value &in) const
Retrieve the sensor output.
Definition sensors.cpp:134
bool configure(void *source, const yarp::os::Property &options)
Configure the sensor.
Definition sensors.cpp:120
An abstract class that exposes the basic methods for sensors handling.
Definition sensors.h:116
virtual ~Sensor()
Destructor.
Definition sensors.h:157
Sensor()
Constructor.
Definition sensors.cpp:35
std::string getName() const
Retrieve the sensor name.
Definition sensors.h:132
virtual bool configure(void *source, const yarp::os::Property &options)=0
Configure the sensor.
virtual bool getOutput(yarp::os::Value &in) const =0
Retrieve the sensor raw output.
This file contains the definition of unique IDs for the body parts and the skin parts of the robot.