ParticleEmitter.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2021 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 SDF_PARTICLE_EMITTER_HH_
18 #define SDF_PARTICLE_EMITTER_HH_
19 
20 #include <string>
21 
22 #include <ignition/math/Pose3.hh>
23 #include <ignition/math/Vector3.hh>
24 #include "sdf/Material.hh"
25 #include "sdf/SemanticPose.hh"
26 #include "sdf/Types.hh"
27 #include "sdf/sdf_config.h"
28 #include "sdf/system_util.hh"
29 
30 namespace sdf
31 {
32  // Inline bracket to help doxygen filtering.
33  inline namespace SDF_VERSION_NAMESPACE {
34  // Forward declarations.
35  struct PoseRelativeToGraph;
36 
39  // Developer note: Make sure to update emitterTypeStrs in the source
40  // file when changing this enum.
42  {
44  POINT = 0,
45 
47  BOX = 1,
48 
50  CYLINDER = 2,
51 
53  ELLIPSOID = 3,
54  };
55 
60  {
62  public: ParticleEmitter();
63 
70  public: Errors Load(ElementPtr _sdf);
71 
76  public: std::string Name() const;
77 
82  public: void SetName(const std::string &_name);
83 
88  public: ParticleEmitterType Type() const;
89 
92  public: void SetType(const ParticleEmitterType _type);
93 
100  public: bool SetType(const std::string &_typeStr);
101 
104  public: std::string TypeStr() const;
105 
109  public: bool Emitting() const;
110 
114  public: void SetEmitting(bool _emitting);
115 
119  public: double Duration() const;
120 
124  public: void SetDuration(double _duration);
125 
129  public: double Lifetime() const;
130 
135  public: void SetLifetime(double _duration);
136 
139  public: double Rate() const;
140 
144  public: void SetRate(double _rate);
145 
149  public: double ScaleRate() const;
150 
155  public: void SetScaleRate(double _scaleRate);
156 
159  public: double MinVelocity() const;
160 
164  public: void SetMinVelocity(double _vel);
165 
168  public: double MaxVelocity() const;
169 
173  public: void SetMaxVelocity(double _vel);
174 
176  // Default value is (1, 1, 1).
177  // Note that the interpretation of the emitter area varies
178  // depending on the emmiter type:
179  // - point: The area is ignored.
180  // - box: The area is interpreted as width X height X depth.
181  // - cylinder: The area is interpreted as the bounding box of the
182  // cylinder. The cylinder is oriented along the Z-axis.
183  // - ellipsoid: The area is interpreted as the bounding box of an
184  // ellipsoid shaped area, i.e. a sphere or
185  // squashed-sphere area. The parameters are again
186  // identical to EM_BOX, except that the dimensions
187  // describe the widest points along each of the axes.
189  public: ignition::math::Vector3d Size() const;
190 
196  public: void SetSize(const ignition::math::Vector3d &_size);
197 
200  public: ignition::math::Vector3d ParticleSize() const;
201 
206  public: void SetParticleSize(const ignition::math::Vector3d &_size);
207 
214  public: ignition::math::Color ColorStart() const;
215 
219  public: void SetColorStart(const ignition::math::Color &_colorStart);
220 
227  public: ignition::math::Color ColorEnd() const;
228 
232  public: void SetColorEnd(const ignition::math::Color &_colorEnd);
233 
242  public: std::string ColorRangeImage() const;
243 
247  public: void SetColorRangeImage(const std::string &_image);
248 
251  public: std::string Topic() const;
252 
255  public: void SetTopic(const std::string &_topic);
256 
261  public: float ScatterRatio() const;
262 
266  public: void SetScatterRatio(float _ratio);
267 
272  public: const ignition::math::Pose3d &RawPose() const;
273 
277  public: void SetRawPose(const ignition::math::Pose3d &_pose);
278 
283  public: const std::string &PoseRelativeTo() const;
284 
289  public: void SetPoseRelativeTo(const std::string &_frame);
290 
293  public: sdf::SemanticPose SemanticPose() const;
294 
298  public: sdf::ElementPtr Element() const;
299 
304  public: const sdf::Material *Material() const;
305 
308  public: void SetMaterial(const sdf::Material &_material);
309 
312  public: const std::string &FilePath() const;
313 
316  public: void SetFilePath(const std::string &_filePath);
317 
322  private: void SetXmlParentName(const std::string &_xmlParentName);
323 
328  private: void SetPoseRelativeToGraph(
330 
334  friend class Link;
335 
337  IGN_UTILS_IMPL_PTR(dataPtr)
338  };
339  }
340 }
341 #endif
Material.hh
sdf::v11::ScopedGraph
Definition: Collision.hh:39
sdf::v11::GeometryType::CYLINDER
@ CYLINDER
A cylinder geometry.
sdf::v11::ElementPtr
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:53
sdf::v11::SemanticPose
SemanticPose is a data structure that can be used by different DOM objects to resolve poses on a Pose...
Definition: SemanticPose.hh:54
sdf::v11::GeometryType::BOX
@ BOX
A box geometry.
sdf
namespace for Simulation Description Format parser
Definition: Actor.hh:33
sdf::v11::Material
This class contains visual material properties.
Definition: Material.hh:45
Types.hh
SemanticPose.hh
sdf::v11::ParticleEmitterType
ParticleEmitterType
Definition: ParticleEmitter.hh:41
sdf::v11::GeometryType::ELLIPSOID
@ ELLIPSOID
An ellipsoid geometry.
SDFORMAT_VISIBLE
#define SDFORMAT_VISIBLE
Definition: system_util.hh:41
sdf::v11::ParticleEmitter
A description of a particle emitter, which can be attached to a link.
Definition: ParticleEmitter.hh:59
system_util.hh
sdf::v11::Element
class SDFORMAT_VISIBLE Element
Definition: Element.hh:49
sdf::v11::LightType::POINT
@ POINT
A point light source.
sdf::v11::Errors
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:106