Fawkes API  Fawkes Development Version
gps.h
1 /***************************************************************************
2  * gps.h - provides ground truth position
3  *
4  * Created: Tue Feb 04 15:05:07 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/bind.hpp>
22 #include <gazebo/common/common.hh>
23 #include <gazebo/gazebo.hh>
24 #include <gazebo/physics/physics.hh>
25 #include <gazebo/transport/transport.hh>
26 #include <list>
27 #include <stdio.h>
28 #include <string.h>
29 
30 namespace gazebo {
31 /**
32  * Provides ground Truth position
33  * @author Frederik Zwilling
34  */
35 class Gps : public ModelPlugin
36 {
37 public:
38  Gps();
39  ~Gps();
40 
41  //Overridden ModelPlugin-Functions
42  virtual void Load(physics::ModelPtr _parent, sdf::ElementPtr /*_sdf*/);
43  virtual void OnUpdate(const common::UpdateInfo &);
44  virtual void Reset();
45 
46 private:
47  /// Pointer to the gazbeo model
48  physics::ModelPtr model_;
49  /// Pointer to the update event connection
50  event::ConnectionPtr update_connection_;
51  ///Node for communication to fawkes
52  transport::NodePtr node_;
53  ///name of the gps and the communication channel
54  std::string name_;
55 
56  ///time variable to send in intervals
57  double last_sent_time_;
58 
59  //Gps Stuff:
60  ///Functions for sending information to fawkes:
61  void send_position();
62 
63  ///Publisher for GyroAngle
64  transport::PublisherPtr gps_pub_;
65 };
66 } // namespace gazebo
Provides ground Truth position.
Definition: gps.h:36
virtual void Load(physics::ModelPtr _parent, sdf::ElementPtr)
on loading of the plugin
Definition: gps.cpp:46
Gps()
Constructor.
Definition: gps.cpp:33
virtual void OnUpdate(const common::UpdateInfo &)
Called by the world update start event.
Definition: gps.cpp:74
~Gps()
Destructor.
Definition: gps.cpp:37
virtual void Reset()
on Gazebo reset
Definition: gps.cpp:88