UniversalJoint.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 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 #ifndef _GAZEBO_UNIVERSALJOINT_HH_
18 #define _GAZEBO_UNIVERSALJOINT_HH_
19 
20 #include "gazebo/physics/Joint.hh"
21 #include "gazebo/util/system.hh"
22 
23 namespace gazebo
24 {
25  namespace physics
26  {
29 
34  template<class T>
35  class GZ_PHYSICS_VISIBLE UniversalJoint : public T
36  {
39  public: enum AxisIndex
40  {
41  AXIS_PARENT = 0,
42  AXIS_CHILD = 1
43  };
44 
47  public: explicit UniversalJoint(BasePtr _parent) : T(_parent)
48  {this->AddType(Base::UNIVERSAL_JOINT);}
49 
51  public: virtual ~UniversalJoint()
52  { }
53 
54  // Documentation inherited.
55  public: virtual unsigned int DOF() const
56  {return 2;}
57 
60  public: virtual void Load(sdf::ElementPtr _sdf)
61  {
62  T::Load(_sdf);
63 
64  /*
65  this->SetAxis(0,
66  this->sdf->GetElement("axis")->Get<ignition::math::Vector3d("xyz"));
67  this->SetAxis(1,
68  this->sdf->GetElement("axis2")->Get<ignition::math::Vector3d>("xyz"));
69  */
70  }
71 
73  protected: virtual void Init()
74  {
75  T::Init();
76  }
77  };
79  }
80 }
81 #endif
virtual unsigned int DOF() const
Definition: UniversalJoint.hh:55
UniversalJoint(BasePtr _parent)
Constructor.
Definition: UniversalJoint.hh:47
virtual ~UniversalJoint()
Destuctor.
Definition: UniversalJoint.hh:51
virtual void Init()
Initialize joint.
Definition: UniversalJoint.hh:73
UniversalJoint type.
Definition: Base.hh:110
virtual void Load(sdf::ElementPtr _sdf)
Load a UniversalJoint.
Definition: UniversalJoint.hh:60
AxisIndex
Definition: UniversalJoint.hh:39
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
A universal joint.
Definition: UniversalJoint.hh:35
boost::shared_ptr< Base > BasePtr
Definition: PhysicsTypes.hh:77