LightState.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015-2016 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_LIGHT_STATE_HH_
19 #define _GAZEBO_LIGHT_STATE_HH_
20 
21 #include <iomanip>
22 
23 #include "gazebo/physics/State.hh"
24 
25 namespace gazebo
26 {
27  namespace physics
28  {
31 
37  class GZ_PHYSICS_VISIBLE LightState : public State
38  {
40  public: LightState() = default;
41 
50  public: LightState(const LightPtr _light, const common::Time &_realTime,
51  const common::Time &_simTime, const uint64_t _iterations);
52 
57  public: explicit LightState(const sdf::ElementPtr _sdf);
58 
63  public: virtual void Load(const sdf::ElementPtr _elem);
64 
73  public: void Load(const LightPtr _light, const common::Time &_realTime,
74  const common::Time &_simTime, const uint64_t _iterations);
75 
78  public: const ignition::math::Pose3d Pose() const;
79 
82  public: bool IsZero() const;
83 
86  public: void FillSDF(sdf::ElementPtr _sdf);
87 
91  public: LightState &operator=(const LightState &_state);
92 
96  public: LightState operator-(const LightState &_state) const;
97 
101  public: LightState operator+(const LightState &_state) const;
102 
107  public: inline friend std::ostream &operator<<(std::ostream &_out,
108  const gazebo::physics::LightState &_state)
109  {
110  ignition::math::Vector3d q(_state.pose.Rot().Euler());
111  _out << std::fixed <<std::setprecision(3)
112  << "<light name='" << _state.GetName() << "'>"
113  << "<pose>"
114  << _state.pose.Pos().X() << " "
115  << _state.pose.Pos().Y() << " "
116  << _state.pose.Pos().Z() << " "
117  << q.X() << " "
118  << q.Y() << " "
119  << q.Z() << " "
120  << "</pose>";
121 
122  _out << "</light>";
123 
124  return _out;
125  }
126 
128  private: ignition::math::Pose3d pose;
129  };
130 
132  }
133 }
134 #endif
135 
std::string GetName() const
Get the name associated with this State.
State of an entity.
Definition: State.hh:49
Store state information of a Light object.
Definition: LightState.hh:37
friend std::ostream & operator<<(std::ostream &_out, const gazebo::physics::LightState &_state)
Stream insertion operator.
Definition: LightState.hh:107
boost::shared_ptr< Light > LightPtr
Definition: PhysicsTypes.hh:105
A Time class, can be used to hold wall- or sim-time.
Definition: Time.hh:44