FlashLightSetting Class Reference

Internal data class to hold individual flash light settings. More...

#include <FlashLightPlugin.hh>

Inherited by LedSetting.

Public Member Functions

 FlashLightSetting (const sdf::ElementPtr &_sdf, const physics::ModelPtr &_model, const common::Time &_currentTime)
 Constructor. More...
 
virtual ~FlashLightSetting ()
 Destructor. More...
 
virtual unsigned int BlockCount () final
 Get the number of blocks. More...
 
virtual void InitPubLight (const transport::PublisherPtr &_pubLight) final
 Set the publisher and send an initial light command. More...
 
virtual void InsertBlock (const double _duration, const double _interval, const ignition::math::Color &_color, const int _index) final
 Insert a block. More...
 
virtual const physics::LinkPtr Link () const final
 Getter of link. More...
 
virtual const std::string Name () const final
 Getter of name. More...
 
virtual bool RemoveBlock (const int _index) final
 Remove a specified block. More...
 
virtual void SetColor (const ignition::math::Color &_color, const int _index) final
 Set the color for the specified block. More...
 
virtual void SetColor (const ignition::math::Color &_color) final
 Set the color for all the blocks. More...
 
virtual void SetDuration (const double _duration, const int _index) final
 Set the duration time for the specified block. More...
 
virtual void SetDuration (const double _duration) final
 Set the duration time for all the blocks. More...
 
virtual void SetInterval (const double _interval, const int _index) final
 Set the interval time for the specified block. More...
 
virtual void SetInterval (const double _interval) final
 Set the interval time for all the blocks. More...
 
virtual void SwitchOff () final
 Switch off (disable the flashlight). More...
 
virtual void SwitchOn () final
 Switch on (enable the flashlight). More...
 
virtual void UpdateLightInEnv (const common::Time &_currentTime) final
 Update the light based on the given time. More...
 

Protected Member Functions

virtual ignition::math::Color CurrentColor () final
 Get the current color of the light. More...
 
virtual void Dim ()
 Dim the light This function is internally used to update the light in the environment. More...
 
virtual void Flash ()
 Flash the light This function is internally used to update the light in the environment. More...
 

Detailed Description

Internal data class to hold individual flash light settings.

A setting for each flash light is separately stored in a FlashLightSetting class, which takes care of dynamic specifications such as duration and interval.

Constructor & Destructor Documentation

◆ FlashLightSetting()

FlashLightSetting ( const sdf::ElementPtr &  _sdf,
const physics::ModelPtr _model,
const common::Time _currentTime 
)

Constructor.

Initialize the setting by the data given to the base plugin.

Parameters
[in]_sdfSDF data for the setting.
[in]_modelThe Model pointer holding the light to control.
[in]_currentTimeThe current time point.

◆ ~FlashLightSetting()

virtual ~FlashLightSetting ( )
virtual

Destructor.

Member Function Documentation

◆ BlockCount()

virtual unsigned int BlockCount ( )
finalvirtual

Get the number of blocks.

Returns
The number of blocks the object currently has.

◆ CurrentColor()

virtual ignition::math::Color CurrentColor ( )
finalprotectedvirtual

Get the current color of the light.

This is to be used by an inheriting class of FlashLightSetting class.

Returns
the color for the current block which the object is using. It returns Black if there is no update about color.

◆ Dim()

virtual void Dim ( )
protectedvirtual

Dim the light This function is internally used to update the light in the environment.

Reimplemented in LedSetting.

◆ Flash()

virtual void Flash ( )
protectedvirtual

Flash the light This function is internally used to update the light in the environment.

Reimplemented in LedSetting.

◆ InitPubLight()

virtual void InitPubLight ( const transport::PublisherPtr _pubLight)
finalvirtual

Set the publisher and send an initial light command.

Parameters
[in]_pubLightThe publisher to send a message

◆ InsertBlock()

virtual void InsertBlock ( const double  _duration,
const double  _interval,
const ignition::math::Color &  _color,
const int  _index 
)
finalvirtual

Insert a block.

Create a block with specified parameters. If the index is out of range, the block will be appended at the end of the list.

Parameters
[in]_durationThe duration for the block.
[in]_intervalThe interval for the block.
[in]_colorThe color for the block.
[in]_indexThe index of the block to be inserted into the list.

◆ Link()

virtual const physics::LinkPtr Link ( ) const
finalvirtual

Getter of link.

Returns
A pointer to the link element.

◆ Name()

virtual const std::string Name ( ) const
finalvirtual

Getter of name.

Returns
The name of the light element.

◆ RemoveBlock()

virtual bool RemoveBlock ( const int  _index)
finalvirtual

Remove a specified block.

Parameters
[in]_indexIndex to the block to remove
Returns
True if the block exists and it was removed.

◆ SetColor() [1/2]

virtual void SetColor ( const ignition::math::Color &  _color,
const int  _index 
)
finalvirtual

Set the color for the specified block.

Parameters
[in]_colorNew color to set.
[in]_indexThe index to the block to update.

◆ SetColor() [2/2]

virtual void SetColor ( const ignition::math::Color &  _color)
finalvirtual

Set the color for all the blocks.

Parameters
[in]_colorNew color to set.

◆ SetDuration() [1/2]

virtual void SetDuration ( const double  _duration,
const int  _index 
)
finalvirtual

Set the duration time for the specified block.

Parameters
[in]_durationNew duration time to set.
[in]_indexThe index to the block to update.

◆ SetDuration() [2/2]

virtual void SetDuration ( const double  _duration)
finalvirtual

Set the duration time for all the blocks.

Parameters
[in]_durationNew duration time to set.

◆ SetInterval() [1/2]

virtual void SetInterval ( const double  _interval,
const int  _index 
)
finalvirtual

Set the interval time for the specified block.

Parameters
[in]_intervalNew interval time to set.
[in]_indexThe index to the block to update.

◆ SetInterval() [2/2]

virtual void SetInterval ( const double  _interval)
finalvirtual

Set the interval time for all the blocks.

Parameters
[in]_intervalNew interval time to set.

◆ SwitchOff()

virtual void SwitchOff ( )
finalvirtual

Switch off (disable the flashlight).

◆ SwitchOn()

virtual void SwitchOn ( )
finalvirtual

Switch on (enable the flashlight).

◆ UpdateLightInEnv()

virtual void UpdateLightInEnv ( const common::Time _currentTime)
finalvirtual

Update the light based on the given time.

Parameters
[in]_currentTimeThe current point of time to update the lights.

The documentation for this class was generated from the following file: