Fawkes API  Fawkes Development Version
act_thread.h
1 
2 /***************************************************************************
3  * act_thread.h - Robotino act thread
4  *
5  * Created: Sun Nov 13 16:05:34 2011
6  * Copyright 2011-2014 Tim Niemueller [www.niemueller.de]
7  * 2014 Sebastian Reuter
8  * 2014 Tobias Neumann
9  ****************************************************************************/
10 
11 /* This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL file in the doc directory.
22  */
23 
24 #ifndef __PLUGINS_ROBOTINO_ACT_THREAD_H_
25 #define __PLUGINS_ROBOTINO_ACT_THREAD_H_
26 
27 #include <core/threading/thread.h>
28 #include <aspect/blocked_timing.h>
29 #include <aspect/logging.h>
30 #include <aspect/configurable.h>
31 #include <aspect/blackboard.h>
32 #include <aspect/clock.h>
33 #ifdef HAVE_TF
34 # include <aspect/tf.h>
35 #endif
36 
37 #include <string>
38 
39 namespace fawkes {
40  class MotorInterface;
41  class GripperInterface;
42  class IMUInterface;
43 }
44 
45 class RobotinoComThread;
46 
48 : public fawkes::Thread,
49  public fawkes::LoggingAspect,
51  public fawkes::ClockAspect,
52 #ifdef HAVE_TF
54 #endif
57 {
58  public:
60 
61  virtual void init();
62  virtual void once();
63  virtual void loop();
64  virtual void finalize();
65 
66  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
67  protected: virtual void run() { Thread::run(); }
68 
69  private:
70  typedef enum {
71  ODOM_COPY,
72  ODOM_CALC
73  } OdometryMode;
74 
75  void publish_odometry();
76  void publish_gripper();
77 
78  private:
79  RobotinoComThread *com_;
80 
81  unsigned int last_seqnum_;
82  fawkes::MotorInterface *motor_if_;
83  fawkes::GripperInterface *gripper_if_;
84  fawkes::IMUInterface *imu_if_;
85  unsigned int imu_if_nochange_loops_;
86  bool imu_if_writer_warning_printed_;
87  bool imu_if_invquat_warning_printed_;
88  bool imu_if_changed_warning_printed_;
89  bool msg_received_;
90  bool msg_zero_vel_;
91  fawkes::Time last_msg_time_;
92 
93  float cfg_deadman_threshold_;
94  float cfg_odom_time_offset_;
95  bool cfg_gripper_enabled_;
96  std::string cfg_odom_frame_;
97  std::string cfg_base_frame_;
98  OdometryMode cfg_odom_mode_;
99  unsigned int cfg_imu_deadman_loops_;
100  float cfg_odom_corr_phi_;
101  float cfg_odom_corr_trans_;
102  bool cfg_bumper_estop_enabled_;
103  float cfg_rb_;
104  float cfg_rw_;
105  float cfg_gear_;
106  float cfg_trans_accel_;
107  float cfg_trans_decel_;
108  float cfg_rot_accel_;
109  float cfg_rot_decel_;
110 
111  bool gripper_close_;
112 
113  float odom_x_;
114  float odom_y_;
115  float odom_phi_;
116  float odom_gyro_origin_;
117  fawkes::Time *odom_time_;
118 
119  float des_vx_;
120  float des_vy_;
121  float des_omega_;
122  std::string last_transrot_sender_;
123 };
124 
125 
126 #endif
virtual void run()
Stub to see name in backtrace for easier debugging.
Definition: act_thread.h:67
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
A class for handling time.
Definition: time.h:91
Thread class encapsulation of pthreads.
Definition: thread.h:42
Thread aspect to access the transform system.
Definition: tf.h:42
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
Thread aspect to access configuration data.
Definition: configurable.h:35
IMUInterface Fawkes BlackBoard Interface.
Definition: IMUInterface.h:33
MotorInterface Fawkes BlackBoard Interface.
GripperInterface Fawkes BlackBoard Interface.