IntrospectionCurveHandler.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 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_GUI_PLOT_INTROSPECTIONCURVEHANDLER_HH_
18 #define GAZEBO_GUI_PLOT_INTROSPECTIONCURVEHANDLER_HH_
19 
20 #include <memory>
21 #include <string>
22 
23 #include <ignition/math/Vector3.hh>
24 #include <ignition/math/Quaternion.hh>
25 
26 #include "gazebo/msgs/msgs.hh"
28 #include "gazebo/util/system.hh"
29 
30 namespace gazebo
31 {
32  namespace gui
33  {
34  // Forward declare private data class
35  class IntrospectionCurveHandlerPrivate;
36 
38  class GZ_GUI_VISIBLE IntrospectionCurveHandler
39  {
41  public: IntrospectionCurveHandler();
42 
44  public: ~IntrospectionCurveHandler();
45 
50  public: void AddCurve(const std::string &_query, PlotCurveWeakPtr _curve);
51 
54  public: void RemoveCurve(PlotCurveWeakPtr _curve);
55 
58  public: unsigned int CurveCount() const;
59 
62  public: void SetPaused(const bool _paused);
63 
67  public: bool Initialized() const;
68 
70  private: void SetupIntrospection();
71 
74  private: void OnIntrospection(const gazebo::msgs::Param_V &_msg);
75 
82  private: bool Vector3dFromQuery(const std::string &_query,
83  const ignition::math::Vector3d &_vec, double &_value) const;
84 
91  private: bool QuaterniondFromQuery(const std::string &_query,
92  const ignition::math::Quaterniond &_quat, double &_value) const;
93 
98  private: void AddItemToFilter(const std::string &_name,
99  const std::function<void(const bool _result)> &_cb = nullptr);
100 
105  private: void RemoveItemFromFilter(const std::string &_name,
106  const std::function<void(const bool _result)> &_cb = nullptr);
107 
109  private: std::unique_ptr<IntrospectionCurveHandlerPrivate> dataPtr;
110  };
111  }
112 }
113 #endif
std::vector< common::Param * > Param_V
Definition: CommonTypes.hh:97
Manages and updates curves based on introspection data.
Definition: IntrospectionCurveHandler.hh:38
std::weak_ptr< PlotCurve > PlotCurveWeakPtr
Definition: PlottingTypes.hh:41
default namespace for gazebo