CessnaGUIPlugin.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 #ifndef GAZEBO_PLUGINS_CESSNAGUIPLUGIN_HH_
18 #define GAZEBO_PLUGINS_CESSNAGUIPLUGIN_HH_
19 
20 #include <mutex>
21 
22 #include <ignition/math/Angle.hh>
23 
24 #include <gazebo/common/Plugin.hh>
25 #include <gazebo/gui/GuiPlugin.hh>
26 // moc parsing error of tbb headers
27 #ifndef Q_MOC_RUN
28 #include <gazebo/transport/transport.hh>
29 #endif
30 
31 namespace gazebo
32 {
49  class GZ_PLUGIN_VISIBLE CessnaGUIPlugin : public GUIPlugin
50  {
51  Q_OBJECT
52 
54  public: CessnaGUIPlugin();
55 
57  public: virtual ~CessnaGUIPlugin();
58 
62  private: void OnState(ConstCessnaPtr &_msg);
63 
65  private slots: void OnIncreaseThrust();
66 
68  private slots: void OnDecreaseThrust();
69 
71  private slots: void OnIncreaseFlaps();
72 
74  private slots: void OnDecreaseFlaps();
75 
77  private slots: void OnIncreaseRoll();
78 
80  private slots: void OnDecreaseRoll();
81 
83  private slots: void OnIncreaseElevators();
84 
86  private slots: void OnDecreaseElevators();
87 
89  private slots: void OnIncreaseRudder();
90 
92  private slots: void OnDecreaseRudder();
93 
95  private slots: void OnPresetTakeOff();
96 
98  private slots: void OnPresetCruise();
99 
101  private slots: void OnPresetLanding();
102 
104  private: sdf::ElementPtr sdf;
105 
107  private: transport::NodePtr gzNode;
108 
110  private: transport::PublisherPtr controlPub;
111 
113  private: transport::SubscriberPtr stateSub;
114 
116  private: ignition::math::Angle angleStep;
117 
119  private: msgs::Cessna state;
120 
122  private: std::mutex mutex;
123  };
124 }
125 
126 #endif
A GUI plugin that controls the Cessna model using the keyboard.
Definition: CessnaGUIPlugin.hh:49
Forward declarations for the common classes.
Definition: Animation.hh:26
A plugin loaded within the gzclient on startup.
Definition: GuiPlugin.hh:26
boost::shared_ptr< Publisher > PublisherPtr
Definition: TransportTypes.hh:49
boost::shared_ptr< Subscriber > SubscriberPtr
Definition: TransportTypes.hh:53
boost::shared_ptr< Node > NodePtr
Definition: TransportTypes.hh:57