Hinge2Joint.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/* Desc: A hinge joint with 2 degrees of freedom
18 * Author: Nate Koenig, Andrew Howard
19 * Date: 21 May 2003
20 */
21
22#ifndef GAZEBO_PHYSICS_HINGE2JOINT_HH_
23#define GAZEBO_PHYSICS_HINGE2JOINT_HH_
24
25#include <sdf/sdf.hh>
26#include <ignition/math/Pose3.hh>
27
29#include "gazebo/util/system.hh"
30
31namespace gazebo
32{
33 namespace physics
34 {
37
40 template< class T>
41 class GZ_PHYSICS_VISIBLE Hinge2Joint : public T
42 {
45 public: explicit Hinge2Joint(BasePtr _parent) : T(_parent)
46 {this->AddType(Base::HINGE2_JOINT);}
47
49 public: virtual ~Hinge2Joint()
50 { }
51
52 // Documentation inherited.
53 public: virtual unsigned int DOF() const
54 {return 2;}
55
58 public: virtual void Load(sdf::ElementPtr _sdf)
59 {
60 T::Load(_sdf);
61
62 this->SetAxis(0,
63 _sdf->GetElement("axis")->Get<ignition::math::Vector3d>("xyz"));
64
65 this->SetAxis(1,
66 _sdf->GetElement("axis2")->Get<ignition::math::Vector3d>("xyz"));
67 }
68 };
70 }
71}
72#endif
@ HINGE2_JOINT
Hing2Joint type.
Definition Base.hh:96
A two axis hinge joint.
Definition Hinge2Joint.hh:42
virtual ~Hinge2Joint()
Destructor.
Definition Hinge2Joint.hh:49
Hinge2Joint(BasePtr _parent)
Constructor.
Definition Hinge2Joint.hh:45
virtual void Load(sdf::ElementPtr _sdf)
Load the joint.
Definition Hinge2Joint.hh:58
virtual unsigned int DOF() const
Definition Hinge2Joint.hh:53
boost::shared_ptr< Base > BasePtr
Definition PhysicsTypes.hh:77
Forward declarations for the common classes.
Definition Animation.hh:27