SMACC2
|
#include <FlashLightPlugin.hh>
Public Member Functions | |
FlashLightPlugin () | |
Constructor. More... | |
virtual | ~FlashLightPlugin () |
Destructor. More... | |
void | Load (gazebo::physics::ModelPtr _parent, sdf::ElementPtr _sdf) override |
Protected Member Functions | |
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< FlashLightPluginPrivate > | dataPtr |
Pointer to private data. More... | |
rclcpp::Subscription< std_msgs::msg::Int8 >::SharedPtr | cmdledsubscription |
Definition at line 164 of file FlashLightPlugin.hh.
smacc2::FlashLightPlugin::FlashLightPlugin | ( | ) |
Constructor.
Definition at line 597 of file FlashLightPlugin.cc.
References dataPtr.
|
virtual |
|
finalprotectedvirtual |
Change the color of all the blocks of the flashlight.
[in] | _lightName | The name of flash light |
[in] | _linkName | The name of the link holding the light |
[in] | _color | The new color to set |
Definition at line 918 of file FlashLightPlugin.cc.
References ChangeColor().
|
finalprotectedvirtual |
Change the color of a specific block of the flashlight. If the index is a negative number, it updates all the blocks.
[in] | _lightName | The name of flash light |
[in] | _linkName | The name of the link holding the light |
[in] | _color | The new color to set |
[in] | _index | The index to the block to update |
Definition at line 892 of file FlashLightPlugin.cc.
References dataPtr.
Referenced by ChangeColor().
|
finalprotectedvirtual |
Change the duration of all the blocks of the flashlight.
[in] | _lightName | The name of flash light |
[in] | _linkName | The name of the link holding the light |
[in] | _duration | The new duration time to set |
Definition at line 848 of file FlashLightPlugin.cc.
References ChangeDuration().
|
finalprotectedvirtual |
Change the duration of a specific block of the flashlight. If the index is a negative number, it updates all the blocks.
[in] | _lightName | The name of flash light |
[in] | _linkName | The name of the link holding the light |
[in] | _duration | The new duration time to set |
[in] | _index | The index to the block to update |
Definition at line 822 of file FlashLightPlugin.cc.
References dataPtr.
Referenced by ChangeDuration().
|
finalprotectedvirtual |
Change the interval of all the blocks of the flashlight.
[in] | _lightName | The name of flash light |
[in] | _linkName | The name of the link holding the light |
[in] | _interval | The new interval time to set |
Definition at line 883 of file FlashLightPlugin.cc.
References ChangeInterval().
|
finalprotectedvirtual |
Change the interval of a specific block of the flashlight. If the index is a negative number, it updates all the blocks.
[in] | _lightName | The name of flash light |
[in] | _linkName | The name of the link holding the light |
[in] | _interval | The new interval time to set |
[in] | _index | The index to the block to update |
Definition at line 857 of file FlashLightPlugin.cc.
References dataPtr.
Referenced by ChangeInterval().
|
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 in smacc2::LedPlugin.
Definition at line 928 of file FlashLightPlugin.cc.
Referenced by Load().
|
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 in smacc2::LedPlugin.
Definition at line 938 of file FlashLightPlugin.cc.
References dataPtr.
Referenced by smacc2::LedPlugin::InitSettingBySpecificData(), and Load().
|
override |
Definition at line 617 of file FlashLightPlugin.cc.
References cmdledsubscription, CreateSetting(), dataPtr, InitSettingBySpecificData(), OnUpdate(), TurnOff(), TurnOffAll(), TurnOn(), and TurnOnAll().
Referenced by smacc2::ControllableLed::Load().
|
protectedvirtual |
Called by the world update start event.
update the light
Definition at line 725 of file FlashLightPlugin.cc.
References dataPtr.
Referenced by Load().
|
finalprotectedvirtual |
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.
[in] | _lightName | The name of flash light |
Definition at line 778 of file FlashLightPlugin.cc.
References TurnOff().
Referenced by Load(), and TurnOff().
|
finalprotectedvirtual |
Turn off a flash light specified by the name.
[in] | _lightName | The name of flash light |
[in] | _linkName | The name of the link holding the light |
Definition at line 784 of file FlashLightPlugin.cc.
References dataPtr.
|
finalprotectedvirtual |
Turn off all flash lights.
Definition at line 802 of file FlashLightPlugin.cc.
References dataPtr.
Referenced by smacc2::ControllableLed::LightCmd(), and Load().
|
finalprotectedvirtual |
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.
[in] | _lightName | The name of flash light |
Definition at line 737 of file FlashLightPlugin.cc.
References TurnOn().
Referenced by Load(), and TurnOn().
|
finalprotectedvirtual |
Turn on a flash light specified by the name and its link.
[in] | _lightName | The name of flash light |
[in] | _linkName | The name of the link holding the light |
Definition at line 743 of file FlashLightPlugin.cc.
References dataPtr.
|
finalprotectedvirtual |
Turn on all flash lights.
Definition at line 761 of file FlashLightPlugin.cc.
References dataPtr.
Referenced by smacc2::ControllableLed::LightCmd(), and Load().
|
private |
Definition at line 307 of file FlashLightPlugin.hh.
Referenced by Load().
|
private |
Pointer to private data.
Definition at line 305 of file FlashLightPlugin.hh.
Referenced by ChangeColor(), ChangeDuration(), ChangeInterval(), FlashLightPlugin(), InitSettingBySpecificData(), Load(), OnUpdate(), TurnOff(), TurnOffAll(), TurnOn(), and TurnOnAll().