Fawkes API Fawkes Development Version
sensor_thread.h
1
2/***************************************************************************
3 * sensor_thread.h - Robotino sensor thread
4 *
5 * Created: Sun Nov 13 15:33:04 2011
6 * Copyright 2011-2012 Tim Niemueller [www.niemueller.de]
7 *
8 ****************************************************************************/
9
10/* This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Library General Public License for more details.
19 *
20 * Read the full text in the LICENSE.GPL file in the doc directory.
21 */
22
23#ifndef _PLUGINS_ROBOTINO_SENSOR_THREAD_H_
24#define _PLUGINS_ROBOTINO_SENSOR_THREAD_H_
25
26#include <aspect/blackboard.h>
27#include <aspect/blocked_timing.h>
28#include <aspect/clock.h>
29#include <aspect/configurable.h>
30#include <aspect/logging.h>
31#include <core/threading/thread.h>
32
33#include <string>
34#include <vector>
35
38
39namespace fawkes {
40class BatteryInterface;
41class RobotinoSensorInterface;
42class IMUInterface;
43} // namespace fawkes
44
51{
52 friend RobotinoActThread;
53
54public:
56
57 virtual void init();
58 virtual void loop();
59 virtual void finalize();
60
61 /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
62protected:
63 virtual void
65 {
66 Thread::run();
67 }
68
69private: // methods
70 void process_sensor_msgs();
71 void update_distances(float *voltages);
72
73 // Voltage to distance data points
74 static const std::vector<std::pair<double, double>> voltage_to_dist_dps_;
75
76private: // members
78
79 bool cfg_enable_gyro_;
80 std::string cfg_imu_iface_id_;
81
82 fawkes::BatteryInterface * batt_if_;
84 fawkes::IMUInterface * imu_if_;
85};
86
87#endif
Robotino act hook integration thread.
Definition: act_thread.h:57
Virtual base class for thread that communicates with a Robotino.
Definition: com_thread.h:41
Robotino sensor hook integration thread.
Definition: sensor_thread.h:51
virtual void finalize()
Finalize the thread.
virtual void init()
Initialize the thread.
virtual void loop()
Code to execute in the thread.
RobotinoSensorThread(RobotinoComThread *com_thread)
Constructor.
virtual void run()
Stub to see name in backtrace for easier debugging.
Definition: sensor_thread.h:64
BatteryInterface Fawkes BlackBoard Interface.
Thread aspect to access to BlackBoard.
Definition: blackboard.h:34
Thread aspect to use blocked timing.
Thread aspect that allows to obtain the current time from the clock.
Definition: clock.h:34
Thread aspect to access configuration data.
Definition: configurable.h:33
IMUInterface Fawkes BlackBoard Interface.
Definition: IMUInterface.h:34
Thread aspect to log output.
Definition: logging.h:33
RobotinoSensorInterface Fawkes BlackBoard Interface.
Thread class encapsulation of pthreads.
Definition: thread.h:46
Fawkes library namespace.