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
boost::shared_ptr< BulletLink > BulletLinkPtr
Definition: BulletTypes.hh:43
Bullet Link class.
Definition: BulletLink.hh:44
#define GZ_PHYSICS_VISIBLE
Definition: system.hh:259
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
void SetSize(double _radius, double _length)
Set the size of the cylinder.
Definition: BulletCylinderShape.hh:51
btCollisionShape * GetCollisionShape() const
Get the bullet collision shape.
Cylinder collision.
Definition: CylinderShape.hh:43
virtual void SetSize(double _radius, double _length)
Set the size of the cylinder.
Cylinder collision.
Definition: BulletCylinderShape.hh:39
#define gzwarn
Output a warning message.
Definition: Console.hh:46
virtual ~BulletCylinderShape()
Destructor.
Definition: BulletCylinderShape.hh:46
#define gzerr
Output an error message.
Definition: Console.hh:49
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
boost::shared_ptr< Collision > CollisionPtr
Definition: PhysicsTypes.hh:104
static math::Pose ConvertPose(const btTransform &_bt)
Convert a bullet transform to a gazebo pose.
Definition: BulletTypes.hh:92
Vector3 pos
The position.
Definition: Pose.hh:252
void ClearCollisionCache()
boost::shared_ptr< BulletCollision > BulletCollisionPtr
Definition: BulletTypes.hh:40
BulletCylinderShape(CollisionPtr _parent)
Constructor.
Definition: BulletCylinderShape.hh:42