17 #ifndef _PHYSICSENGINE_HH_ 18 #define _PHYSICSENGINE_HH_ 20 #include <boost/thread/recursive_mutex.hpp> 21 #include <boost/any.hpp> 23 #include <ignition/transport/Node.hh> 53 public:
virtual void Load(sdf::ElementPtr _sdf);
56 public:
virtual void Init() = 0;
59 public:
virtual void Fini();
65 public:
virtual void InitForThread() = 0;
90 public:
virtual void UpdateCollision() = 0;
94 public:
virtual std::string GetType()
const = 0;
98 public:
virtual void SetSeed(uint32_t _seed) = 0;
102 public:
double GetUpdatePeriod();
106 public:
double GetTargetRealTimeFactor()
const;
110 public:
double GetRealTimeUpdateRate()
const;
114 public:
double GetMaxStepSize()
const;
118 public:
void SetTargetRealTimeFactor(
double _factor);
122 public:
void SetRealTimeUpdateRate(
double _rate);
126 public:
void SetMaxStepSize(
double _stepSize);
146 const std::string &_shapeType,
LinkPtr _link) = 0;
151 public:
CollisionPtr CreateCollision(
const std::string &_shapeType,
152 const std::string &_linkName);
157 public:
virtual ShapePtr CreateShape(
const std::string &_shapeType,
163 public:
virtual JointPtr CreateJoint(
const std::string &_type,
169 public:
virtual void SetGravity(
170 const ignition::math::Vector3d &_gravity) = 0;
176 public:
virtual void SetAutoDisableFlag(
bool _autoDisable);
182 public:
virtual void SetMaxContacts(
unsigned int _maxContacts);
221 public:
virtual bool SetParam(
const std::string &_key,
222 const boost::any &_value);
228 public:
virtual boost::any GetParam(
const std::string &_key)
const;
235 public:
virtual bool GetParam(
const std::string &_key,
236 boost::any &_value)
const;
239 public:
virtual void DebugPrint()
const = 0;
252 {
return this->physicsUpdateMutex;}
256 public: sdf::ElementPtr GetSDF()
const;
269 template <
typename T>
274 auto value = boost::any_cast<std::any>(_value);
275 return std::any_cast<T>(value);
277 catch(boost::bad_any_cast &)
279 return boost::any_cast<T>(_value);
285 protected:
virtual void OnRequest(ConstRequestPtr &_msg);
289 protected:
virtual void OnPhysicsMsg(ConstPhysicsPtr &_msg);
295 protected: sdf::ElementPtr
sdf;
boost::shared_ptr< Link > LinkPtr
Definition: PhysicsTypes.hh:110
sdf::ElementPtr sdf
Our SDF values.
Definition: PhysicsEngine.hh:295
boost::shared_ptr< World > WorldPtr
Definition: PhysicsTypes.hh:90
ignition::transport::Node::Publisher responsePubIgn
Response publisher.
Definition: PhysicsEngine.hh:332
Forward declarations for the common classes.
Definition: Animation.hh:26
ContactManager * contactManager
Class that handles all contacts generated by the physics engine.
Definition: PhysicsEngine.hh:314
static T any_cast(const boost::any &_value)
Helper function for performing any_cast operations in SetParam.
Definition: PhysicsEngine.hh:270
Base class for a physics engine.
Definition: PhysicsEngine.hh:42
Forward declarations for transport.
boost::shared_ptr< Publisher > PublisherPtr
Definition: TransportTypes.hh:49
boost::shared_ptr< Subscriber > SubscriberPtr
Definition: TransportTypes.hh:53
boost::shared_ptr< Joint > JointPtr
Definition: PhysicsTypes.hh:118
transport::SubscriberPtr physicsSub
Subscribe to the physics topic.
Definition: PhysicsEngine.hh:304
virtual bool GetAutoDisableFlag()
: Remove this function, and replace it with a more generic property map
Definition: PhysicsEngine.hh:188
boost::shared_ptr< Node > NodePtr
Definition: TransportTypes.hh:57
transport::SubscriberPtr requestSub
Subscribe to the request topic.
Definition: PhysicsEngine.hh:307
default namespace for gazebo
virtual void Reset()
Rest the physics engine.
Definition: PhysicsEngine.hh:62
The world provides access to all other object within a simulated environment.
Definition: World.hh:74
double realTimeUpdateRate
Real time update rate.
Definition: PhysicsEngine.hh:317
WorldPtr world
Pointer to the world.
Definition: PhysicsEngine.hh:292
ignition::transport::Node nodeIgn
Ignition node for communication.
Definition: PhysicsEngine.hh:329
double targetRealTimeFactor
Target real time factor.
Definition: PhysicsEngine.hh:320
virtual void UpdatePhysics()
Update the physics engine.
Definition: PhysicsEngine.hh:132
transport::PublisherPtr responsePub
Response publisher.
Definition: PhysicsEngine.hh:301
boost::shared_ptr< Shape > ShapePtr
Definition: PhysicsTypes.hh:142
boost::recursive_mutex * GetPhysicsUpdateMutex() const
returns a pointer to the PhysicsEngine::physicsUpdateMutex.
Definition: PhysicsEngine.hh:251
boost::shared_ptr< Model > ModelPtr
Definition: PhysicsTypes.hh:94
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
boost::recursive_mutex * physicsUpdateMutex
Mutex to protect the update cycle.
Definition: PhysicsEngine.hh:310
double maxStepSize
Real time update rate.
Definition: PhysicsEngine.hh:323
transport::NodePtr node
Node for communication.
Definition: PhysicsEngine.hh:298
boost::shared_ptr< Collision > CollisionPtr
Definition: PhysicsTypes.hh:114
boost::shared_ptr< Base > BasePtr
Definition: PhysicsTypes.hh:78