CollisionState.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2012 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/* Desc: A collision state
18 * Author: Nate Koenig
19 */
20
21#ifndef GAZEBO_PHYSICS_COLLISIONSTATE_HH_
22#define GAZEBO_PHYSICS_COLLISIONSTATE_HH_
23
24#include <ignition/math/Pose3.hh>
25
27#include "gazebo/util/system.hh"
28
29namespace gazebo
30{
31 namespace physics
32 {
35
43 class GZ_PHYSICS_VISIBLE CollisionState : public State
44 {
46 public: CollisionState();
47
53 public: explicit CollisionState(const CollisionPtr _collision);
54
59 public: explicit CollisionState(const sdf::ElementPtr _sdf);
60
62 public: virtual ~CollisionState();
63
68 public: virtual void Load(const sdf::ElementPtr _elem);
69
72 public: const ignition::math::Pose3d &Pose() const;
73
76 public: bool IsZero() const;
77
80 public: void FillSDF(sdf::ElementPtr _sdf);
81
85 public: CollisionState &operator=(const CollisionState &_state);
86
90 public: CollisionState operator-(const CollisionState &_state) const;
91
95 public: CollisionState operator+(const CollisionState &_state) const;
96
101 public: inline friend std::ostream &operator<<(std::ostream &_out,
103 {
104 _out << "<collision name='" << _state.name << "'>"
105 << "<pose>" << _state.pose << "</pose>";
106 _out << "</collision>";
107
108 return _out;
109 }
110
112 private: ignition::math::Pose3d pose;
113 };
115 }
116}
117#endif
Store state information of a physics::Collision object.
Definition CollisionState.hh:44
CollisionState(const sdf::ElementPtr _sdf)
Constructor.
CollisionState operator-(const CollisionState &_state) const
Subtraction operator.
virtual ~CollisionState()
Destructor.
CollisionState()
Default constructor.
const ignition::math::Pose3d & Pose() const
Get the Collision pose.
friend std::ostream & operator<<(std::ostream &_out, const gazebo::physics::CollisionState &_state)
Stream insertion operator.
Definition CollisionState.hh:101
bool IsZero() const
Return true if the values in the state are zero.
CollisionState(const CollisionPtr _collision)
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.
CollisionState operator+(const CollisionState &_state) const
Addition operator.
CollisionState & operator=(const CollisionState &_state)
Assignment operator.
State of an entity.
Definition State.hh:44
std::string name
Name associated with this State.
Definition State.hh:124
boost::shared_ptr< Collision > CollisionPtr
Definition PhysicsTypes.hh:113
Forward declarations for the common classes.
Definition Animation.hh:27