##

BulletJoint.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.
*
*/
/* Desc: The base Bullet joint class
* Author: Nate Koenig, Andrew Howard
* Date: 21 May 2003
*/
#ifndef _BULLETJOINT_HH_
#define _BULLETJOINT_HH_
#include <boost/any.hpp>
#include <string>
#include "gazebo/physics/bullet/BulletPhysics.hh"
#include "gazebo/physics/Joint.hh"
#include "gazebo/util/system.hh"
namespace gazebo
{
namespace physics
{
class GZ_PHYSICS_VISIBLE BulletJoint : public Joint
{
public: explicit BulletJoint(BasePtr _parent);
public: virtual ~BulletJoint();
public: virtual void Load(sdf::ElementPtr _sdf) override;
// Documentation inherited.
public: virtual void Fini() override;
public: virtual void Reset() override;
public: LinkPtr GetJointLink(unsigned int _index) const override;
public: bool AreConnected(LinkPtr _one, LinkPtr _two) const override;
public: virtual void Detach() override;
public: virtual void SetAnchor(const unsigned int _index,
const ignition::math::Vector3d &_anchor)
override;
// Documentation inherited
public: virtual void SetDamping(unsigned int _index, double _damping)
override;
// Documentation inherited.
public: virtual bool SetPosition(
const unsigned int _index, const double _position,
const bool _preserveWorldVelocity = false) override;
// Documentation inherited.
public: virtual void SetStiffness(unsigned int _index,
const double _stiffness) override;
// Documentation inherited.
public: virtual void SetStiffnessDamping(unsigned int _index,
double _stiffness, double _damping, double _reference = 0) override;
public: virtual ignition::math::Vector3d Anchor(
const unsigned int _index) const override;
public: virtual ignition::math::Vector3d LinkForce(
const unsigned int _index) const override;
public: virtual ignition::math::Vector3d LinkTorque(
const unsigned int _index) const override;
// Documentation inherited.
public: virtual bool SetParam(const std::string &_key,
unsigned int _index,
const boost::any &_value) override;
// Documentation inherited.
public: virtual double GetParam(const std::string &_key,
unsigned int _index) override;
// Documentation inherited.
public: virtual void SetProvideFeedback(bool _enable) override;
// Documentation inherited.
public: virtual void CacheForceTorque() override;
// Documentation inherited.
public: virtual JointWrench GetForceTorque(unsigned int _index) override;
// Documentation inherited.
public: virtual void SetForce(unsigned int _index, double _force)
override;
// Documentation inherited.
public: virtual double GetForce(unsigned int _index) override;
// Documentation inherited.
public: virtual void Init() override;
// Documentation inherited.
public: virtual void ApplyStiffnessDamping() override;
protected: virtual void SetForceImpl(unsigned int _index,
double _force) = 0;
protected: void SetupJointFeedback();
private: void SaveForce(unsigned int _index, double _force);
protected: btTypedConstraint *constraint;
protected: btDynamicsWorld *bulletWorld;
private: btJointFeedback *feedback;
private: bool stiffnessDampingInitialized;
private: double forceApplied[MAX_JOINT_AXIS];
private: common::Time forceAppliedTime;
};
}
}
#endif
MAX_JOINT_AXIS
#define MAX_JOINT_AXIS
maximum number of axis per joint anticipated.
Definition: Joint.hh:39
gazebo::physics::BulletJoint::SetForce
virtual void SetForce(unsigned int _index, double _force) override
Set the force applied to this physics::Joint.
gazebo::physics::BulletJoint::Detach
virtual void Detach() override
Detach this joint from all bodies.
gazebo::physics::BulletJoint::SetupJointFeedback
void SetupJointFeedback()
: Setup joint feedback datatructure.
gazebo::physics::BulletJoint::SetPosition
virtual bool SetPosition(const unsigned int _index, const double _position, const bool _preserveWorldVelocity=false) override
The child links of this joint are updated based on desired position.
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
gazebo::common::Time
A Time class, can be used to hold wall- or sim-time. stored as sec and nano-sec.
Definition: Time.hh:47
gazebo::physics::BulletJoint::LinkForce
virtual ignition::math::Vector3d LinkForce(const unsigned int _index) const override
Get the force the joint applies to the first body.
gazebo::physics::BulletJoint::SetStiffness
virtual void SetStiffness(unsigned int _index, const double _stiffness) override
Set the joint spring stiffness.
gazebo::physics::BulletJoint::SetProvideFeedback
virtual void SetProvideFeedback(bool _enable) override
Set whether the joint should generate feedback.
gazebo::physics::BulletJoint::~BulletJoint
virtual ~BulletJoint()
Destructor.
gazebo::physics::BulletJoint::GetParam
virtual double GetParam(const std::string &_key, unsigned int _index) override
Get a non-generic parameter for the joint.
system.hh
gazebo::physics::BulletJoint::constraint
btTypedConstraint * constraint
Pointer to a contraint object in Bullet.
Definition: BulletJoint.hh:158
gazebo::physics::BulletJoint::GetJointLink
LinkPtr GetJointLink(unsigned int _index) const override
Get the body to which the joint is attached according the _index.
gazebo::physics::BulletJoint::CacheForceTorque
virtual void CacheForceTorque() override
Cache Joint Force Torque Values if necessary for physics engine.
gazebo::physics::BulletJoint::Reset
virtual void Reset() override
Reset the joint.
gazebo::physics::BulletJoint::Init
virtual void Init() override
Initialize a joint.
gazebo::physics::BulletJoint::Anchor
virtual ignition::math::Vector3d Anchor(const unsigned int _index) const override
Get the anchor point.
gazebo::physics::BulletJoint::SetParam
virtual bool SetParam(const std::string &_key, unsigned int _index, const boost::any &_value) override
Set a non-generic parameter for the joint.
gazebo::physics::BulletJoint::SetForceImpl
virtual void SetForceImpl(unsigned int _index, double _force)=0
Set the force applied to this physics::Joint.
gazebo::physics::BulletJoint
Base class for all joints.
Definition: BulletJoint.hh:41
gazebo::physics::Joint
Base class for all joints.
Definition: Joint.hh:50
gazebo::physics::BulletJoint::GetForceTorque
virtual JointWrench GetForceTorque(unsigned int _index) override
get internal force and torque values at a joint.
Joint.hh
gazebo::physics::BulletJoint::AreConnected
bool AreConnected(LinkPtr _one, LinkPtr _two) const override
Determines of the two bodies are connected by a joint.
gazebo::physics::BulletJoint::Fini
virtual void Fini() override
Finialize the object.
gazebo::physics::BasePtr
boost::shared_ptr< Base > BasePtr
Definition: PhysicsTypes.hh:77
gazebo::physics::BulletJoint::LinkTorque
virtual ignition::math::Vector3d LinkTorque(const unsigned int _index) const override
Get the torque the joint applies to the first body.
BulletPhysics.hh
gazebo::msgs::Init
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
gazebo::physics::BulletJoint::SetStiffnessDamping
virtual void SetStiffnessDamping(unsigned int _index, double _stiffness, double _damping, double _reference=0) override
Set the joint spring stiffness.
gazebo::physics::LinkPtr
boost::shared_ptr< Link > LinkPtr
Definition: PhysicsTypes.hh:109
gazebo::physics::BulletJoint::bulletWorld
btDynamicsWorld * bulletWorld
Pointer to Bullet's btDynamicsWorld.
Definition: BulletJoint.hh:161
gazebo::physics::BulletJoint::Load
virtual void Load(sdf::ElementPtr _sdf) override
Load a BulletJoint.
gazebo::physics::BulletJoint::BulletJoint
BulletJoint(BasePtr _parent)
Constructor.
gazebo::physics::JointWrench
Wrench information from a joint. These are forces and torques on parent and child Links,...
Definition: JointWrench.hh:40
gazebo::physics::BulletJoint::GetForce
virtual double GetForce(unsigned int _index) override
gazebo::physics::BulletJoint::ApplyStiffnessDamping
virtual void ApplyStiffnessDamping() override
Callback to apply spring stiffness and viscous damping effects to joint.
gazebo::physics::BulletJoint::SetDamping
virtual void SetDamping(unsigned int _index, double _damping) override
Set the joint damping.
gazebo::physics::BulletJoint::SetAnchor
virtual void SetAnchor(const unsigned int _index, const ignition::math::Vector3d &_anchor) override
Set the anchor point.