Fawkes API  Fawkes Development Version
gyro.h
1 /***************************************************************************
2  * gyro.h - Plugin for a gyro sensor on a model
3  *
4  * Created: Tue Feb 04 14:42:29 2014
5  * Copyright 2014 Frederik Zwilling
6  ****************************************************************************/
7 
8 /* This program 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 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program 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 Library General Public License for more details.
17  *
18  * Read the full text in the LICENSE.GPL file in the doc directory.
19  */
20 
21 #include <boost/bind.hpp>
22 #include <gazebo/gazebo.hh>
23 #include <gazebo/physics/physics.hh>
24 #include <gazebo/common/common.hh>
25 #include <stdio.h>
26 #include <gazebo/transport/transport.hh>
27 #include <list>
28 #include <string.h>
29 
30 namespace gazebo
31 {
32  /** @class Gyro
33  * Plugin for a gyro sensor on a model
34  * @author Frederik Zwilling
35  */
36  class Gyro : public ModelPlugin
37  {
38  public:
39  ///Constructor
40  Gyro();
41 
42  ///Destructor
43  ~Gyro();
44 
45  //Overridden ModelPlugin-Functions
46  virtual void Load(physics::ModelPtr _parent, sdf::ElementPtr /*_sdf*/);
47  virtual void OnUpdate(const common::UpdateInfo &);
48  virtual void Reset();
49 
50  private:
51  /// Pointer to the model
52  physics::ModelPtr model_;
53  /// Pointer to the update event connection
54  event::ConnectionPtr update_connection_;
55  ///Node for communication to fawkes
56  transport::NodePtr node_;
57  ///name of the gyro and the communication channel
58  std::string name_;
59 
60  ///time variable to send in intervals
61  double last_sent_time_;
62 
63  ///time interval between to gyro msgs
64  double send_interval_;
65 
66 
67  //Gyro Stuff:
68  ///Sending Gyro-angle to fawkes:
69  void send_gyro();
70 
71  ///Publisher for GyroAngle
72  transport::PublisherPtr gyro_pub_;
73  };
74 }
Plugin for a gyro sensor on a model.
Definition: gyro.h:36
virtual void Reset()
on Gazebo reset
Definition: gyro.cpp:84
Definition: gps.h:30
virtual void OnUpdate(const common::UpdateInfo &)
Called by the world update start event.
Definition: gyro.cpp:71
virtual void Load(physics::ModelPtr _parent, sdf::ElementPtr)
on loading of the plugin
Definition: gyro.cpp:42
~Gyro()
Destructor.
Definition: gyro.cpp:34
Gyro()
Constructor.
Definition: gyro.cpp:30