22 #ifndef _BULLETCYLINDERSHAPE_HH_
23 #define _BULLETCYLINDERSHAPE_HH_
51 public:
void SetSize(
double _radius,
double _length)
55 gzerr <<
"Cylinder shape does not support negative radius\n";
60 gzerr <<
"Cylinder shape does not support negative length\n";
68 gzwarn <<
"Setting cylinder shape's radius to zero \n";
73 gzwarn <<
"Setting cylinder shape's length to zero \n";
80 this->collisionParent);
86 bParent->SetCollisionShape(
new btCylinderShapeZ(
87 btVector3(_radius, _radius, _length * 0.5)));
91 btVector3 cylinderScale;
92 cylinderScale.setX(_radius / this->initialSize.x);
93 cylinderScale.setY(_radius / this->initialSize.y);
94 cylinderScale.setZ(_length / this->initialSize.z);
96 shape->setLocalScaling(cylinderScale);
106 if (bLink->GetBulletLink()->getCollisionShape()->isCompound())
108 btCompoundShape *compoundShape =
109 dynamic_cast<btCompoundShape *
>(
110 bLink->GetBulletLink()->getCollisionShape());
112 compoundShape->removeChildShape(shape);
114 this->collisionParent->GetRelativePose();
115 relativePose.
pos -= bLink->GetInertial()->GetCoG();
116 compoundShape->addChildShape(
Bullet collisions.
Definition: BulletCollision.hh:53
Bullet Link class.
Definition: BulletLink.hh:42
Encapsulates a position and rotation in three space.
Definition: Pose.hh:37
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:39
Cylinder collision.
Definition: CylinderShape.hh:43
boost::shared_ptr< BulletCollision > BulletCollisionPtr
Definition: BulletTypes.hh:40
Cylinder collision.
Definition: BulletCylinderShape.hh:39
#define gzwarn
Output a warning message.
Definition: Console.hh:47
#define gzerr
Output an error message.
Definition: Console.hh:50
bool equal(const T &_a, const T &_b, const T &_epsilon=1e-6)
check if two values are equal, within a tolerance
Definition: Helpers.hh:171
virtual ~BulletCylinderShape()
Destructor.
Definition: BulletCylinderShape.hh:46
static math::Pose ConvertPose(const btTransform &_bt)
Convert a bullet transform to a gazebo pose.
Definition: BulletTypes.hh:92
boost::shared_ptr< BulletLink > BulletLinkPtr
Definition: BulletTypes.hh:43
virtual void SetSize(double _radius, double _length)
Set the size of the cylinder.
btCollisionShape * GetCollisionShape() const
Get the bullet collision shape.
Vector3 pos
The position.
Definition: Pose.hh:252
void SetSize(double _radius, double _length)
Set the size of the cylinder.
Definition: BulletCylinderShape.hh:51
BulletCylinderShape(CollisionPtr _parent)
Constructor.
Definition: BulletCylinderShape.hh:42
void ClearCollisionCache()
boost::shared_ptr< Collision > CollisionPtr
Definition: PhysicsTypes.hh:113