18#ifndef _GEARBOXJOINT_HH_
19#define _GEARBOXJOINT_HH_
41 : T(_parent), gearRatio(1.0)
42 { this->AddType(Base::GEARBOX_JOINT); }
48 public:
virtual unsigned int DOF()
const
53 public:
virtual void Load(sdf::ElementPtr _sdf)
56 if (_sdf->HasElement(
"gearbox_ratio"))
59 _sdf->Get<
double>(
"gearbox_ratio");
63 gzerr <<
"gearbox_ratio_not_specified, set to 1.\n";
64 this->gearRatio = 1.0;
71 if (_sdf->HasElement(
"gearbox_reference_body"))
74 _sdf->Get<std::string>(
"gearbox_reference_body");
78 gzerr <<
"Gearbox joint missing reference body.\n";
83 protected:
virtual void Init()
91 {
return this->gearRatio; }
101 public:
virtual void FillMsg(msgs::Joint &_msg)
103 Joint::FillMsg(_msg);
104 msgs::Joint::Gearbox *gearboxMsg = _msg.mutable_gearbox();
105 gearboxMsg->set_gearbox_reference_body(this->referenceBody);
106 gearboxMsg->set_gearbox_ratio(this->gearRatio);
@ GEARBOX_JOINT
GearboxJoint type.
Definition Base.hh:106
A double axis gearbox joint.
Definition GearboxJoint.hh:37
std::string referenceBody
reference link/body for computing joint angles
Definition GearboxJoint.hh:113
double gearRatio
Gearbox gearRatio.
Definition GearboxJoint.hh:110
virtual ~GearboxJoint()
Destructor.
Definition GearboxJoint.hh:44
virtual void Init()
Initialize joint.
Definition GearboxJoint.hh:83
GearboxJoint(BasePtr _parent)
Constructor.
Definition GearboxJoint.hh:40
virtual double GetGearboxRatio() const
Get gearbox joint gear ratio.
Definition GearboxJoint.hh:90
virtual void SetGearboxRatio(double _gearRatio)=0
Set gearbox joint gear ratio.
virtual void Load(sdf::ElementPtr _sdf)
Load joint.
Definition GearboxJoint.hh:53
virtual void FillMsg(msgs::Joint &_msg)
Definition GearboxJoint.hh:101
virtual unsigned int DOF() const
Definition GearboxJoint.hh:48
virtual void FillMsg(msgs::Joint &_msg)
Fill a joint message.
#define gzerr
Output an error message.
Definition Console.hh:50
boost::shared_ptr< Base > BasePtr
Definition PhysicsTypes.hh:77
Forward declarations for the common classes.
Definition Animation.hh:27