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
30namespace gazebo
31{
32 namespace gui
33 {
34 // Forward declare private data class
35 class IntrospectionCurveHandlerPrivate;
36
38 class GZ_GUI_VISIBLE IntrospectionCurveHandler
39 {
42
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
gui
Definition KeyEventHandler.hh:29
default namespace for gazebo
Manages and updates curves based on introspection data.
Definition IntrospectionCurveHandler.hh:39
unsigned int CurveCount() const
Get the number of curves managed by this handler.
void SetPaused(const bool _paused)
Set whether or not to pause updating the plot curves.
void RemoveCurve(PlotCurveWeakPtr _curve)
Remove a curve from the topic data hander.
void AddCurve(const std::string &_query, PlotCurveWeakPtr _curve)
Add a curve to be updated.
bool Initialized() const
Get whether or not the introspection curve handler has been initialized.
std::weak_ptr< PlotCurve > PlotCurveWeakPtr
Definition PlottingTypes.hh:41
Forward declarations for the common classes.
Definition Animation.hh:27