Go to the documentation of this file.
18 #ifndef GAZEBO_PLUGINS_FLASHLIGHTPLUGIN_HH_
19 #define GAZEBO_PLUGINS_FLASHLIGHTPLUGIN_HH_
24 #include <ignition/math/Color.hh>
27 #include "gazebo/physics/physics.hh"
32 class FlashLightSettingPrivate;
46 const sdf::ElementPtr &_sdf,
55 public:
virtual void InitPubLight(
62 virtual void UpdateLightInEnv(
const common::Time &_currentTime)
final;
66 public:
virtual const std::string Name()
const final;
73 public:
virtual void SwitchOn()
final;
76 public:
virtual void SwitchOff()
final;
81 public:
virtual void SetDuration(
82 const double _duration,
const int _index)
final;
86 public:
virtual void SetDuration(
const double _duration)
final;
91 public:
virtual void SetInterval(
92 const double _interval,
const int _index)
final;
96 public:
virtual void SetInterval(
const double _interval)
final;
101 public:
virtual void SetColor(
102 const ignition::math::Color &_color,
const int _index)
final;
106 public:
virtual void SetColor(
const ignition::math::Color &_color)
final;
110 public:
virtual unsigned int BlockCount()
final;
115 public:
virtual bool RemoveBlock(
const int _index)
final;
124 public:
virtual void InsertBlock(
125 const double _duration,
const double _interval,
126 const ignition::math::Color &_color,
const int _index)
final;
131 protected:
virtual void Flash();
136 protected:
virtual void Dim();
142 protected:
virtual ignition::math::Color CurrentColor()
final;
145 private: std::unique_ptr<FlashLightSettingPrivate> dataPtr;
150 class FlashLightPluginPrivate;
241 protected:
virtual void OnUpdate();
248 protected:
virtual bool TurnOn(
const std::string &_lightName)
final;
254 protected:
virtual bool TurnOn(
255 const std::string &_lightName,
const std::string &_linkName)
final;
259 protected:
virtual bool TurnOnAll()
final;
266 protected:
virtual bool TurnOff(
const std::string &_lightName)
final;
272 protected:
virtual bool TurnOff(
273 const std::string &_lightName,
const std::string &_linkName)
final;
277 protected:
virtual bool TurnOffAll()
final;
286 protected:
virtual bool ChangeDuration(
287 const std::string &_lightName,
const std::string &_linkName,
288 const double _duration,
const int _index)
final;
295 protected:
virtual bool ChangeDuration(
296 const std::string &_lightName,
const std::string &_linkName,
297 const double _duration)
final;
306 protected:
virtual bool ChangeInterval(
307 const std::string &_lightName,
const std::string &_linkName,
308 const double _interval,
const int _index)
final;
315 protected:
virtual bool ChangeInterval(
316 const std::string &_lightName,
const std::string &_linkName,
317 const double _interval)
final;
326 protected:
virtual bool ChangeColor(
327 const std::string &_lightName,
const std::string &_linkName,
328 const ignition::math::Color &_color,
const int _index)
final;
335 protected:
virtual bool ChangeColor(
336 const std::string &_lightName,
const std::string &_linkName,
337 const ignition::math::Color &_color)
final;
350 protected:
virtual std::shared_ptr<FlashLightSetting> CreateSetting(
351 const sdf::ElementPtr &_sdf,
365 virtual void InitSettingBySpecificData(
366 std::shared_ptr<FlashLightSetting> &_setting);
369 private: std::unique_ptr<FlashLightPluginPrivate> dataPtr;
virtual void OnUpdate()
Called by the world update start event.
virtual std::shared_ptr< FlashLightSetting > CreateSetting(const sdf::ElementPtr &_sdf, const physics::ModelPtr &_model, const common::Time &_currentTime)
Create an object of setting.
virtual ignition::math::Color CurrentColor() final
Get the current color of the light.
virtual bool TurnOn(const std::string &_lightName) final
Turn on a flash light specified by the light name If more than one link have lights with the identica...
Forward declarations for the common classes.
Definition: Animation.hh:26
FlashLightSetting(const sdf::ElementPtr &_sdf, const physics::ModelPtr &_model, const common::Time &_currentTime)
Constructor.
A Time class, can be used to hold wall- or sim-time. stored as sec and nano-sec.
Definition: Time.hh:47
boost::shared_ptr< Model > ModelPtr
Definition: PhysicsTypes.hh:93
virtual bool ChangeColor(const std::string &_lightName, const std::string &_linkName, const ignition::math::Color &_color, const int _index) final
Change the color of a specific block of the flashlight.
virtual void InitPubLight(const transport::PublisherPtr &_pubLight) final
Set the publisher and send an initial light command.
boost::shared_ptr< Publisher > PublisherPtr
Definition: TransportTypes.hh:49
virtual void SwitchOff() final
Switch off (disable the flashlight).
FlashLightPlugin()
Constructor.
virtual void SwitchOn() final
Switch on (enable the flashlight).
A plugin that blinks a light component in the model.
Definition: FlashLightPlugin.hh:229
virtual void Dim()
Dim the light This function is internally used to update the light in the environment.
virtual ~FlashLightPlugin()
Destructor.
virtual void UpdateLightInEnv(const common::Time &_currentTime) final
Update the light based on the given time.
Internal data class to hold individual flash light settings.
Definition: FlashLightPlugin.hh:38
virtual ~FlashLightSetting()
Destructor.
virtual bool ChangeInterval(const std::string &_lightName, const std::string &_linkName, const double _interval, const int _index) final
Change the interval of a specific block of the flashlight.
void Load(physics::ModelPtr _parent, sdf::ElementPtr _sdf) override
Load function.
virtual bool ChangeDuration(const std::string &_lightName, const std::string &_linkName, const double _duration, const int _index) final
Change the duration of a specific block of the flashlight.
virtual bool TurnOnAll() final
Turn on all flash lights.
virtual bool TurnOffAll() final
Turn off all flash lights.
virtual const std::string Name() const final
Getter of name.
virtual void InitSettingBySpecificData(std::shared_ptr< FlashLightSetting > &_setting)
Initialize the additional part of an object of setting.
virtual void InsertBlock(const double _duration, const double _interval, const ignition::math::Color &_color, const int _index) final
Insert a block.
boost::shared_ptr< Link > LinkPtr
Definition: PhysicsTypes.hh:109
virtual bool TurnOff(const std::string &_lightName) final
Turn off a flash light specified by the name If more than one link have lights with the identical nam...
virtual void SetDuration(const double _duration, const int _index) final
Set the duration time for the specified block.
virtual unsigned int BlockCount() final
Get the number of blocks.
virtual void SetColor(const ignition::math::Color &_color, const int _index) final
Set the color for the specified block.
A plugin with access to physics::Model.
Definition: Plugin.hh:303
virtual const physics::LinkPtr Link() const final
Getter of link.
virtual bool RemoveBlock(const int _index) final
Remove a specified block.
virtual void SetInterval(const double _interval, const int _index) final
Set the interval time for the specified block.
virtual void Flash()
Flash the light This function is internally used to update the light in the environment.