18#ifndef GAZEBO_PHYSICS_BASE_HH_
19#define GAZEBO_PHYSICS_BASE_HH_
27#include <boost/enable_shared_from_this.hpp>
77 class GZ_PHYSICS_VISIBLE
Base :
public boost::enable_shared_from_this<Base>
91 COLLISION = 0x00000008,
100 BALL_JOINT = 0x00000080,
102 HINGE2_JOINT = 0x00000100,
104 HINGE_JOINT = 0x00000200,
106 SLIDER_JOINT = 0x00000400,
108 SCREW_JOINT = 0x00000800,
110 UNIVERSAL_JOINT = 0x00001000,
112 GEARBOX_JOINT = 0x00002000,
114 FIXED_JOINT = 0x00004000,
122 BOX_SHAPE = 0x00020000,
124 CYLINDER_SHAPE = 0x00040000,
126 HEIGHTMAP_SHAPE = 0x00080000,
128 MAP_SHAPE = 0x00100000,
130 MULTIRAY_SHAPE = 0x00200000,
132 RAY_SHAPE = 0x00400000,
134 PLANE_SHAPE = 0x00800000,
136 SPHERE_SHAPE = 0x01000000,
138 MESH_SHAPE = 0x02000000,
140 POLYLINE_SHAPE = 0x04000000,
143 SENSOR_COLLISION = 0x10000000
155 public:
virtual void Load(sdf::ElementPtr _sdf);
180 public:
virtual void SetName(
const std::string &_name);
232 public:
BasePtr GetById(
unsigned int _id)
const;
295 public:
void Print(
const std::string &_prefix);
310 public:
bool operator ==(
const Base &_ent)
const;
323 public:
virtual const sdf::ElementPtr
GetSDF();
337 protected: sdf::ElementPtr
sdf;
352 private:
bool saveable;
355 private: uint32_t id;
358 private:
unsigned int type;
361 private: std::string typeStr;
364 private:
bool selected;
367 private: std::string name;
370 private: std::string scopedName;
default namespace for gazebo
A complete URI.
Definition URI.hh:177
Base class for most physics classes.
Definition Base.hh:78
unsigned int GetType() const
Get the full type definition.
BasePtr parent
Parent of this entity.
Definition Base.hh:340
virtual bool SetSelected(bool _show)
Set whether this entity has been selected by the user through the gui.
bool IsSelected() const
True if the entity is selected by the user.
std::string GetScopedName(bool _prependWorldName=false) const
Return the name of this entity with the model scope model1::...::modelN::entityName.
std::vector< common::URI > introspectionItems
All the introspection items regsitered for this.
Definition Base.hh:349
virtual void Fini()
Finialize the object.
BasePtr GetByName(const std::string &_name)
Get by name.
void AddType(EntityType _type)
Add a type specifier.
void Print(const std::string &_prefix)
Print this object to screen via gzmsg.
virtual void Init()
Initialize the object.
Definition Base.hh:161
BasePtr GetChild(unsigned int _i) const
Get a child by index.
void AddChild(BasePtr _child)
Add a child to this entity.
virtual void Reset()
Reset the object.
Base_V children
Children of this entity.
Definition Base.hh:343
Base(BasePtr _parent)
Constructor.
virtual void SetName(const std::string &_name)
Set the name of the entity.
virtual void RemoveChild(unsigned int _id)
Remove a child from this entity.
virtual const sdf::ElementPtr GetSDF()
Get the SDF values for the object.
void RemoveChild(const std::string &_name)
Remove a child by name.
bool HasType(const EntityType &_t) const
Returns true if this object's type definition has the given type.
common::URI URI() const
Return the common::URI of this entity.
void SetParent(BasePtr _parent)
Set the parent.
void SetWorld(const WorldPtr &_newWorld)
Set the world this object belongs to.
virtual void RegisterIntrospectionItems()
Register items in the introspection service.
const WorldPtr & GetWorld() const
Get the World this object is in.
unsigned int GetChildCount() const
Get the number of children.
std::string GetName() const
Return the name of the entity.
sdf::ElementPtr sdf
The SDF values for this object.
Definition Base.hh:337
void RemoveChildren()
Remove all children.
void SetSaveable(bool _v)
Set whether the object should be "saved", when the user selects to save the world to xml.
BasePtr GetChild(const std::string &_name)
Get a child by name.
virtual ~Base()
Destructor.
int GetParentId() const
Return the ID of the parent.
void ComputeScopedName()
Compute the scoped name of this object based on its parents.
WorldPtr world
Pointer to the world.
Definition Base.hh:346
virtual void Load(sdf::ElementPtr _sdf)
Load.
virtual void UnregisterIntrospectionItems()
Unregister items in the introspection service.
uint32_t GetId() const
Return the ID of this entity.
bool operator==(const Base &_ent) const
Returns true if the entities are the same.
virtual void UpdateParameters(sdf::ElementPtr _sdf)
Update the parameters using new sdf values.
EntityType
Unique identifiers for all entity types.
Definition Base.hh:81
@ SENSOR_COLLISION
Indicates a collision shape used for sensing.
Definition Base.hh:143
@ SLIDER_JOINT
SliderJoint type.
Definition Base.hh:106
@ ENTITY
Entity type.
Definition Base.hh:85
@ PLANE_SHAPE
PlaneShape type.
Definition Base.hh:134
@ SCREW_JOINT
ScrewJoint type.
Definition Base.hh:108
@ SHAPE
Shape type.
Definition Base.hh:120
@ HEIGHTMAP_SHAPE
HeightmapShape type.
Definition Base.hh:126
@ CYLINDER_SHAPE
CylinderShape type.
Definition Base.hh:124
@ UNIVERSAL_JOINT
UniversalJoint type.
Definition Base.hh:110
@ ACTOR
Actor type.
Definition Base.hh:117
@ MODEL
Model type.
Definition Base.hh:87
@ SPHERE_SHAPE
SphereShape type.
Definition Base.hh:136
@ HINGE_JOINT
HingeJoint type.
Definition Base.hh:104
@ RAY_SHAPE
RayShape type.
Definition Base.hh:132
@ BASE
Base type.
Definition Base.hh:83
@ VISUAL
Visual type.
Definition Base.hh:95
@ JOINT
Joint type.
Definition Base.hh:98
@ MULTIRAY_SHAPE
MultiRayShape type.
Definition Base.hh:130
@ GEARBOX_JOINT
GearboxJoint type.
Definition Base.hh:112
@ COLLISION
Collision type.
Definition Base.hh:91
@ MESH_SHAPE
MeshShape type.
Definition Base.hh:138
@ POLYLINE_SHAPE
PolylineShape type.
Definition Base.hh:140
@ BOX_SHAPE
BoxShape type.
Definition Base.hh:122
@ FIXED_JOINT
FixedJoint type.
Definition Base.hh:114
@ LINK
Link type.
Definition Base.hh:89
@ LIGHT
Light type.
Definition Base.hh:93
@ BALL_JOINT
BallJoint type.
Definition Base.hh:100
@ MAP_SHAPE
MapShape type.
Definition Base.hh:128
@ HINGE2_JOINT
Hing2Joint type.
Definition Base.hh:102
void RemoveChild(physics::BasePtr _child)
Remove a child by pointer.
std::string TypeStr() const
Get the string name for the entity type.
virtual void Reset(Base::EntityType _resetType)
Calls recursive Reset on one of the Base::EntityType's.
bool GetSaveable() const
Get whether the object should be "saved", when the user selects to save the world to xml.
BasePtr GetParent() const
Get the parent.
virtual void Update()
Update the object.
Definition Base.hh:171
Base class for all physics objects in Gazebo.
Definition Entity.hh:53
static std::string EntityTypename[]
String names for the different entity types.
Definition Base.hh:47
std::vector< BasePtr > Base_V
Definition PhysicsTypes.hh:201
boost::shared_ptr< Base > BasePtr
Definition PhysicsTypes.hh:77
boost::shared_ptr< World > WorldPtr
Definition PhysicsTypes.hh:89
Forward declarations for the common classes.
Definition Animation.hh:27