ODELink.hh
00001 /* 00002 * Copyright 2011 Nate Koenig & Andrew Howard 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 * 00016 */ 00017 /* Desc: ODE Link class 00018 * Author: Nate Koenig 00019 */ 00020 00021 #ifndef ODELINK_HH 00022 #define ODELINK_HH 00023 00024 #include "physics/ode/ode_inc.h" 00025 00026 #include "physics/ode/ODETypes.hh" 00027 #include "physics/Link.hh" 00028 00029 namespace gazebo 00030 { 00031 namespace physics 00032 { 00033 class ODEPhysics; 00034 00037 00041 00043 class ODELink : public Link 00044 { 00046 public: ODELink(EntityPtr parent); 00047 00049 public: virtual ~ODELink(); 00050 00053 public: virtual void Load( sdf::ElementPtr &_sdf ); 00054 00056 public: virtual void Init(); 00057 00059 public: virtual void Fini(); 00060 00062 public: virtual void Update(); 00063 00066 public: virtual void OnPoseChange(); 00067 00070 public: dBodyID GetODEId() const; 00071 00073 public: virtual void SetEnabled(bool enable) const; 00074 00076 public: virtual bool GetEnabled() const; 00077 00079 public: virtual void UpdateMass(); 00080 00082 public: virtual void SetLinearVel(const math::Vector3 &vel); 00083 00085 public: virtual void SetAngularVel(const math::Vector3 &vel); 00086 00088 public: virtual void SetForce(const math::Vector3 &_force); 00089 00091 public: virtual void SetTorque(const math::Vector3 &_torque); 00092 00094 public: virtual void AddForce(const math::Vector3 &_force); 00095 00097 public: virtual void AddRelativeForce(const math::Vector3 &_force); 00098 00100 public: virtual void AddForceAtRelativePosition( 00101 const math::Vector3 &_force,const math::Vector3 &_relpos); 00102 00104 public: virtual void AddTorque(const math::Vector3 &_torque); 00105 00107 public: virtual void AddRelativeTorque(const math::Vector3 &_torque); 00108 00110 public: virtual math::Vector3 GetWorldLinearVel() const; 00111 00113 public: virtual math::Vector3 GetWorldAngularVel() const; 00114 00116 public: virtual math::Vector3 GetWorldForce() const; 00117 00119 public: virtual math::Vector3 GetWorldTorque() const; 00120 00122 public: virtual void SetGravityMode(bool mode); 00123 00125 public: virtual bool GetGravityMode(); 00126 00128 public: void SetSelfCollide(bool collide); 00129 00131 public: dSpaceID GetSpaceId() const; 00132 00134 public: void SetSpaceId(dSpaceID spaceid); 00135 00137 public: virtual void SetLinearDamping(double damping); 00138 00140 public: virtual void SetAngularDamping(double damping); 00141 00142 public: static void MoveCallback(dBodyID id); 00143 00145 public: virtual void SetKinematic(const bool &state); 00146 00148 public: virtual bool GetKinematic() const; 00149 00150 protected: math::Pose pose; 00151 00153 private: dBodyID linkId; 00154 00155 private: ODEPhysicsPtr odePhysics; 00156 00157 private: dSpaceID spaceId; 00158 }; 00159 00162 00163 } 00164 00165 } 00166 #endif

1.7.5.1