Gazebo Sim

API Reference

7.9.0
Plotting.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 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 GZ_GUI_PLUGINS_PLOTTING_HH_
18 #define GZ_GUI_PLUGINS_PLOTTING_HH_
19 
20 #include <gz/gui/qt.h>
21 #include <gz/gui/Application.hh>
22 #include <gz/gui/PlottingInterface.hh>
23 #include <gz/sim/gui/GuiSystem.hh>
24 #include <gz/math/Vector3.hh>
25 #include <gz/math/Pose3.hh>
26 #include <gz/math/SphericalCoordinates.hh>
27 #include <gz/msgs/light.pb.h>
28 
29 #include "sdf/Physics.hh"
30 
31 #include <map>
32 #include <string>
33 #include <memory>
34 
35 namespace gz {
36 
37 namespace sim {
38 
39 class PlotComponentPrivate;
40 
44 {
49  public: PlotComponent(const std::string &_type,
50  gz::sim::Entity _entity,
51  ComponentTypeId _typeId);
52 
54  public: ~PlotComponent();
55 
59  public: void RegisterChart(std::string _attribute, int _chart);
60 
64  public: void UnRegisterChart(std::string _attribute, int _chart);
65 
69  public: bool HasCharts();
70 
75  public: void SetAttributeValue(std::string _attribute, const double &_value);
76 
80  Data() const;
81 
84  public: gz::sim::Entity Entity();
85 
88  public: ComponentTypeId TypeId();
89 
92 };
93 
94 class PlottingPrivate;
95 
99 {
100  Q_OBJECT
102  public: Plotting();
103 
105  public: ~Plotting();
106 
107  // Documentation inherited
108  public: void LoadConfig(const tinyxml2::XMLElement *) override;
109 
110  // Documentation inherited
111  public: void Update(const gz::sim::UpdateInfo &_info,
112  gz::sim::EntityComponentManager &_ecm) override;
113 
117  public: void SetData(std::string _Id,
118  const gz::math::Vector3d &_vector);
119 
123  public: void SetData(std::string _Id,
124  const msgs::Light &_light);
125 
129  public: void SetData(std::string _Id,
130  const gz::math::Pose3d &_pose);
131 
136  public: void SetData(std::string _Id, const math::SphericalCoordinates &_sc);
137 
142  public: void SetData(std::string _Id, const sdf::Physics &_physics);
143 
148  public: void SetData(std::string _Id, const double &_value);
149 
157  public slots: void RegisterChartToComponent(uint64_t _entity,
158  uint64_t _typeId,
159  std::string _type,
160  std::string _attribute,
161  int _chart);
162 
169  public slots: void UnRegisterChartFromComponent(uint64_t _entity,
170  uint64_t _typeId,
171  std::string _attribute,
172  int _chart);
173 
177  public slots: std::string ComponentName(const uint64_t &_typeId);
178 
180  private: std::unique_ptr<PlottingPrivate> dataPtr;
181 };
182 }
183 }
184 
185 #endif