hingejoint.cc

来自「机器人人3D仿真工具,可以加入到Simbad仿真环境下应用。」· CC 代码 · 共 125 行

CC
125
字号
/* *  Gazebo - Outdoor Multi-Robot Simulator *  Copyright (C) 2003   *     Nate Koenig & Andrew Howard * *  This program is free software; you can redistribute it and/or modify *  it under the terms of the GNU General Public License as published by *  the Free Software Foundation; either version 2 of the License, or *  (at your option) any later version. * *  This program is distributed in the hope that it will be useful, *  but WITHOUT ANY WARRANTY; without even the implied warranty of *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the *  GNU General Public License for more details. * *  You should have received a copy of the GNU General Public License *  along with this program; if not, write to the Free Software *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA * *//* Desc: A HingeJoint * Author: Nate Keonig, Andrew Howard * Date: 21 May 2003 * CVS: $Id: HingeJoint.cc,v 1.7 2005/12/02 16:26:51 natepak Exp $ */#include "World.hh"#include "HingeJoint.hh"#include "JointGroup.hh"//////////////////////////////////////////////////////////////////////////////// ConstructorHingeJoint::HingeJoint( World *world )  : Joint(){  this->jointId = dJointCreateHinge( world->worldId, NULL );  return;}//////////////////////////////////////////////////////////////////////////////// DestructorHingeJoint::~HingeJoint(){}// Get the anchor point //////////////////////////////////////////////////////////////////////////////GzVector HingeJoint::GetAnchor( ) const{  dVector3 result;  dJointGetHingeAnchor( this->jointId, result );  return GzVectorSet(result[0], result[1], result[2]);}//////////////////////////////////////////////////////////////////////////////// Get the axis of rotationGzVector HingeJoint::GetAxis() const{  dVector3 result;  dJointGetHingeAxis( this->jointId, result );  return GzVectorSet(result[0], result[1], result[2]);}//////////////////////////////////////////////////////////////////////////////// Get the angle of rotationdouble HingeJoint::GetAngle() const{  return dJointGetHingeAngle( this->jointId );}//////////////////////////////////////////////////////////////////////////////// Get the rotation ratedouble HingeJoint::GetAngleRate() const{  return dJointGetHingeAngleRate( this->jointId );}//////////////////////////////////////////////////////////////////////////////// Get the specified parameterdouble HingeJoint::GetParam( int parameter ) const{  return dJointGetHingeParam( this->jointId, parameter );}//////////////////////////////////////////////////////////////////////////////// Set the anchor pointvoid HingeJoint::SetAnchor( GzVector anchor ){  dJointSetHingeAnchor( this->jointId, anchor.x, anchor.y, anchor.z );}//////////////////////////////////////////////////////////////////////////////// Set the axis of rotationvoid HingeJoint::SetAxis( GzVector axis ){ dJointSetHingeAxis( this->jointId, axis.x, axis.y, axis.z );}//////////////////////////////////////////////////////////////////////////////// Set the _parameter to _valuevoid HingeJoint::SetParam( int parameter, double value ){  dJointSetHingeParam( this->jointId, parameter, value );}//////////////////////////////////////////////////////////////////////////////// Set the torque of this jointvoid HingeJoint::SetTorque(double torque){  dJointAddHingeTorque( this->jointId, torque );}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?