SMACC2
Public Member Functions | Public Attributes | List of all members
smacc2::FlashLightSettingPrivate Class Reference
Collaboration diagram for smacc2::FlashLightSettingPrivate:
Collaboration graph

Public Member Functions

 FlashLightSettingPrivate ()
 Constructor. More...
 
gazebo::physics::LinkPtr FindLinkForLight (const gazebo::physics::ModelPtr &_model, const std::string &_lightName, const std::string &_linkName)
 Find the link holding the light to control. If multiple models are nested, this function is recursively called until the link is found. More...
 

Public Attributes

std::string name
 The name of flash light. More...
 
gazebo::physics::LinkPtr link
 Link which holds this flash light. More...
 
gazebo::common::Time startTime
 The time at which the current phase started. More...
 
bool switchOn
 The current switch state (the light itself is active or not). More...
 
bool flashing
 The current flasshing state (flash or dim). More...
 
double range
 The length of the ray (in meters). More...
 
gazebo::transport::PublisherPtr pubLight
 The pointer to publisher to send a command to a light. More...
 
msgs::Light msg
 A message holding a flashlight command. More...
 
bool lightExists
 True if <light> element exists. More...
 
std::vector< std::shared_ptr< Block > > blocks
 The list of blocks of light. More...
 
int currentBlockIndex
 the index of the current block. More...
 

Detailed Description

Definition at line 52 of file FlashLightPlugin.cc.

Constructor & Destructor Documentation

◆ FlashLightSettingPrivate()

smacc2::FlashLightSettingPrivate::FlashLightSettingPrivate ( )
inline

Constructor.

Definition at line 55 of file FlashLightPlugin.cc.

56 switchOn(true), flashing(true), range(0),
58 {
59 }
bool lightExists
True if <light> element exists.
bool switchOn
The current switch state (the light itself is active or not).
double range
The length of the ray (in meters).
int currentBlockIndex
the index of the current block.
bool flashing
The current flasshing state (flash or dim).

Member Function Documentation

◆ FindLinkForLight()

gazebo::physics::LinkPtr smacc2::FlashLightSettingPrivate::FindLinkForLight ( const gazebo::physics::ModelPtr &  _model,
const std::string &  _lightName,
const std::string &  _linkName 
)
inline

Find the link holding the light to control. If multiple models are nested, this function is recursively called until the link is found.

Parameters
[in]_modelA model to check.
[in]_lightNamethe name of the light.
[in]_linkNamethe name of the link.
Returns
A pointer to the link. If not found, nullptr is returned.

Definition at line 68 of file FlashLightPlugin.cc.

68 : gazebo::physics::LinkPtr FindLinkForLight(
69 const gazebo::physics::ModelPtr &_model,
70 const std::string &_lightName, const std::string &_linkName)
71 {
72 auto childLink = _model->GetChildLink(_linkName);
73 if (childLink && childLink->GetSDF()->HasElement("light"))
74 {
75 auto sdfLight = childLink->GetSDF()->GetElement("light");
76 while (sdfLight)
77 {
78 if (sdfLight->Get<std::string>("name") == _lightName)
79 {
80 return childLink;
81 }
82 sdfLight = sdfLight->GetNextElement("light");
83 }
84 }
85 for (auto model: _model->NestedModels())
86 {
87 auto foundLink = this->FindLinkForLight(model, _lightName, _linkName);
88 if (foundLink)
89 {
90 return foundLink;
91 }
92 }
93
94 return nullptr;
95 }
gazebo::physics::LinkPtr FindLinkForLight(const gazebo::physics::ModelPtr &_model, const std::string &_lightName, const std::string &_linkName)
Find the link holding the light to control. If multiple models are nested, this function is recursive...

References FindLinkForLight().

Referenced by FindLinkForLight().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ blocks

std::vector< std::shared_ptr<Block> > smacc2::FlashLightSettingPrivate::blocks

The list of blocks of light.

Definition at line 125 of file FlashLightPlugin.cc.

◆ currentBlockIndex

int smacc2::FlashLightSettingPrivate::currentBlockIndex

the index of the current block.

Definition at line 128 of file FlashLightPlugin.cc.

◆ flashing

bool smacc2::FlashLightSettingPrivate::flashing

The current flasshing state (flash or dim).

Definition at line 110 of file FlashLightPlugin.cc.

◆ lightExists

bool smacc2::FlashLightSettingPrivate::lightExists

True if <light> element exists.

Definition at line 122 of file FlashLightPlugin.cc.

◆ link

gazebo::physics::LinkPtr smacc2::FlashLightSettingPrivate::link

Link which holds this flash light.

Definition at line 101 of file FlashLightPlugin.cc.

◆ msg

msgs::Light smacc2::FlashLightSettingPrivate::msg

A message holding a flashlight command.

Definition at line 119 of file FlashLightPlugin.cc.

◆ name

std::string smacc2::FlashLightSettingPrivate::name

The name of flash light.

Definition at line 98 of file FlashLightPlugin.cc.

◆ pubLight

gazebo::transport::PublisherPtr smacc2::FlashLightSettingPrivate::pubLight

The pointer to publisher to send a command to a light.

Definition at line 116 of file FlashLightPlugin.cc.

◆ range

double smacc2::FlashLightSettingPrivate::range

The length of the ray (in meters).

Definition at line 113 of file FlashLightPlugin.cc.

◆ startTime

gazebo::common::Time smacc2::FlashLightSettingPrivate::startTime

The time at which the current phase started.

Definition at line 104 of file FlashLightPlugin.cc.

◆ switchOn

bool smacc2::FlashLightSettingPrivate::switchOn

The current switch state (the light itself is active or not).

Definition at line 107 of file FlashLightPlugin.cc.


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