##

LightState.hh
Go to the documentation of this file.
/*
* Copyright (C) 2015 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GAZEBO_PHYSICS_LIGHTSTATE_HH_
#define GAZEBO_PHYSICS_LIGHTSTATE_HH_
#include <iomanip>
#include <ignition/math/Pose3.hh>
#include "gazebo/physics/State.hh"
namespace gazebo
{
namespace physics
{
class GZ_PHYSICS_VISIBLE LightState : public State
{
public: LightState() = default;
public: LightState(const LightPtr _light, const common::Time &_realTime,
const common::Time &_simTime, const uint64_t _iterations);
public: explicit LightState(const sdf::ElementPtr _sdf);
public: virtual void Load(const sdf::ElementPtr _elem);
public: void Load(const LightPtr _light, const common::Time &_realTime,
const common::Time &_simTime, const uint64_t _iterations);
public: const ignition::math::Pose3d Pose() const;
public: bool IsZero() const;
public: void FillSDF(sdf::ElementPtr _sdf);
public: LightState &operator=(const LightState &_state);
public: LightState operator-(const LightState &_state) const;
public: LightState operator+(const LightState &_state) const;
public: inline friend std::ostream &operator<<(std::ostream &_out,
const gazebo::physics::LightState &_state)
{
ignition::math::Vector3d q(_state.pose.Rot().Euler());
_out << std::fixed <<std::setprecision(3)
<< "<light name='" << _state.GetName() << "'>"
<< "<pose>"
<< _state.pose.Pos().X() << " "
<< _state.pose.Pos().Y() << " "
<< _state.pose.Pos().Z() << " "
<< q.X() << " "
<< q.Y() << " "
<< q.Z() << " "
<< "</pose>";
_out << "</light>";
return _out;
}
private: ignition::math::Pose3d pose;
};
}
}
#endif
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
gazebo::common::Time
A Time class, can be used to hold wall- or sim-time. stored as sec and nano-sec.
Definition: Time.hh:47
gazebo::physics::LightState::Pose
const ignition::math::Pose3d Pose() const
Get the stored light pose.
gazebo::physics::LightState::operator-
LightState operator-(const LightState &_state) const
Subtraction operator.
gazebo::physics::LightState::IsZero
bool IsZero() const
Return true if the values in the state are zero.
State.hh
gazebo::physics::State::GetName
std::string GetName() const
Get the name associated with this State.
gazebo::physics::LightState::operator+
LightState operator+(const LightState &_state) const
Addition operator.
gazebo::physics::LightState::FillSDF
void FillSDF(sdf::ElementPtr _sdf)
Populate a state SDF element with data from the object.
gazebo::physics::LightState::operator<<
friend std::ostream & operator<<(std::ostream &_out, const gazebo::physics::LightState &_state)
Stream insertion operator.
Definition: LightState.hh:108
gazebo::physics::LightPtr
boost::shared_ptr< Light > LightPtr
Definition: PhysicsTypes.hh:105
gazebo::physics::LightState
Store state information of a Light object.
Definition: LightState.hh:38
gazebo::physics::LightState::Load
virtual void Load(const sdf::ElementPtr _elem)
Load state from SDF element.
gazebo::physics::State
State of an entity.
Definition: State.hh:43
gazebo::physics::LightState::operator=
LightState & operator=(const LightState &_state)
Assignment operator.
gazebo::physics::LightState::LightState
LightState()=default
Default constructor.