##

Collision.hh
Go to the documentation of this file.
/*
* Copyright (C) 2012 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_COLLISION_HH_
#define GAZEBO_PHYSICS_COLLISION_HH_
#include <string>
#include <vector>
#include "gazebo/common/Event.hh"
#include "gazebo/physics/PhysicsTypes.hh"
#include "gazebo/physics/CollisionState.hh"
#include "gazebo/physics/Entity.hh"
#include "gazebo/util/system.hh"
namespace gazebo
{
namespace physics
{
class GZ_PHYSICS_VISIBLE Collision : public Entity
{
public: explicit Collision(LinkPtr _link);
public: virtual ~Collision();
public: virtual void Fini();
public: virtual void Load(sdf::ElementPtr _sdf);
public: virtual void Init();
public: virtual void UpdateParameters(sdf::ElementPtr _sdf);
public: void SetCollision(bool _placeable);
public: void SetPlaceable(const bool _placeable);
public: bool IsPlaceable() const;
public: virtual void SetCategoryBits(unsigned int _bits) = 0;
public: virtual void SetCollideBits(unsigned int _bits) = 0;
public: void SetLaserRetro(float _retro);
public: float GetLaserRetro() const;
public: LinkPtr GetLink() const;
public: ModelPtr GetModel() const;
public: virtual ignition::math::Box BoundingBox() const = 0;
public: unsigned int GetShapeType() const;
public: void SetShape(ShapePtr _shape);
public: ShapePtr GetShape() const;
public: void SetScale(const ignition::math::Vector3d &_scale);
public: virtual ignition::math::Vector3d RelativeLinearVel() const;
public: virtual ignition::math::Vector3d WorldLinearVel() const;
public: virtual ignition::math::Vector3d RelativeAngularVel() const;
public: virtual ignition::math::Vector3d WorldAngularVel() const;
public: virtual ignition::math::Vector3d RelativeLinearAccel() const;
public: virtual ignition::math::Vector3d WorldLinearAccel() const;
public: virtual ignition::math::Vector3d RelativeAngularAccel() const;
public: virtual ignition::math::Vector3d WorldAngularAccel() const;
public: CollisionState GetState();
public: void SetState(const CollisionState &_state);
public: void FillMsg(msgs::Collision &_msg);
public: void ProcessMsg(const msgs::Collision &_msg);
public: inline SurfaceParamsPtr GetSurface() const
{return this->surface;}
public: virtual void SetMaxContacts(unsigned int _maxContacts);
public: virtual unsigned int GetMaxContacts();
public: void SetWorldPoseDirty();
// Documentation inherited.
public: virtual const ignition::math::Pose3d &WorldPose() const;
private: msgs::Visual CreateCollisionVisual();
protected: LinkPtr link;
protected: bool placeable;
protected: ShapePtr shape;
protected: SurfaceParamsPtr surface;
private: float laserRetro = 0.0;
private: CollisionState state;
private: unsigned int maxContacts;
private: uint32_t collisionVisualId;
private: mutable bool worldPoseDirty;
};
}
}
#endif
gazebo::physics::Collision::GetMaxContacts
virtual unsigned int GetMaxContacts()
returns number of contacts allowed for this collision.
gazebo::physics::Collision::SetCollision
void SetCollision(bool _placeable)
Set the encapsulated collision object.
gazebo::physics::Collision::GetLink
LinkPtr GetLink() const
Get the link this collision belongs to.
gazebo::physics::Collision::SetShape
void SetShape(ShapePtr _shape)
Set the shape for this collision.
gazebo::physics::Collision::GetShape
ShapePtr GetShape() const
Get the collision shape.
gazebo::physics::Collision
Base class for all collision entities.
Definition: Collision.hh:38
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
CollisionState.hh
gazebo::physics::Collision::Init
virtual void Init()
Initialize the collision.
gazebo::physics::Collision::WorldAngularAccel
virtual ignition::math::Vector3d WorldAngularAccel() const
Get the angular acceleration of the collision in the world frame.
gazebo::physics::Collision::GetState
CollisionState GetState()
Get the collision state.
gazebo::physics::ModelPtr
boost::shared_ptr< Model > ModelPtr
Definition: PhysicsTypes.hh:93
gazebo::physics::Collision::surface
SurfaceParamsPtr surface
The surface parameters.
Definition: Collision.hh:208
gazebo::physics::Collision::placeable
bool placeable
Flag for placeable.
Definition: Collision.hh:202
gazebo::physics::Collision::GetSurface
SurfaceParamsPtr GetSurface() const
Get the surface parameters.
Definition: Collision.hh:173
gazebo::physics::Collision::Collision
Collision(LinkPtr _link)
Constructor.
gazebo::physics::Collision::link
LinkPtr link
The link this collision belongs to.
Definition: Collision.hh:199
gazebo::physics::Collision::SetMaxContacts
virtual void SetMaxContacts(unsigned int _maxContacts)
Number of contacts allowed for this collision.
gazebo::physics::Collision::UpdateParameters
virtual void UpdateParameters(sdf::ElementPtr _sdf)
Update the parameters using new sdf values.
gazebo::physics::Collision::~Collision
virtual ~Collision()
Destructor.
system.hh
gazebo::physics::Collision::SetWorldPoseDirty
void SetWorldPoseDirty()
Indicate that the world pose should be recalculated.
gazebo::physics::Collision::SetState
void SetState(const CollisionState &_state)
Set the current collision state.
PhysicsTypes.hh
default namespace for gazebo
gazebo::physics::Collision::WorldLinearVel
virtual ignition::math::Vector3d WorldLinearVel() const
Get the linear velocity of the collision in the world frame.
gazebo::physics::Collision::RelativeAngularAccel
virtual ignition::math::Vector3d RelativeAngularAccel() const
Get the angular acceleration of the collision.
gazebo::physics::CollisionState
Store state information of a physics::Collision object.
Definition: CollisionState.hh:43
gazebo::physics::Collision::GetLaserRetro
float GetLaserRetro() const
Get the laser retro reflectiveness.
Entity.hh
gazebo::physics::Collision::RelativeLinearAccel
virtual ignition::math::Vector3d RelativeLinearAccel() const
Get the linear acceleration of the collision.
gazebo::physics::Collision::Load
virtual void Load(sdf::ElementPtr _sdf)
Load the collision.
gazebo::physics::ShapePtr
boost::shared_ptr< Shape > ShapePtr
Definition: PhysicsTypes.hh:141
gazebo::physics::Collision::RelativeLinearVel
virtual ignition::math::Vector3d RelativeLinearVel() const
Get the linear velocity of the collision.
gazebo::physics::Collision::RelativeAngularVel
virtual ignition::math::Vector3d RelativeAngularVel() const
Get the angular velocity of the collision.
gazebo::physics::Collision::BoundingBox
virtual ignition::math::Box BoundingBox() const =0
Get the bounding box for this collision.
gazebo::physics::Collision::SetLaserRetro
void SetLaserRetro(float _retro)
Set the laser retro reflectiveness.
gazebo::physics::Collision::Fini
virtual void Fini()
Finalize the collision.
gazebo::physics::Collision::SetPlaceable
void SetPlaceable(const bool _placeable)
Set if this object is moveable.
gazebo::msgs::Init
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
gazebo::physics::LinkPtr
boost::shared_ptr< Link > LinkPtr
Definition: PhysicsTypes.hh:109
gazebo::physics::Collision::ProcessMsg
void ProcessMsg(const msgs::Collision &_msg)
Update parameters from a message.
gazebo::physics::Entity
Base class for all physics objects in Gazebo.
Definition: Entity.hh:52
gazebo::physics::Collision::GetModel
ModelPtr GetModel() const
Get the model this collision belongs to.
gazebo::physics::Collision::FillMsg
void FillMsg(msgs::Collision &_msg)
Fill a collision message.
gazebo::physics::Collision::SetCollideBits
virtual void SetCollideBits(unsigned int _bits)=0
Set the collide bits, used during collision detection.
Event.hh
gazebo::physics::SurfaceParamsPtr
boost::shared_ptr< SurfaceParams > SurfaceParamsPtr
Definition: PhysicsTypes.hh:169
gazebo::physics::Collision::WorldAngularVel
virtual ignition::math::Vector3d WorldAngularVel() const
Get the angular velocity of the collision in the world frame.
gazebo::physics::Collision::shape
ShapePtr shape
Pointer to physics::Shape.
Definition: Collision.hh:205
gazebo::physics::Collision::GetShapeType
unsigned int GetShapeType() const
Get the shape type.
gazebo::physics::Collision::WorldLinearAccel
virtual ignition::math::Vector3d WorldLinearAccel() const
Get the linear acceleration of the collision in the world frame.
gazebo::physics::Collision::SetCategoryBits
virtual void SetCategoryBits(unsigned int _bits)=0
Set the category bits, used during collision detection.
gazebo::physics::Collision::WorldPose
virtual const ignition::math::Pose3d & WorldPose() const
Get the absolute pose of the entity.
gazebo::physics::Collision::IsPlaceable
bool IsPlaceable() const
Return whether this collision is movable.
gazebo::physics::Collision::SetScale
void SetScale(const ignition::math::Vector3d &_scale)
Set the scale of the collision.