LightState.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 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_PHYSICS_LIGHTSTATE_HH_
19 #define GAZEBO_PHYSICS_LIGHTSTATE_HH_
20 
21 #include <iomanip>
22 #include <ignition/math/Pose3.hh>
23 
24 #include "gazebo/physics/State.hh"
25 
26 namespace gazebo
27 {
28  namespace physics
29  {
32 
38  class GZ_PHYSICS_VISIBLE LightState : public State
39  {
41  public: LightState() = default;
42 
51  public: LightState(const LightPtr _light, const common::Time &_realTime,
52  const common::Time &_simTime, const uint64_t _iterations);
53 
58  public: explicit LightState(const sdf::ElementPtr _sdf);
59 
64  public: virtual void Load(const sdf::ElementPtr _elem);
65 
74  public: void Load(const LightPtr _light, const common::Time &_realTime,
75  const common::Time &_simTime, const uint64_t _iterations);
76 
79  public: const ignition::math::Pose3d Pose() const;
80 
83  public: bool IsZero() const;
84 
87  public: void FillSDF(sdf::ElementPtr _sdf);
88 
92  public: LightState &operator=(const LightState &_state);
93 
97  public: LightState operator-(const LightState &_state) const;
98 
102  public: LightState operator+(const LightState &_state) const;
103 
108  public: inline friend std::ostream &operator<<(std::ostream &_out,
109  const gazebo::physics::LightState &_state)
110  {
111  ignition::math::Vector3d q(_state.pose.Rot().Euler());
112  _out << std::fixed <<std::setprecision(3)
113  << "<light name='" << _state.GetName() << "'>"
114  << "<pose>"
115  << _state.pose.Pos().X() << " "
116  << _state.pose.Pos().Y() << " "
117  << _state.pose.Pos().Z() << " "
118  << q.X() << " "
119  << q.Y() << " "
120  << q.Z() << " "
121  << "</pose>";
122 
123  _out << "</light>";
124 
125  return _out;
126  }
127 
129  private: ignition::math::Pose3d pose;
130  };
131 
133  }
134 }
135 #endif
136 
Forward declarations for the common classes.
Definition: Animation.hh:26
State of an entity.
Definition: State.hh:43
Store state information of a Light object.
Definition: LightState.hh:38
std::string GetName() const
Get the name associated with this State.
friend std::ostream & operator<<(std::ostream &_out, const gazebo::physics::LightState &_state)
Stream insertion operator.
Definition: LightState.hh:108
boost::shared_ptr< Light > LightPtr
Definition: PhysicsTypes.hh:106
A Time class, can be used to hold wall- or sim-time.
Definition: Time.hh:47