DARTPhysics.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 
18 #ifndef _GAZEBO_DARTPHYSICS_HH_
19 #define _GAZEBO_DARTPHYSICS_HH_
20 
21 #include <string>
22 
23 #include <boost/thread/thread.hpp>
24 #include <boost/thread/mutex.hpp>
25 
28 #include "gazebo/physics/Shape.hh"
29 
32 #include "gazebo/util/system.hh"
33 
34 namespace gazebo
35 {
36  namespace physics
37  {
39  class DARTPhysicsPrivate;
40 
45 
47  class GZ_PHYSICS_VISIBLE DARTPhysics : public PhysicsEngine
48  {
51  public: enum DARTParam
52  {
53  // /// \brief Solve type
54  // SOLVER_TYPE,
55 
56  // /// \brief Constraint force mixing
57  // GLOBAL_CFM,
58 
59  // /// \brief Error reduction parameter
60  // GLOBAL_ERP,
61 
62  // /// \brief Number of iterations
63  // PGS_ITERS,
64 
65  // /// \brief SOR over-relaxation parameter
66  // SOR,
67 
68  // /// \brief Surface layer depth
69  // CONTACT_SURFACE_LAYER,
70 
73 
75  MIN_STEP_SIZE
76  };
77 
79  public: explicit DARTPhysics(WorldPtr _world);
80 
82  public: virtual ~DARTPhysics();
83 
84  // Documentation inherited
85  public: virtual void Load(sdf::ElementPtr _sdf);
86 
87  // Documentation inherited
88  public: virtual void Init();
89 
90  // Documentation inherited
91  public: virtual void Fini();
92 
93  // Documentation inherited
94  public: virtual void Reset();
95 
96  // Documentation inherited
97  public: virtual void InitForThread();
98 
99  // Documentation inherited
100  public: virtual void UpdateCollision();
101 
102  // Documentation inherited
103  public: virtual void UpdatePhysics();
104 
105  // Documentation inherited
106  public: virtual std::string GetType() const;
107 
108  // Documentation inherited
109  public: virtual void SetSeed(uint32_t _seed);
110 
111  // Documentation inherited
112  public: virtual ModelPtr CreateModel(BasePtr _parent);
113 
114  // Documentation inherited
115  public: virtual LinkPtr CreateLink(ModelPtr _parent);
116 
117  // Documentation inherited
118  public: virtual CollisionPtr CreateCollision(const std::string &_type,
119  LinkPtr _body);
120 
121  // Documentation inherited
122  public: virtual JointPtr CreateJoint(const std::string &_type,
123  ModelPtr _parent);
124 
125  // Documentation inherited
126  public: virtual ShapePtr CreateShape(const std::string &_shapeType,
127  CollisionPtr _collision);
130  public: std::string GetSolverType() const;
131 
134  public: void SetSolverType(const std::string &_type);
135 
136  // Documentation inherited
137  public: virtual void SetGravity(const ignition::math::Vector3d &_gravity);
138 
139  // Documentation inherited
140  public: virtual void DebugPrint() const;
141 
142  // Documentation inherited
143  public: virtual boost::any GetParam(const std::string &_key) const;
144 
145  // Documentation inherited
146  public: virtual bool GetParam(const std::string &_key,
147  boost::any &_value) const;
148 
149  // Documentation inherited
150  public: virtual bool SetParam(const std::string &_key,
151  const boost::any &_value);
152 
155  public: dart::simulation::WorldPtr DARTWorld() const;
156 
157  // Documentation inherited
158  protected: virtual void OnRequest(ConstRequestPtr &_msg);
159 
160  // Documentation inherited
161  protected: virtual void OnPhysicsMsg(ConstPhysicsPtr &_msg);
162 
166  private: DARTLinkPtr FindDARTLink(
167  const dart::dynamics::BodyNode *_dtBodyNode);
168 
171  private: DARTPhysicsPrivate *dataPtr = nullptr;
172  };
173 
175  }
176 }
177 #endif
boost::shared_ptr< Link > LinkPtr
Definition: PhysicsTypes.hh:109
boost::shared_ptr< World > WorldPtr
Definition: PhysicsTypes.hh:89
Base class for a physics engine.
Definition: PhysicsEngine.hh:41
DART physics engine.
Definition: DARTPhysics.hh:47
DARTParam
DART physics parameter types.
Definition: DARTPhysics.hh:51
boost::shared_ptr< Joint > JointPtr
Definition: PhysicsTypes.hh:117
boost::shared_ptr< DARTLink > DARTLinkPtr
Definition: DARTTypes.hh:47
DART wrapper forward declarations and typedefs.
boost::shared_ptr< Shape > ShapePtr
Definition: PhysicsTypes.hh:141
Maximum number of contacts.
Definition: DARTPhysics.hh:72
boost::shared_ptr< Model > ModelPtr
Definition: PhysicsTypes.hh:93
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
boost::shared_ptr< Collision > CollisionPtr
Definition: PhysicsTypes.hh:113
boost::shared_ptr< Base > BasePtr
Definition: PhysicsTypes.hh:77