##

DARTPhysics.hh
Go to the documentation of this file.
/*
* Copyright (C) 2014 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_DARTPHYSICS_HH_
#define _GAZEBO_DARTPHYSICS_HH_
#include <string>
#include <boost/thread/thread.hpp>
#include <boost/thread/mutex.hpp>
#include "gazebo/physics/PhysicsEngine.hh"
#include "gazebo/physics/Collision.hh"
#include "gazebo/physics/Shape.hh"
#include "gazebo/physics/dart/dart_inc.h"
#include "gazebo/physics/dart/DARTTypes.hh"
#include "gazebo/util/system.hh"
namespace gazebo
{
namespace physics
{
class DARTPhysicsPrivate;
class GZ_PHYSICS_VISIBLE DARTPhysics : public PhysicsEngine
{
public: enum DARTParam
{
// /// \brief Solve type
// SOLVER_TYPE,
// /// \brief Constraint force mixing
// GLOBAL_CFM,
// /// \brief Error reduction parameter
// GLOBAL_ERP,
// /// \brief Number of iterations
// PGS_ITERS,
// /// \brief SOR over-relaxation parameter
// SOR,
// /// \brief Surface layer depth
// CONTACT_SURFACE_LAYER,
MAX_CONTACTS,
MIN_STEP_SIZE
};
public: explicit DARTPhysics(WorldPtr _world);
public: virtual ~DARTPhysics();
// Documentation inherited
public: virtual void Load(sdf::ElementPtr _sdf);
// Documentation inherited
public: virtual void Init();
// Documentation inherited
public: virtual void Fini();
// Documentation inherited
public: virtual void Reset();
// Documentation inherited
public: virtual void InitForThread();
// Documentation inherited
public: virtual void UpdateCollision();
// Documentation inherited
public: virtual void UpdatePhysics();
// Documentation inherited
public: virtual std::string GetType() const;
// Documentation inherited
public: virtual void SetSeed(uint32_t _seed);
// Documentation inherited
public: virtual ModelPtr CreateModel(BasePtr _parent);
// Documentation inherited
public: virtual LinkPtr CreateLink(ModelPtr _parent);
// Documentation inherited
public: virtual CollisionPtr CreateCollision(const std::string &_type,
LinkPtr _body);
// Documentation inherited
public: virtual JointPtr CreateJoint(const std::string &_type,
ModelPtr _parent);
// Documentation inherited
public: virtual ShapePtr CreateShape(const std::string &_shapeType,
CollisionPtr _collision);
public: std::string GetSolverType() const;
public: void SetSolverType(const std::string &_type);
// Documentation inherited
public: virtual void SetGravity(const ignition::math::Vector3d &_gravity);
// Documentation inherited
public: virtual void DebugPrint() const;
// Documentation inherited
public: virtual boost::any GetParam(const std::string &_key) const;
// Documentation inherited
public: virtual bool GetParam(const std::string &_key,
boost::any &_value) const;
// Documentation inherited
public: virtual bool SetParam(const std::string &_key,
const boost::any &_value);
public: dart::simulation::WorldPtr DARTWorld() const;
// Documentation inherited
protected: virtual void OnRequest(ConstRequestPtr &_msg);
// Documentation inherited
protected: virtual void OnPhysicsMsg(ConstPhysicsPtr &_msg);
private: DARTLinkPtr FindDARTLink(
const dart::dynamics::BodyNode *_dtBodyNode);
private: DARTPhysicsPrivate *dataPtr = nullptr;
};
}
}
#endif
PhysicsEngine.hh
gazebo::physics::DARTPhysics::SetGravity
virtual void SetGravity(const ignition::math::Vector3d &_gravity)
Set the gravity vector.
DARTTypes.hh
DART wrapper forward declarations and typedefs.
gazebo::physics::PhysicsEngine
Base class for a physics engine.
Definition: PhysicsEngine.hh:41
gazebo::physics::DARTPhysics::CreateJoint
virtual JointPtr CreateJoint(const std::string &_type, ModelPtr _parent)
Create a new joint.
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
Collision.hh
gazebo::physics::DARTPhysics
DART physics engine.
Definition: DARTPhysics.hh:47
gazebo::physics::ModelPtr
boost::shared_ptr< Model > ModelPtr
Definition: PhysicsTypes.hh:93
gazebo::physics::DARTPhysics::UpdateCollision
virtual void UpdateCollision()
Update the physics engine collision.
gazebo::physics::DARTPhysics::SetSolverType
void SetSolverType(const std::string &_type)
Set the constraint LCP solver type.
gazebo::physics::DARTPhysics::CreateLink
virtual LinkPtr CreateLink(ModelPtr _parent)
Create a new body.
gazebo::physics::DARTPhysics::~DARTPhysics
virtual ~DARTPhysics()
Destructor.
gazebo::physics::DARTLinkPtr
boost::shared_ptr< DARTLink > DARTLinkPtr
Definition: DARTTypes.hh:47
system.hh
gazebo::physics::DARTPhysics::UpdatePhysics
virtual void UpdatePhysics()
Update the physics engine.
gazebo::physics::DARTPhysics::SetParam
virtual bool SetParam(const std::string &_key, const boost::any &_value)
Set a parameter of the physics engine.
gazebo::physics::DARTPhysics::Load
virtual void Load(sdf::ElementPtr _sdf)
Load the physics engine.
gazebo::physics::DARTPhysics::GetParam
virtual boost::any GetParam(const std::string &_key) const
Get an parameter of the physics engine.
gazebo::physics::DARTPhysics::DARTWorld
dart::simulation::WorldPtr DARTWorld() const
Get pointer to DART World associated with this DART Physics.
gazebo::physics::DARTPhysics::CreateModel
virtual ModelPtr CreateModel(BasePtr _parent)
Create a new model.
gazebo::physics::DARTPhysics::MIN_STEP_SIZE
Minimum step size.
Definition: DARTPhysics.hh:75
gazebo::physics::DARTPhysics::DARTParam
DARTParam
DART physics parameter types.
Definition: DARTPhysics.hh:51
gazebo::physics::DARTPhysics::GetSolverType
std::string GetSolverType() const
Get the constraint LCP solver type.
Shape.hh
gazebo::physics::DARTPhysics::GetType
virtual std::string GetType() const
Return the physics engine type (ode|bullet|dart|simbody).
gazebo::physics::ShapePtr
boost::shared_ptr< Shape > ShapePtr
Definition: PhysicsTypes.hh:141
gazebo::physics::BasePtr
boost::shared_ptr< Base > BasePtr
Definition: PhysicsTypes.hh:77
gazebo::physics::DARTPhysics::Init
virtual void Init()
Initialize the physics engine.
gazebo::physics::DARTPhysics::Reset
virtual void Reset()
Rest the physics engine.
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::DARTPhysics::SetSeed
virtual void SetSeed(uint32_t _seed)
Set the random number seed for the physics engine.
gazebo::physics::JointPtr
boost::shared_ptr< Joint > JointPtr
Definition: PhysicsTypes.hh:117
gazebo::physics::CollisionPtr
boost::shared_ptr< Collision > CollisionPtr
Definition: PhysicsTypes.hh:113
dart_inc.h
gazebo::physics::DARTPhysics::CreateCollision
virtual CollisionPtr CreateCollision(const std::string &_type, LinkPtr _body)
Create a collision.
gazebo::physics::DARTPhysics::InitForThread
virtual void InitForThread()
Init the engine for threads.
gazebo::physics::WorldPtr
boost::shared_ptr< World > WorldPtr
Definition: PhysicsTypes.hh:89
gazebo::physics::DARTPhysics::MAX_CONTACTS
Maximum number of contacts.
Definition: DARTPhysics.hh:72
gazebo::physics::DARTPhysics::OnPhysicsMsg
virtual void OnPhysicsMsg(ConstPhysicsPtr &_msg)
virtual callback for gztopic "~/physics".
gazebo::physics::DARTPhysics::Fini
virtual void Fini()
Finilize the physics engine.
gazebo::physics::DARTPhysics::DebugPrint
virtual void DebugPrint() const
Debug print out of the physic engine state.
gazebo::physics::DARTPhysics::CreateShape
virtual ShapePtr CreateShape(const std::string &_shapeType, CollisionPtr _collision)
Create a physics::Shape object.
gazebo::physics::DARTPhysics::DARTPhysics
DARTPhysics(WorldPtr _world)
Constructor.
gazebo::physics::DARTPhysics::OnRequest
virtual void OnRequest(ConstRequestPtr &_msg)
virtual callback for gztopic "~/request".