DARTPhysics.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014-2016 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: 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);
128 
129  // Documentation inherited
130  public: virtual void SetGravity(const gazebo::math::Vector3 &_gravity);
131 
132  // Documentation inherited
133  public: virtual void DebugPrint() const;
134 
135  // Documentation inherited
136  public: virtual boost::any GetParam(const std::string &_key) const;
137 
138  // Documentation inherited
139  public: virtual bool GetParam(const std::string &_key,
140  boost::any &_value) const;
141 
142  // Documentation inherited
143  public: virtual bool SetParam(const std::string &_key,
144  const boost::any &_value);
145 
148  public: dart::simulation::World *GetDARTWorld();
149 
150  // Documentation inherited
151  protected: virtual void OnRequest(ConstRequestPtr &_msg);
152 
153  // Documentation inherited
154  protected: virtual void OnPhysicsMsg(ConstPhysicsPtr &_msg);
155 
159  private: DARTLinkPtr FindDARTLink(
160  const dart::dynamics::BodyNode *_dtBodyNode);
161 
164  private: DARTPhysicsPrivate *dataPtr;
165  };
166 
168  }
169 }
170 #endif
boost::shared_ptr< Link > LinkPtr
Definition: PhysicsTypes.hh:109
boost::shared_ptr< World > WorldPtr
Definition: PhysicsTypes.hh:89
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:39
Base class for a physics engine.
Definition: PhysicsEngine.hh:40
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:45
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