##

ScrewJoint.hh
Go to the documentation of this file.
/*
* Copyright (C) 2012 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 _SCREWJOINT_HH_
#define _SCREWJOINT_HH_
#include "gazebo/physics/Joint.hh"
#include "gazebo/common/Console.hh"
#include "gazebo/msgs/msgs.hh"
#include "gazebo/util/system.hh"
namespace gazebo
{
namespace physics
{
template<class T>
class GZ_PHYSICS_VISIBLE ScrewJoint : public T
{
public: explicit ScrewJoint(BasePtr _parent) : T(_parent), threadPitch(0)
{this->AddType(Base::SCREW_JOINT);}
public: virtual ~ScrewJoint()
{ }
// Documentation inherited.
public: virtual unsigned int DOF() const
{return 2;}
public: virtual void Load(sdf::ElementPtr _sdf)
{
T::Load(_sdf);
this->threadPitch =
_sdf->GetElement("thread_pitch")->Get<double>();
}
public: virtual void SetThreadPitch(double _threadPitch) = 0;
public: virtual double GetThreadPitch() = 0;
// Documentation inherited
public: virtual void FillMsg(msgs::Joint &_msg)
{
Joint::FillMsg(_msg);
msgs::Joint::Screw *screwMsg = _msg.mutable_screw();
screwMsg->set_thread_pitch(this->threadPitch);
}
protected: double threadPitch;
protected: virtual void Init()
{
T::Init();
}
};
}
}
#endif
gazebo::physics::ScrewJoint::SetThreadPitch
virtual void SetThreadPitch(double _threadPitch)=0
Set screw joint thread pitch.
gazebo::physics::ScrewJoint
A screw joint, which has both prismatic and rotational DOFs.
Definition: ScrewJoint.hh:35
gazebo::physics::Base::SCREW_JOINT
ScrewJoint type.
Definition: Base.hh:102
gazebo::physics::Joint::FillMsg
virtual void FillMsg(msgs::Joint &_msg)
Fill a joint message.
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
Console.hh
system.hh
gazebo::physics::ScrewJoint::threadPitch
double threadPitch
Pitch of the thread.
Definition: ScrewJoint.hh:87
msgs.hh
gazebo::physics::ScrewJoint::Load
virtual void Load(sdf::ElementPtr _sdf)
Load a ScrewJoint.
Definition: ScrewJoint.hh:52
gazebo::physics::ScrewJoint::DOF
virtual unsigned int DOF() const
Definition: ScrewJoint.hh:47
gazebo::physics::ScrewJoint::ScrewJoint
ScrewJoint(BasePtr _parent)
Constructor.
Definition: ScrewJoint.hh:39
gazebo::physics::ScrewJoint::FillMsg
virtual void FillMsg(msgs::Joint &_msg)
Definition: ScrewJoint.hh:79
Joint.hh
gazebo::physics::BasePtr
boost::shared_ptr< Base > BasePtr
Definition: PhysicsTypes.hh:77
gazebo::msgs::Init
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
gazebo::physics::ScrewJoint::Init
virtual void Init()
Initialize joint.
Definition: ScrewJoint.hh:90
gazebo::physics::ScrewJoint::~ScrewJoint
virtual ~ScrewJoint()
Destructor.
Definition: ScrewJoint.hh:43
gazebo::physics::ScrewJoint::GetThreadPitch
virtual double GetThreadPitch()=0
Get screw joint thread pitch.