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  class ParticleEmitterPrivate;
36  struct PoseRelativeToGraph;
37 
40  // Developer note: Make sure to update emitterTypeStrs in the source
41  // file when changing this enum.
43  {
45  POINT = 0,
46 
48  BOX = 1,
49 
51  CYLINDER = 2,
52 
54  ELLIPSOID = 3,
55  };
56 
61  {
63  public: ParticleEmitter();
64 
67  public: ParticleEmitter(const ParticleEmitter &_emitter);
68 
71  public: ParticleEmitter(ParticleEmitter &&_emitter) noexcept;
72 
76  public: ParticleEmitter &operator=(ParticleEmitter &&_emitter);
77 
81  public: ParticleEmitter &operator=(const ParticleEmitter &_emitter);
82 
84  public: ~ParticleEmitter();
85 
92  public: Errors Load(ElementPtr _sdf);
93 
98  public: std::string Name() const;
99 
104  public: void SetName(const std::string &_name);
105 
110  public: ParticleEmitterType Type() const;
111 
114  public: void SetType(const ParticleEmitterType _type);
115 
122  public: bool SetType(const std::string &_typeStr);
123 
126  public: std::string TypeStr() const;
127 
131  public: bool Emitting() const;
132 
136  public: void SetEmitting(bool _emitting);
137 
141  public: double Duration() const;
142 
146  public: void SetDuration(double _duration);
147 
151  public: double Lifetime() const;
152 
157  public: void SetLifetime(double _duration);
158 
161  public: double Rate() const;
162 
166  public: void SetRate(double _rate);
167 
171  public: double ScaleRate() const;
172 
177  public: void SetScaleRate(double _scaleRate);
178 
181  public: double MinVelocity() const;
182 
186  public: void SetMinVelocity(double _vel);
187 
190  public: double MaxVelocity() const;
191 
195  public: void SetMaxVelocity(double _vel);
196 
198  // Default value is (1, 1, 1).
199  // Note that the interpretation of the emitter area varies
200  // depending on the emmiter type:
201  // - point: The area is ignored.
202  // - box: The area is interpreted as width X height X depth.
203  // - cylinder: The area is interpreted as the bounding box of the
204  // cylinder. The cylinder is oriented along the Z-axis.
205  // - ellipsoid: The area is interpreted as the bounding box of an
206  // ellipsoid shaped area, i.e. a sphere or
207  // squashed-sphere area. The parameters are again
208  // identical to EM_BOX, except that the dimensions
209  // describe the widest points along each of the axes.
211  public: ignition::math::Vector3d Size() const;
212 
218  public: void SetSize(const ignition::math::Vector3d &_size);
219 
222  public: ignition::math::Vector3d ParticleSize() const;
223 
228  public: void SetParticleSize(const ignition::math::Vector3d &_size);
229 
236  public: ignition::math::Color ColorStart() const;
237 
241  public: void SetColorStart(const ignition::math::Color &_colorStart);
242 
249  public: ignition::math::Color ColorEnd() const;
250 
254  public: void SetColorEnd(const ignition::math::Color &_colorEnd);
255 
264  public: std::string ColorRangeImage() const;
265 
269  public: void SetColorRangeImage(const std::string &_image);
270 
273  public: std::string Topic() const;
274 
277  public: void SetTopic(const std::string &_topic);
278 
283  public: const ignition::math::Pose3d &RawPose() const;
284 
288  public: void SetRawPose(const ignition::math::Pose3d &_pose);
289 
294  public: const std::string &PoseRelativeTo() const;
295 
300  public: void SetPoseRelativeTo(const std::string &_frame);
301 
304  public: sdf::SemanticPose SemanticPose() const;
305 
309  public: sdf::ElementPtr Element() const;
310 
315  public: sdf::Material *Material() const;
316 
319  public: void SetMaterial(const sdf::Material &_material);
320 
323  public: const std::string &FilePath() const;
324 
327  public: void SetFilePath(const std::string &_filePath);
328 
333  private: void SetXmlParentName(const std::string &_xmlParentName);
334 
339  private: void SetPoseRelativeToGraph(
340  std::weak_ptr<const PoseRelativeToGraph> _graph);
341 
345  friend class Link;
346 
348  private: ParticleEmitterPrivate *dataPtr = nullptr;
349  };
350  }
351 }
352 #endif
Material.hh
sdf::v10::SemanticPose
SemanticPose is a data structure that can be used by different DOM objects to resolve poses on a Pose...
Definition: SemanticPose.hh:53
sdf::v10::GeometryType::CYLINDER
@ CYLINDER
A cylinder geometry.
sdf
namespace for Simulation Description Format parser
Definition: Actor.hh:32
sdf::v10::Errors
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:95
Types.hh
SemanticPose.hh
sdf::v10::ElementPtr
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:53
sdf::v10::ParticleEmitterType
ParticleEmitterType
Definition: ParticleEmitter.hh:42
SDFORMAT_VISIBLE
#define SDFORMAT_VISIBLE
Definition: system_util.hh:48
sdf::v10::LightType::POINT
@ POINT
A point light source.
sdf::v10::ParticleEmitterType::ELLIPSOID
@ ELLIPSOID
An ellipsoid emitter.
sdf::v10::Material
This class contains visual material properties.
Definition: Material.hh:45
system_util.hh
sdf::v10::GeometryType::BOX
@ BOX
A box geometry.
sdf::v10::Element
class SDFORMAT_VISIBLE Element
Definition: Element.hh:49
sdf::v10::ParticleEmitter
A description of a particle emitter, which can be attached to a link.
Definition: ParticleEmitter.hh:60