##

BulletLink.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 GAZEBO_PHYSICS_BULLET_BULLETLINK_HH_
#define GAZEBO_PHYSICS_BULLET_BULLETLINK_HH_
#include "gazebo/physics/bullet/bullet_inc.h"
#include "gazebo/physics/bullet/BulletTypes.hh"
#include "gazebo/physics/Link.hh"
#include "gazebo/util/system.hh"
class btRigidBody;
namespace gazebo
{
namespace physics
{
class BulletMotionState;
class GZ_PHYSICS_VISIBLE BulletLink : public Link
{
public: explicit BulletLink(EntityPtr _parent);
public: virtual ~BulletLink();
// Documentation inherited.
public: virtual void Load(sdf::ElementPtr _ptr);
// Documentation inherited.
public: virtual void Init();
// Documentation inherited.
public: virtual void Fini();
// Documentation inherited.
public: virtual void OnPoseChange();
// Documentation inherited.
public: virtual void SetEnabled(bool _enable) const;
// Documentation inherited.
public: virtual bool GetEnabled() const;
// Documentation inherited.
public: virtual void SetLinearVel(const ignition::math::Vector3d &_vel);
// Documentation inherited.
public: virtual void SetAngularVel(const ignition::math::Vector3d &_vel);
// Documentation inherited.
public: virtual void SetForce(const ignition::math::Vector3d &_force);
// Documentation inherited.
public: virtual void SetTorque(const ignition::math::Vector3d &_torque);
// Documentation inherited
public: virtual ignition::math::Vector3d WorldLinearVel(
const ignition::math::Vector3d &_offset) const;
// Documentation inherited
public: virtual ignition::math::Vector3d WorldLinearVel(
const ignition::math::Vector3d &_offset,
const ignition::math::Quaterniond &_q) const;
// Documentation inherited
public: virtual ignition::math::Vector3d WorldCoGLinearVel() const;
// Documentation inherited.
public: virtual ignition::math::Vector3d WorldAngularVel() const;
// Documentation inherited.
public: virtual ignition::math::Vector3d WorldForce() const;
// Documentation inherited.
public: virtual ignition::math::Vector3d WorldTorque() const;
// Documentation inherited.
public: virtual void SetGravityMode(bool _mode);
// Documentation inherited.
public: virtual bool GetGravityMode() const;
// Documentation inherited.
public: virtual void SetSelfCollide(bool _collide);
public: btRigidBody *GetBulletLink() const;
public: void RemoveAndAddBody() const;
public: void ClearCollisionCache();
// Documentation inherited.
public: virtual void SetLinearDamping(double _damping);
// Documentation inherited.
public: virtual void SetAngularDamping(double _damping);
// public: void SetCollisionRelativePose(BulletCollision *collision,
// const ignition::math::Pose3d &newPose);
// Documentation inherited.
public: virtual void AddForce(const ignition::math::Vector3d &_force);
// Documentation inherited.
public: virtual void AddRelativeForce(
const ignition::math::Vector3d &_force);
// Documentation inherited.
public: virtual void AddForceAtWorldPosition(
const ignition::math::Vector3d &_force,
const ignition::math::Vector3d &_pos);
// Documentation inherited.
public: virtual void AddForceAtRelativePosition(
const ignition::math::Vector3d &_force,
const ignition::math::Vector3d &_relpos);
// Documentation inherited
public: virtual void AddLinkForce(
const ignition::math::Vector3d &_force,
const ignition::math::Vector3d &_offset =
ignition::math::Vector3d::Zero);
// Documentation inherited.
public: virtual void AddTorque(const ignition::math::Vector3d &_torque);
// Documentation inherited.
public: virtual void AddRelativeTorque(
const ignition::math::Vector3d &_torque);
// Documentation inherited.
public: virtual void SetAutoDisable(bool _disable);
// Documentation inherited
public: virtual void SetLinkStatic(bool _static);
// Documentation inherited.
public: virtual void UpdateMass();
private: btCollisionShape *compoundShape;
public: BulletMotionStatePtr motionState;
private: btRigidBody *rigidLink;
private: BulletPhysicsPtr bulletPhysics;
};
}
}
#endif
gazebo::physics::BulletLink::SetTorque
virtual void SetTorque(const ignition::math::Vector3d &_torque)
Set the torque applied to the body.
gazebo::physics::Link::WorldLinearVel
virtual ignition::math::Vector3d WorldLinearVel() const
Get the linear velocity of the origin of the link frame, expressed in the world frame.
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
gazebo::physics::BulletLink::RemoveAndAddBody
void RemoveAndAddBody() const
Remove and re-add this rigid body from the world.
gazebo::physics::BulletLink::SetAutoDisable
virtual void SetAutoDisable(bool _disable)
Allow the link to auto disable.
gazebo::physics::BulletLink::SetAngularDamping
virtual void SetAngularDamping(double _damping)
Set the angular damping factor.
gazebo::physics::BulletLink::WorldAngularVel
virtual ignition::math::Vector3d WorldAngularVel() const
Get the angular velocity of the entity in the world frame.
gazebo::physics::BulletLink::WorldCoGLinearVel
virtual ignition::math::Vector3d WorldCoGLinearVel() const
Get the linear velocity at the body's center of gravity in the world frame.
gazebo::physics::BulletLink
Bullet Link class.
Definition: BulletLink.hh:37
Link.hh
gazebo::physics::BulletLink::Load
virtual void Load(sdf::ElementPtr _ptr)
Load the body based on an SDF element.
BulletTypes.hh
Bullet wrapper forward declarations and typedefs.
system.hh
bullet_inc.h
gazebo::physics::BulletLink::SetForce
virtual void SetForce(const ignition::math::Vector3d &_force)
Set the force applied to the body.
gazebo::physics::BulletLink::AddRelativeForce
virtual void AddRelativeForce(const ignition::math::Vector3d &_force)
Add a force to the body, components are relative to the body's own frame of reference.
gazebo::physics::BulletLink::SetSelfCollide
virtual void SetSelfCollide(bool _collide)
Set whether this body will collide with others in the model.
gazebo::physics::BulletLink::GetBulletLink
btRigidBody * GetBulletLink() const
Get the bullet rigid body.
gazebo::physics::BulletPhysicsPtr
boost::shared_ptr< BulletPhysics > BulletPhysicsPtr
Definition: BulletTypes.hh:44
gazebo::physics::BulletLink::WorldForce
virtual ignition::math::Vector3d WorldForce() const
Get the force applied to the body in the world frame.
gazebo::physics::BulletLink::SetGravityMode
virtual void SetGravityMode(bool _mode)
Set whether gravity affects this body.
gazebo::physics::BulletLink::SetLinearVel
virtual void SetLinearVel(const ignition::math::Vector3d &_vel)
Set the linear velocity of the body.
gazebo::physics::BulletLink::SetLinkStatic
virtual void SetLinkStatic(bool _static)
Freeze link to ground (inertial frame).
gazebo::physics::BulletLink::GetGravityMode
virtual bool GetGravityMode() const
Get the gravity mode.
gazebo::physics::BulletLink::OnPoseChange
virtual void OnPoseChange()
This function is called when the entity's (or one of its parents) pose of the parent has changed.
gazebo::physics::Link
Link class defines a rigid body entity, containing information on inertia, visual and collision prope...
Definition: Link.hh:52
gazebo::physics::BulletLink::ClearCollisionCache
void ClearCollisionCache()
gazebo::physics::BulletLink::WorldTorque
virtual ignition::math::Vector3d WorldTorque() const
Get the torque applied to the body about the center of mass in world frame coordinates.
gazebo::physics::BulletLink::Fini
virtual void Fini()
Finalize the entity.
gazebo::physics::BulletLink::Init
virtual void Init()
Initialize the body.
gazebo::physics::BulletLink::AddRelativeTorque
virtual void AddRelativeTorque(const ignition::math::Vector3d &_torque)
Add a torque to the body, components are relative to the body's own frame of reference.
gazebo::physics::BulletLink::AddForceAtWorldPosition
virtual void AddForceAtWorldPosition(const ignition::math::Vector3d &_force, const ignition::math::Vector3d &_pos)
Add a force to the body using a global position.
gazebo::physics::BulletLink::SetEnabled
virtual void SetEnabled(bool _enable) const
Set whether this body is enabled.
gazebo::physics::BulletLink::AddTorque
virtual void AddTorque(const ignition::math::Vector3d &_torque)
Add a torque to the body.
gazebo::msgs::Init
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
gazebo::physics::BulletLink::AddForceAtRelativePosition
virtual void AddForceAtRelativePosition(const ignition::math::Vector3d &_force, const ignition::math::Vector3d &_relpos)
Add a force (in world frame coordinates) to the body at a position relative to the center of mass whi...
gazebo::physics::BulletLink::BulletLink
BulletLink(EntityPtr _parent)
Constructor.
gazebo::physics::BulletLink::~BulletLink
virtual ~BulletLink()
Destructor.
gazebo::physics::EntityPtr
boost::shared_ptr< Entity > EntityPtr
Definition: PhysicsTypes.hh:85
gazebo::physics::BulletLink::SetLinearDamping
virtual void SetLinearDamping(double _damping)
Set the linear damping factor.
gazebo::physics::BulletLink::motionState
BulletMotionStatePtr motionState
Pointer to bullet motion state, which manages updates to the world pose from bullet.
Definition: BulletLink.hh:171
gazebo::physics::BulletLink::AddForce
virtual void AddForce(const ignition::math::Vector3d &_force)
Set the relative pose of a child collision.
gazebo::physics::BulletLink::UpdateMass
virtual void UpdateMass()
Update the mass matrix.
gazebo::physics::BulletMotionStatePtr
boost::shared_ptr< BulletMotionState > BulletMotionStatePtr
Definition: BulletTypes.hh:43
gazebo::physics::BulletLink::AddLinkForce
virtual void AddLinkForce(const ignition::math::Vector3d &_force, const ignition::math::Vector3d &_offset=ignition::math::Vector3d::Zero)
Add a force expressed in the link frame.
gazebo::physics::BulletLink::SetAngularVel
virtual void SetAngularVel(const ignition::math::Vector3d &_vel)
Set the angular velocity of the body.
gazebo::physics::BulletLink::GetEnabled
virtual bool GetEnabled() const
Get whether this body is enabled in the physics engine.