LedPlugin.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 
18 #ifndef GAZEBO_PLUGINS_LEDPLUGIN_HH_
19 #define GAZEBO_PLUGINS_LEDPLUGIN_HH_
20 
21 #include <memory>
22 
23 #include "gazebo/common/Plugin.hh"
24 #include "gazebo/physics/physics.hh"
25 
26 #include "FlashLightPlugin.hh"
27 
28 namespace gazebo
29 {
30  // forward declaration
31  class LedSettingPrivate;
32 
34  class GZ_PLUGIN_VISIBLE LedSetting: public FlashLightSetting
35  {
37  public: LedSetting(
38  const sdf::ElementPtr &_sdf,
39  const physics::ModelPtr &_model,
40  const common::Time &_currentTime);
41 
43  public: virtual ~LedSetting();
44 
47  public: virtual void InitPubVisual(
48  const transport::PublisherPtr &_pubVisual) final;
49 
50  // Documentation inherited.
51  protected: virtual void Flash();
52 
53  // Documentation inherited.
54  protected: virtual void Dim();
55 
57  private: std::unique_ptr<LedSettingPrivate> dataPtr;
58  };
59 
60  // forward declaration
61  class LedPluginPrivate;
62 
101  class GZ_PLUGIN_VISIBLE LedPlugin : public FlashLightPlugin
102  {
104  public: LedPlugin();
105 
107  public: virtual ~LedPlugin();
108 
109  // Documentation inherited.
110  protected: virtual std::shared_ptr<FlashLightSetting> CreateSetting(
111  const sdf::ElementPtr &_sdf,
112  const physics::ModelPtr &_model,
113  const common::Time &_currentTime);
114 
115  // Documentation inherited.
116  protected: virtual void InitSettingBySpecificData(
117  std::shared_ptr<FlashLightSetting> &_setting);
118 
120  private: std::unique_ptr<LedPluginPrivate> dataPtr;
121  };
122 }
123 #endif
Forward declarations for the common classes.
Definition: Animation.hh:26
boost::shared_ptr< Publisher > PublisherPtr
Definition: TransportTypes.hh:49
Internal data class to hold individual flash light settings.
Definition: FlashLightPlugin.hh:38
A plugin that blinks light and visual elements in a model.
Definition: LedPlugin.hh:101
Internal data class to hold individual LED light settings.
Definition: LedPlugin.hh:34
boost::shared_ptr< Model > ModelPtr
Definition: PhysicsTypes.hh:94
A plugin that blinks a light component in the model.
Definition: FlashLightPlugin.hh:229
A Time class, can be used to hold wall- or sim-time.
Definition: Time.hh:47