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,
66 public:
virtual const std::string
Name() const final;
70 public: virtual const physics::LinkPtr Link() 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;
248 protected:
virtual bool TurnOn(
const std::string &_lightName)
final;
255 const std::string &_lightName,
const std::string &_linkName)
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;
351 const sdf::ElementPtr &_sdf,
352 const physics::ModelPtr &_model,
353 const
common::Time &_currentTime);
365 virtual
void InitSettingBySpecificData(
369 private:
std::unique_ptr<FlashLightPluginPrivate> dataPtr;
common
Definition FuelModelDatabase.hh:37
A plugin that blinks a light component in the model.
Definition FlashLightPlugin.hh:230
FlashLightPlugin()
Constructor.
virtual bool TurnOn(const std::string &_lightName, const std::string &_linkName) final
Turn on a flash light specified by the name and its link.
virtual ~FlashLightPlugin()
Destructor.
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...
virtual void OnUpdate()
Called by the world update start event.
void Load(physics::ModelPtr _parent, sdf::ElementPtr _sdf) override
Load function.
virtual bool TurnOnAll() final
Turn on all flash lights.
Internal data class to hold individual flash light settings.
Definition FlashLightPlugin.hh:39
virtual ~FlashLightSetting()
Destructor.
virtual void Dim()
Dim the light This function is internally used to update the light in the environment.
FlashLightSetting(const sdf::ElementPtr &_sdf, const physics::ModelPtr &_model, const common::Time &_currentTime)
Constructor.
virtual unsigned int BlockCount() final
Get the number of blocks.
virtual void InsertBlock(const double _duration, const double _interval, const ignition::math::Color &_color, const int _index) final
Insert a block.
virtual const physics::LinkPtr Link() const final
Getter of link.
virtual void SetColor(const ignition::math::Color &_color, const int _index) final
Set the color for the specified block.
virtual void SwitchOff() final
Switch off (disable the flashlight).
virtual ignition::math::Color CurrentColor() final
Get the current color of the light.
virtual void SetInterval(const double _interval, const int _index) final
Set the interval time for the specified block.
virtual const std::string Name() const final
Getter of name.
virtual void Flash()
Flash the light This function is internally used to update the light in the environment.
virtual void SetDuration(const double _duration, const int _index) final
Set the duration time for the specified block.
virtual void SwitchOn() final
Switch on (enable the flashlight).
virtual bool RemoveBlock(const int _index) final
Remove a specified block.
virtual void UpdateLightInEnv(const common::Time &_currentTime) final
Update the light based on the given time.
virtual void InitPubLight(const transport::PublisherPtr &_pubLight) final
Set the publisher and send an initial light command.
A plugin with access to physics::Model.
Definition Plugin.hh:304
A Time class, can be used to hold wall- or sim-time.
Definition Time.hh:48
boost::shared_ptr< Model > ModelPtr
Definition PhysicsTypes.hh:93
boost::shared_ptr< Publisher > PublisherPtr
Definition TransportTypes.hh:49
Forward declarations for the common classes.
Definition Animation.hh:27