18 #ifndef GAZEBO_PHYSICS_MODELSTATE_HH_
19 #define GAZEBO_PHYSICS_MODELSTATE_HH_
23 #include <boost/regex.hpp>
25 #include <ignition/math/Pose3.hh>
26 #include <ignition/math/Vector3.hh>
63 const common::Time &_simTime,
const uint64_t _iterations);
76 public:
explicit ModelState(
const sdf::ElementPtr _sdf);
90 const common::Time &_simTime,
const uint64_t _iterations);
96 public:
virtual void Load(
const sdf::ElementPtr _elem);
105 public:
const ignition::math::Pose3d &Pose()
const;
109 public:
const ignition::math::Vector3d &Scale()
const;
113 public:
bool IsZero()
const;
119 public:
unsigned int GetLinkStateCount()
const;
125 public:
LinkState_M GetLinkStates(
const boost::regex &_regex)
const;
131 public:
JointState_M GetJointStates(
const boost::regex &_regex)
const;
140 public:
LinkState GetLinkState(
const std::string &_linkName)
const;
145 public:
bool HasLinkState(
const std::string &_linkName)
const;
155 public:
unsigned int GetJointStateCount()
const;
164 public:
JointState GetJointState(
unsigned int _index)
const;
173 public:
JointState GetJointState(
const std::string &_jointName)
const;
182 public:
bool HasJointState(
const std::string &_jointName)
const;
188 public:
unsigned int NestedModelStateCount()
const;
197 public:
ModelState NestedModelState(
const std::string &_modelName)
const;
202 public:
bool HasNestedModelState(
const std::string &_modelName)
const;
210 public:
void FillSDF(sdf::ElementPtr _sdf);
215 public:
virtual void SetWallTime(
const common::Time &_time);
219 public:
virtual void SetRealTime(
const common::Time &_time);
223 public:
virtual void SetSimTime(
const common::Time &_time);
228 public:
virtual void SetIterations(
const uint64_t _iterations);
249 public:
inline friend std::ostream &
operator<<(std::ostream &_out,
252 ignition::math::Vector3d euler(_state.pose.Rot().Euler());
253 _out.unsetf(std::ios_base::floatfield);
254 _out << std::setprecision(3)
255 <<
"<model name='" << _state.
GetName() <<
"'>"
257 << ignition::math::precision(_state.pose.Pos().X(), 4) <<
" "
258 << ignition::math::precision(_state.pose.Pos().Y(), 4) <<
" "
259 << ignition::math::precision(_state.pose.Pos().Z(), 4) <<
" "
260 << ignition::math::precision(euler.X(), 4) <<
" "
261 << ignition::math::precision(euler.Y(), 4) <<
" "
262 << ignition::math::precision(euler.Z(), 4) <<
" "
266 if (_state.scale != ignition::math::Vector3d::One)
267 _out <<
"<scale>" << _state.scale <<
"</scale>";
269 for (LinkState_M::const_iterator iter =
270 _state.linkStates.begin(); iter != _state.linkStates.end();
273 _out << iter->second;
276 for (
const auto &ms : _state.modelStates)
295 private: ignition::math::Pose3d pose;
298 private: ignition::math::Vector3d scale;
std::map< std::string, ModelState > ModelState_M
Definition: PhysicsTypes.hh:233
std::string GetName() const
Get the name associated with this State.
Encapsulates a position and rotation in three space.
Definition: Pose.hh:42
std::map< std::string, JointState > JointState_M
Definition: PhysicsTypes.hh:245
State of an entity.
Definition: State.hh:49
keeps track of state of a physics::Joint
Definition: JointState.hh:43
#define GAZEBO_DEPRECATED(version)
Definition: system.hh:302
friend std::ostream & operator<<(std::ostream &_out, const gazebo::physics::ModelState &_state)
Stream insertion operator.
Definition: ModelState.hh:249
boost::shared_ptr< Model > ModelPtr
Definition: PhysicsTypes.hh:93
std::map< std::string, LinkState > LinkState_M
Definition: PhysicsTypes.hh:241
Store state information of a physics::Model object.
Definition: ModelState.hh:49
Store state information of a physics::Link object.
Definition: LinkState.hh:47
A Time class, can be used to hold wall- or sim-time.
Definition: Time.hh:44