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 <core/threading/thread.h>
27 #include <aspect/blocked_timing.h>
28 #include <aspect/logging.h>
29 #include <aspect/clock.h>
30 #include <aspect/configurable.h>
31 #include <aspect/blackboard.h>
32 
33 #include <string>
34 #include <vector>
35 
36 class RobotinoComThread;
37 
38 namespace fawkes {
39  class BatteryInterface;
40  class RobotinoSensorInterface;
41  class IMUInterface;
42 }
43 
44 
46 : public fawkes::Thread,
48  public fawkes::LoggingAspect,
49  public fawkes::ClockAspect,
52 {
53  friend class RobotinoActThread;
54  public:
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() */
62  protected: virtual void run() { Thread::run(); }
63 
64  private: // methods
65  void process_sensor_msgs();
66  void update_distances(float *voltages);
67 
68  // Voltage to distance data points
69  static const std::vector<std::pair<double, double> > voltage_to_dist_dps_;
70 
71 
72  private: // members
73  RobotinoComThread *com_;
74 
75  bool cfg_enable_gyro_;
76  std::string cfg_imu_iface_id_;
77 
78  fawkes::BatteryInterface *batt_if_;
80  fawkes::IMUInterface *imu_if_;
81 
82 };
83 
84 
85 #endif
virtual void run()
Stub to see name in backtrace for easier debugging.
Definition: sensor_thread.h:62
Thread aspect to access to BlackBoard.
Definition: blackboard.h:34
Thread aspect that allows to obtain the current time from the clock.
Definition: clock.h:36
Fawkes library namespace.
virtual void run()
Code to execute in the thread.
Definition: thread.cpp:939
BatteryInterface Fawkes BlackBoard Interface.
Thread class encapsulation of pthreads.
Definition: thread.h:42
RobotinoSensorInterface Fawkes BlackBoard Interface.
Thread aspect to use blocked timing.
Robotino act hook integration thread.
Definition: act_thread.h:47
Virtual base class for thread that communicates with a Robotino.
Definition: com_thread.h:39
Thread aspect to log output.
Definition: logging.h:35
Robotino sensor hook integration thread.
Definition: sensor_thread.h:45
virtual void init()
Initialize the thread.
Definition: act_thread.cpp:56
Thread aspect to access configuration data.
Definition: configurable.h:35
IMUInterface Fawkes BlackBoard Interface.
Definition: IMUInterface.h:33
virtual void loop()
Code to execute in the thread.
Definition: act_thread.cpp:149
virtual void finalize()
Finalize the thread.
Definition: act_thread.cpp:129