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;
82 const
double _duration, const
int _index) final;
86 public: virtual
void SetDuration(const
double _duration) final;
92 const
double _interval, const
int _index) final;
96 public: virtual
void SetInterval(const
double _interval) final;
102 const
ignition::math::Color &_color, const
int _index) final;
125 const
double _duration, const
double _interval,
126 const
ignition::math::Color &_color, const
int _index) final;
136 protected: virtual
void Dim();
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;
273 const
std::
string &_lightName, const
std::
string &_linkName) final;
287 const
std::
string &_lightName, const
std::
string &_linkName,
288 const
double _duration, const
int _index) final;
296 const
std::
string &_lightName, const
std::
string &_linkName,
297 const
double _duration) final;
307 const
std::
string &_lightName, const
std::
string &_linkName,
308 const
double _interval, const
int _index) final;
316 const
std::
string &_lightName, const
std::
string &_linkName,
317 const
double _interval) final;
327 const
std::
string &_lightName, const
std::
string &_linkName,
328 const
ignition::math::Color &_color, const
int _index) final;
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);
369 private:
std::unique_ptr<FlashLightPluginPrivate> dataPtr;
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 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 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 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.
virtual void OnUpdate()
Called by the world update start event.
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 std::shared_ptr< FlashLightSetting > CreateSetting(const sdf::ElementPtr &_sdf, const physics::ModelPtr &_model, const common::Time &_currentTime)
Create an object of setting.
virtual bool TurnOnAll() final
Turn on all flash lights.
virtual bool TurnOffAll() final
Turn off all flash lights.
virtual void InitSettingBySpecificData(std::shared_ptr< FlashLightSetting > &_setting)
Initialize the additional part of an object of setting.
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.
ModelPlugin()
Constructor.
Definition Plugin.hh:306
A Time class, can be used to hold wall- or sim-time.
Definition Time.hh:48
Common namespace.
Definition Animation.hh:32
namespace for physics
Definition Actor.hh:41
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