##

BulletTypes.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_BULLETTYPES_HH_
#define GAZEBO_PHYSICS_BULLET_BULLETTYPES_HH_
#include <boost/shared_ptr.hpp>
#include <ignition/math/Vector4.hh>
#include "gazebo/physics/bullet/bullet_math_inc.h"
#include "gazebo/util/system.hh"
namespace gazebo
{
namespace physics
{
class BulletCollision;
class BulletLink;
class BulletMotionState;
class BulletPhysics;
class BulletRayShape;
class BulletSurfaceParams;
typedef boost::shared_ptr<BulletCollision> BulletCollisionPtr;
typedef boost::shared_ptr<BulletLink> BulletLinkPtr;
typedef boost::shared_ptr<BulletMotionState> BulletMotionStatePtr;
typedef boost::shared_ptr<BulletPhysics> BulletPhysicsPtr;
typedef boost::shared_ptr<BulletRayShape> BulletRayShapePtr;
typedef boost::shared_ptr<BulletSurfaceParams> BulletSurfaceParamsPtr;
class GZ_PHYSICS_VISIBLE BulletTypes {
public: static ignition::math::Vector3d ConvertVector3Ign(
const btVector3 &_bt)
{
return ignition::math::Vector3d(
_bt.getX(), _bt.getY(), _bt.getZ());
}
public: static btVector3 ConvertVector3(
const ignition::math::Vector3d &_vec)
{
return btVector3(_vec.X(), _vec.Y(), _vec.Z());
}
public: static ignition::math::Vector4d ConvertVector4dIgn(
const btVector4 &_bt)
{
return ignition::math::Vector4d(_bt.getX(), _bt.getY(),
_bt.getZ(), _bt.getW());
}
public: static btVector4 ConvertVector4dIgn(
const ignition::math::Vector4d &_vec)
{
return btVector4(_vec.X(), _vec.Y(), _vec.Z(), _vec.W());
}
public: static ignition::math::Pose3d ConvertPoseIgn(
const btTransform &_bt)
{
ignition::math::Pose3d pose;
pose.Pos() = ConvertVector3Ign(_bt.getOrigin());
pose.Rot().W() = _bt.getRotation().getW();
pose.Rot().X() = _bt.getRotation().getX();
pose.Rot().Y() = _bt.getRotation().getY();
pose.Rot().Z() = _bt.getRotation().getZ();
return pose;
}
public: static btTransform ConvertPose(
const ignition::math::Pose3d &_pose)
{
btTransform trans;
trans.setOrigin(ConvertVector3(_pose.Pos()));
trans.setRotation(btQuaternion(_pose.Rot().X(), _pose.Rot().Y(),
_pose.Rot().Z(), _pose.Rot().W()));
return trans;
}
};
}
}
#endif
gazebo::physics::BulletTypes::ConvertVector4dIgn
static btVector4 ConvertVector4dIgn(const ignition::math::Vector4d &_vec)
Convert an ignition math Vector4d to a bullet btVector4.
Definition: BulletTypes.hh:87
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
gazebo::physics::BulletCollisionPtr
boost::shared_ptr< BulletCollision > BulletCollisionPtr
Definition: BulletTypes.hh:39
gazebo::physics::BulletLinkPtr
boost::shared_ptr< BulletLink > BulletLinkPtr
Definition: BulletTypes.hh:42
gazebo::physics::BulletTypes::ConvertPose
static btTransform ConvertPose(const ignition::math::Pose3d &_pose)
Convert an ignition math pose to a bullet transform.
Definition: BulletTypes.hh:111
system.hh
bullet_math_inc.h
gazebo::physics::BulletPhysicsPtr
boost::shared_ptr< BulletPhysics > BulletPhysicsPtr
Definition: BulletTypes.hh:44
gazebo::physics::BulletTypes::ConvertVector4dIgn
static ignition::math::Vector4d ConvertVector4dIgn(const btVector4 &_bt)
Convert a bullet btVector4 to an ignition math Vector4d.
Definition: BulletTypes.hh:77
gazebo::physics::BulletTypes::ConvertPoseIgn
static ignition::math::Pose3d ConvertPoseIgn(const btTransform &_bt)
Convert a bullet transform to an ignition math pose.
Definition: BulletTypes.hh:96
gazebo::physics::BulletSurfaceParamsPtr
boost::shared_ptr< BulletSurfaceParams > BulletSurfaceParamsPtr
Definition: BulletTypes.hh:46
gazebo::physics::BulletRayShapePtr
boost::shared_ptr< BulletRayShape > BulletRayShapePtr
Definition: BulletTypes.hh:45
gazebo::physics::BulletTypes::ConvertVector3Ign
static ignition::math::Vector3d ConvertVector3Ign(const btVector3 &_bt)
Convert a bullet btVector3 to an ignition Vector3d.
Definition: BulletTypes.hh:58
gazebo::physics::BulletTypes
A set of functions for converting between the math types used by gazebo and bullet.
Definition: BulletTypes.hh:54
gazebo::physics::BulletSurfaceParams
Bullet surface parameters.
Definition: BulletSurfaceParams.hh:35
gazebo::physics::BulletTypes::ConvertVector3
static btVector3 ConvertVector3(const ignition::math::Vector3d &_vec)
Convert an ignition Vector3d to a bullet btVector3.
Definition: BulletTypes.hh:68
gazebo::physics::BulletMotionStatePtr
boost::shared_ptr< BulletMotionState > BulletMotionStatePtr
Definition: BulletTypes.hh:43