SMACC2
|
A plugin that blinks light and visual elements in a model. In addition to the features of the base plugin, FlashLightPlugin, this plugin accesses a <visual> element to make it blink. More...
#include <LedPlugin.hh>
Public Member Functions | |
LedPlugin () | |
Constructor. More... | |
virtual | ~LedPlugin () |
Destructor. More... | |
Public Member Functions inherited from smacc2::FlashLightPlugin | |
FlashLightPlugin () | |
Constructor. More... | |
virtual | ~FlashLightPlugin () |
Destructor. More... | |
void | Load (gazebo::physics::ModelPtr _parent, sdf::ElementPtr _sdf) override |
Protected Member Functions | |
virtual std::shared_ptr< FlashLightSetting > | CreateSetting (const sdf::ElementPtr &_sdf, const gazebo::physics::ModelPtr &_model, const gazebo::common::Time &_currentTime, gazebo_ros::Node::SharedPtr node) |
Create an object of setting. More... | |
virtual void | InitSettingBySpecificData (std::shared_ptr< FlashLightSetting > &_setting) |
Initialize the additional part of an object of setting. More... | |
Protected Member Functions inherited from smacc2::FlashLightPlugin | |
virtual void | OnUpdate () |
Called by the world update start event. More... | |
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 identical name, the first appearing light in the list will be updated. More... | |
virtual bool | TurnOn (const std::string &_lightName, const std::string &_linkName) final |
Turn on a flash light specified by the name and its link. More... | |
virtual bool | TurnOnAll () final |
Turn on all flash lights. More... | |
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 name, the first appearing light in the list will be updated. More... | |
virtual bool | TurnOff (const std::string &_lightName, const std::string &_linkName) final |
Turn off a flash light specified by the name. More... | |
virtual bool | TurnOffAll () final |
Turn off all flash lights. More... | |
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. If the index is a negative number, it updates all the blocks. More... | |
virtual bool | ChangeDuration (const std::string &_lightName, const std::string &_linkName, const double _duration) final |
Change the duration of all the blocks of the flashlight. More... | |
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. If the index is a negative number, it updates all the blocks. More... | |
virtual bool | ChangeInterval (const std::string &_lightName, const std::string &_linkName, const double _interval) final |
Change the interval of all the blocks of the flashlight. More... | |
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. If the index is a negative number, it updates all the blocks. More... | |
virtual bool | ChangeColor (const std::string &_lightName, const std::string &_linkName, const ignition::math::Color &_color) final |
Change the color of all the blocks of the flashlight. More... | |
virtual std::shared_ptr< FlashLightSetting > | CreateSetting (const sdf::ElementPtr &_sdf, const gazebo::physics::ModelPtr &_model, const gazebo::common::Time &_currentTime, gazebo_ros::Node::SharedPtr node) |
Create an object of setting. More... | |
virtual void | InitSettingBySpecificData (std::shared_ptr< FlashLightSetting > &_setting) |
Initialize the additional part of an object of setting. More... | |
Private Attributes | |
std::unique_ptr< LedPluginPrivate > | dataPtr |
Pointer to private data. More... | |
A plugin that blinks light and visual elements in a model. In addition to the features of the base plugin, FlashLightPlugin, this plugin accesses a <visual> element to make it blink.
The <light> and <visual> element to control must have the identical name and specified by <light_id>, including the name of the link, which they are attached on, and their name separated by a slash "/".
Other parameters are inherited from the base plugin, FlashLightPlugin.
Example:
/// <model name='light_model'> /// ... /// <link name='light_source'> /// ... /// <light name='lamp' type='point'> /// ... /// </light> /// <visual name='lamp'> /// ... /// </visual> /// </link> /// ... /// <plugin name='light_control' filename='libLedPlugin.so'> /// <light> /// <id>light_source/lamp</id> /// <block> /// <duration>1</duration> /// <interval>1</interval> /// <color>1 0.5 0.5</color> /// </block> /// <enable>true</enable> /// </light> /// </plugin> /// </model> ///
Definition at line 106 of file LedPlugin.hh.
smacc2::LedPlugin::LedPlugin | ( | ) |
Constructor.
Definition at line 199 of file LedPlugin.cc.
References dataPtr.
|
virtual |
|
protectedvirtual |
Create an object of setting.
NOTE: This function is internally called in Load() of the base class. If a child class of FlashLightPlugin has also an inherited class of FlashLightSetting, this function must be overridden so that dataPtr deals with objects of the appropriate setting class.
[in] | _sdf | SDF data for the setting. |
[in] | _model | The Model pointer holding the light to control. |
[in] | _currentTime | The current time point. |
Reimplemented from smacc2::FlashLightPlugin.
Definition at line 219 of file LedPlugin.cc.
|
protectedvirtual |
Initialize the additional part of an object of setting.
NOTE: This function is internally called in Load() of the base class. If a child class of FlashLightPlugin has also an inherited class of FlashLightSetting, this function must be overridden so that the object can be initialized with necessary data. Also, the overridden function must call the original function in it.
[in] | _setting | A pointer to the setting object. |
Reimplemented from smacc2::FlashLightPlugin.
Definition at line 229 of file LedPlugin.cc.
References dataPtr, and smacc2::FlashLightPlugin::InitSettingBySpecificData().
|
private |
Pointer to private data.
Definition at line 126 of file LedPlugin.hh.
Referenced by InitSettingBySpecificData(), and LedPlugin().