Gazebo Gazebo

API Reference

6.16.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 IGNITION_GUI_PLUGINS_PLOTTING_HH_
18 #define IGNITION_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 ignition {
36 
37 namespace gazebo {
38 
39 class PlotComponentPrivate;
40 
44 {
49  public: PlotComponent(const std::string &_type,
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 
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 ignition::gazebo::UpdateInfo &_info,
113 
117  public: void SetData(std::string _Id,
118  const ignition::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 ignition::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
Base class for a GUI System.
Definition: gz/sim/gui/GuiSystem.hh:44
uint64_t Entity
An Entity identifies a single object in simulation such as a model, link, or light....
Definition: gz/sim/Entity.hh:58
This library is part of the Gazebo project.
STL class.
The EntityComponentManager constructs, deletes, and returns components and entities....
Definition: gz/sim/EntityComponentManager.hh:66
void RegisterChart(std::string _attribute, int _chart)
Add a registered chart to the attribute.
void LoadConfig(const tinyxml2::XMLElement *) override
void SetAttributeValue(std::string _attribute, const double &_value)
Set a value of specefic component attribute.
A container of the component data that keeps track of the registered attributes and update their valu...
Definition: Plotting.hh:43
ComponentTypeId TypeId()
Get the Component type ID.
void UnRegisterChartFromComponent(uint64_t _entity, uint64_t _typeId, std::string _attribute, int _chart)
Remove a chart from a specefic component attribute.
void Update(const ignition::gazebo::UpdateInfo &_info, ignition::gazebo::EntityComponentManager &_ecm) override
Update callback called every time the system is stepped. This is called at an Ignition transport thre...
Information passed to systems on the update callback.
Definition: include/gz/sim/Types.hh:38
PlotComponent(const std::string &_type, ignition::gazebo::Entity _entity, ComponentTypeId _typeId)
Constructor.
Physics data plotting handler that keeps track of the registered components, update them and update t...
Definition: Plotting.hh:98
STL class.
ignition::gazebo::Entity Entity()
Get the Component entity ID.
void UnRegisterChart(std::string _attribute, int _chart)
Remove a registered chart from the attribute.
std::string ComponentName(const uint64_t &_typeId)
Get Component Name based on its type Id.
bool HasCharts()
Check if any of the component attributes has any chart.
void RegisterChartToComponent(uint64_t _entity, uint64_t _typeId, std::string _type, std::string _attribute, int _chart)
Add a chart to a specefic component attribute.
void SetData(std::string _Id, const ignition::math::Vector3d &_vector)
Set the Component data of given id to the given vector.
std::map< std::string, std::shared_ptr< gz::gui::PlotData > > Data() const
Get all attributes of the component.
uint64_t ComponentTypeId
A unique identifier for a component type. A component type must be derived from components::BaseCompo...
Definition: include/gz/sim/Types.hh:90
Component< sdf::Physics, class PhysicsTag, serializers::PhysicsSerializer > Physics
A component type that contains the physics properties of the World entity.
Definition: include/gz/sim/components/Physics.hh:50