17 #ifndef GAZEBO_PHYSICS_BULLET_BULLETCYLINDERSHAPE_HH_
18 #define GAZEBO_PHYSICS_BULLET_BULLETCYLINDERSHAPE_HH_
46 public:
void SetSize(
double _radius,
double _length)
50 gzerr <<
"Cylinder shape does not support negative radius\n";
55 gzerr <<
"Cylinder shape does not support negative length\n";
58 if (ignition::math::equal(_radius, 0.0))
63 gzwarn <<
"Setting cylinder shape's radius to zero \n";
66 if (ignition::math::equal(_length, 0.0))
68 gzwarn <<
"Setting cylinder shape's length to zero \n";
75 this->collisionParent);
81 ignition::math::Vector3d(_radius, _radius, _length);
82 bParent->SetCollisionShape(
new btCylinderShapeZ(
83 btVector3(_radius, _radius, _length * 0.5)));
87 btVector3 cylinderScale;
88 cylinderScale.setX(_radius / this->initialSize.X());
89 cylinderScale.setY(_radius / this->initialSize.Y());
90 cylinderScale.setZ(_length / this->initialSize.Z());
92 shape->setLocalScaling(cylinderScale);
102 if (bLink->GetBulletLink()->getCollisionShape()->isCompound())
104 btCompoundShape *compoundShape =
105 dynamic_cast<btCompoundShape *
>(
106 bLink->GetBulletLink()->getCollisionShape());
108 compoundShape->removeChildShape(shape);
109 ignition::math::Pose3d relativePose =
110 this->collisionParent->RelativePose()
111 - bLink->GetInertial()->Pose();
112 compoundShape->addChildShape(
119 private: ignition::math::Vector3d initialSize;
Bullet collisions.
Definition: BulletCollision.hh:43
Bullet Link class.
Definition: BulletLink.hh:37
static btTransform ConvertPose(const ignition::math::Pose3d &_pose)
Convert an ignition math pose to a bullet transform.
Definition: BulletTypes.hh:111
Cylinder collision.
Definition: CylinderShape.hh:38
boost::shared_ptr< BulletCollision > BulletCollisionPtr
Definition: BulletTypes.hh:39
Cylinder collision.
Definition: BulletCylinderShape.hh:34
#define gzwarn
Output a warning message.
Definition: Console.hh:47
#define gzerr
Output an error message.
Definition: Console.hh:50
virtual ~BulletCylinderShape()
Destructor.
Definition: BulletCylinderShape.hh:41
boost::shared_ptr< BulletLink > BulletLinkPtr
Definition: BulletTypes.hh:42
virtual void SetSize(double _radius, double _length)
Set the size of the cylinder.
btCollisionShape * GetCollisionShape() const
Get the bullet collision shape.
void SetSize(double _radius, double _length)
Set the size of the cylinder.
Definition: BulletCylinderShape.hh:46
BulletCylinderShape(CollisionPtr _parent)
Constructor.
Definition: BulletCylinderShape.hh:37
void ClearCollisionCache()
boost::shared_ptr< Collision > CollisionPtr
Definition: PhysicsTypes.hh:113