17 #ifndef GAZEBO_PHYSICS_MODEL_HH_ 18 #define GAZEBO_PHYSICS_MODEL_HH_ 24 #include <boost/function.hpp> 25 #include <boost/thread/recursive_mutex.hpp> 36 class recursive_mutex;
66 public:
virtual ~
Model();
70 public:
void Load(sdf::ElementPtr _sdf);
73 public:
void LoadJoints();
76 public:
virtual void Init();
79 public:
void Update();
82 public:
virtual void Fini();
86 public:
virtual void UpdateParameters(sdf::ElementPtr _sdf);
90 public:
virtual const sdf::ElementPtr GetSDF();
97 public:
virtual const sdf::ElementPtr UnscaledSDF();
101 public:
virtual void RemoveChild(
EntityPtr _child);
102 using Base::RemoveChild;
105 public:
void Reset();
110 public:
void ResetPhysicsStates();
114 public:
void SetLinearVel(
const ignition::math::Vector3d &_vel);
118 public:
void SetAngularVel(
const ignition::math::Vector3d &_vel);
123 public:
virtual ignition::math::Vector3d RelativeLinearVel()
const;
128 public:
virtual ignition::math::Vector3d WorldLinearVel()
const;
133 public:
virtual ignition::math::Vector3d RelativeAngularVel()
const;
138 public:
virtual ignition::math::Vector3d WorldAngularVel()
const;
143 public:
virtual ignition::math::Vector3d RelativeLinearAccel()
const;
148 public:
virtual ignition::math::Vector3d WorldLinearAccel()
const;
153 public:
virtual ignition::math::Vector3d RelativeAngularAccel()
const;
158 public:
virtual ignition::math::Vector3d WorldAngularAccel()
const;
162 public:
virtual ignition::math::Box BoundingBox()
const;
166 public:
unsigned int GetJointCount()
const;
171 public:
ModelPtr NestedModel(
const std::string &_name)
const;
175 public:
const Model_V &NestedModels()
const;
180 public:
const Link_V &GetLinks()
const;
184 public:
const Joint_V &GetJoints()
const;
189 public:
JointPtr GetJoint(
const std::string &name);
195 public:
LinkPtr GetLinkById(
unsigned int _id)
const;
201 public:
LinkPtr GetLink(
const std::string &_name =
"canonical")
const;
210 public:
virtual bool GetSelfCollide()
const;
215 public:
virtual void SetSelfCollide(
bool _self_collide);
219 public:
void SetGravityMode(
const bool &_value);
225 public:
void SetCollideMode(
const std::string &_mode);
229 public:
void SetLaserRetro(
const float _retro);
233 public:
virtual void FillMsg(msgs::Model &_msg);
237 public:
void ProcessMsg(
const msgs::Model &_msg);
243 public:
void SetJointPosition(
const std::string &_jointName,
244 double _position,
int _index = 0);
249 public:
void SetJointPositions(
250 const std::map<std::string, double> &_jointPositions);
256 public:
void SetJointAnimation(
257 const std::map<std::string, common::NumericAnimationPtr> &_anims,
258 boost::function<
void()> _onComplete =
NULL);
261 public:
virtual void StopAnimation();
277 public:
void AttachStaticModel(
ModelPtr &_model,
278 ignition::math::Pose3d _offset);
283 public:
void DetachStaticModel(
const std::string &_model);
287 public:
void SetState(
const ModelState &_state);
294 public:
void SetScale(
const ignition::math::Vector3d &_scale,
295 const bool _publish =
false);
301 public: ignition::math::Vector3d Scale()
const;
305 public:
void SetEnabled(
bool _enabled);
313 public:
void SetLinkWorldPose(
const ignition::math::Pose3d &_pose,
314 std::string _linkName);
322 public:
void SetLinkWorldPose(
const ignition::math::Pose3d &_pose,
328 public:
void SetAutoDisable(
bool _disable);
332 public:
bool GetAutoDisable()
const;
337 public:
void LoadPlugins();
341 public:
unsigned int GetPluginCount()
const;
346 public:
unsigned int GetSensorCount()
const;
360 public: std::vector<std::string> SensorScopedName(
361 const std::string &_name)
const;
369 public:
GripperPtr GetGripper(
size_t _index)
const;
374 public:
size_t GetGripperCount()
const;
379 public:
double GetWorldEnergyPotential()
const;
385 public:
double GetWorldEnergyKinetic()
const;
391 public:
double GetWorldEnergy()
const;
406 const std::string &_name,
const std::string &_type,
419 sdf::ElementPtr _sdf);
424 public:
virtual bool RemoveJoint(
const std::string &_name);
428 public:
virtual void SetWindMode(
const bool _mode);
432 public:
virtual bool WindMode()
const;
436 public: boost::shared_ptr<Model> shared_from_this();
442 public:
LinkPtr CreateLink(
const std::string &_name);
461 public:
void PluginInfo(
const common::URI &_pluginUri,
462 ignition::msgs::Plugin_V &_plugins,
bool &_success);
465 protected:
virtual void OnPoseChange();
468 protected:
virtual void RegisterIntrospectionItems();
471 private:
void LoadLinks();
474 private:
void LoadModels();
478 private:
void LoadJoint(sdf::ElementPtr _sdf);
482 private:
void LoadPlugin(sdf::ElementPtr _sdf);
486 private:
void LoadGripper(sdf::ElementPtr _sdf);
491 private:
void RemoveLink(
const std::string &_name);
494 private:
virtual void PublishScale();
506 private:
LinkPtr canonicalLink;
518 private: std::vector<GripperPtr> grippers;
521 private: std::vector<ModelPluginPtr> plugins;
524 private: std::map<std::string, common::NumericAnimationPtr>
528 private: boost::function<void()> onJointAnimationComplete;
534 private:
mutable boost::recursive_mutex updateMutex;
537 private: std::mutex receiveMutex;
boost::shared_ptr< Link > LinkPtr
Definition: PhysicsTypes.hh:109
Definition: JointMaker.hh:44
Forward declarations for the common classes.
Definition: Animation.hh:26
std::vector< ModelPtr > Model_V
Definition: PhysicsTypes.hh:205
Forward declarations for transport.
boost::shared_ptr< Publisher > PublisherPtr
Definition: TransportTypes.hh:49
boost::shared_ptr< Joint > JointPtr
Definition: PhysicsTypes.hh:117
std::vector< ignition::math::Pose3d > attachedModelsOffset
used by Model::AttachStaticModel
Definition: Model.hh:500
std::vector< ModelPtr > attachedModels
used by Model::AttachStaticModel
Definition: Model.hh:497
default namespace for gazebo
A complete URI.
Definition: URI.hh:176
A model is a collection of links, joints, and plugins.
Definition: Model.hh:59
transport::PublisherPtr jointPub
Publisher for joint info.
Definition: Model.hh:503
boost::shared_ptr< Gripper > GripperPtr
Definition: PhysicsTypes.hh:197
std::vector< JointPtr > Joint_V
Definition: PhysicsTypes.hh:213
#define NULL
Definition: CommonTypes.hh:31
Base class for all physics objects in Gazebo.
Definition: Entity.hh:52
boost::shared_ptr< Entity > EntityPtr
Definition: PhysicsTypes.hh:85
boost::shared_ptr< JointController > JointControllerPtr
Definition: PhysicsTypes.hh:121
boost::shared_ptr< Model > ModelPtr
Definition: PhysicsTypes.hh:93
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
Store state information of a physics::Model object.
Definition: ModelState.hh:48
std::vector< LinkPtr > Link_V
Definition: PhysicsTypes.hh:225
boost::shared_ptr< Base > BasePtr
Definition: PhysicsTypes.hh:77