ev3_gyro_controller.h
1 /*
2  * This file (ev3_gyro_controller.h) is part of h4r_ev3_control.
3  * Date: 01.01.2016
4  *
5  * Author: Christian Holl
6  * http://github.com/Hacks4ROS
7  *
8  * h4r_ev3_control is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * h4r_ev3_control is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with h4r_ev3_control. If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 #ifndef EV3_GYRO_CONTROLLER_H_
23 #define EV3_GYRO_CONTROLLER_H_
24 
25 #include <controller_interface/controller.h>
26 #include <pluginlib/class_list_macros.h>
27 #include <realtime_tools/realtime_publisher.h>
28 #include <boost/shared_ptr.hpp>
29 #include <sensor_msgs/Imu.h>
30 #include <tf/tf.h>
31 #include <limits>
32 
33 #include <h4r_ev3_control/Ev3SensorInterface.h>
34 
35 namespace ev3_control
36 {
51 class Ev3GyroController: public controller_interface::Controller<
52  Ev3SensorInterface>
53 {
54 private:
55  std::string port_;
56  Ev3Strings::Ev3GyroMode mode_;
57  Ev3SensorHandle handle_;
58  H4REv3GyroSensorSpecIface gyro_interface_;
59  bool sensor_mode_needs_init_;
60 
61  std::string frame_id_;
62 
63  //Range Publisher
64  typedef boost::shared_ptr<
65  realtime_tools::RealtimePublisher<sensor_msgs::Imu> > RtImuPublisherPtr;
66  RtImuPublisherPtr realtime_imu_publisher_;
67 
68 
69 
70  ros::Time last_publish_time_;
71  double publish_rate_;
72 
73 public:
75  virtual ~Ev3GyroController();
76 
77  virtual bool init(Ev3SensorInterface* hw,
78  ros::NodeHandle &root_nh,
79  ros::NodeHandle& ctrl_nh);
80 
81  virtual void starting(const ros::Time& time);
82  virtual void update(const ros::Time& time, const ros::Duration& /*period*/);
83  virtual void stopping(const ros::Time& /*time*/){}
84 
85 };
86 
87 } /* namespace ev3_control */
88 
89 #endif /* EV3_GYRO_CONTROLLER_H_ */
Definition: ev3_gyro_controller.h:51
Definition: Ev3SensorInterface.h:35
Definition: Ev3SensorInterface.h:97