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
25
26namespace 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
A Time class, can be used to hold wall- or sim-time.
Definition Time.hh:48
Store state information of a Light object.
Definition LightState.hh:39
friend std::ostream & operator<<(std::ostream &_out, const gazebo::physics::LightState &_state)
Stream insertion operator.
Definition LightState.hh:108
LightState()=default
Default constructor.
const ignition::math::Pose3d Pose() const
Get the stored light pose.
LightState operator+(const LightState &_state) const
Addition operator.
bool IsZero() const
Return true if the values in the state are zero.
LightState(const LightPtr _light, const common::Time &_realTime, const common::Time &_simTime, const uint64_t _iterations)
Constructor.
LightState operator-(const LightState &_state) const
Subtraction operator.
LightState(const sdf::ElementPtr _sdf)
Constructor.
void FillSDF(sdf::ElementPtr _sdf)
Populate a state SDF element with data from the object.
virtual void Load(const sdf::ElementPtr _elem)
Load state from SDF element.
void Load(const LightPtr _light, const common::Time &_realTime, const common::Time &_simTime, const uint64_t _iterations)
Load state from Light pointer.
LightState & operator=(const LightState &_state)
Assignment operator.
State of an entity.
Definition State.hh:44
std::string GetName() const
Get the name associated with this State.
boost::shared_ptr< Light > LightPtr
Definition PhysicsTypes.hh:105
Forward declarations for the common classes.
Definition Animation.hh:27