Skip to content

Commit

Permalink
fix test on jammy
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Chen <ichen@openrobotics.org>
  • Loading branch information
iche033 committed Jul 9, 2024
1 parent bbcd8a5 commit f1bd5b9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
11 changes: 8 additions & 3 deletions bullet-featherstone/src/SDFFeatures.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1294,9 +1294,9 @@ bool SDFFeatures::AddSdfCollision(

if (!linkInfo->collider)
{
this->CreateLinkCollider(_linkID, _isStatic);
this->CreateLinkCollider(_linkID, _isStatic, shape.get(),
btInertialToCollision);

linkInfo->shape->addChildShape(btInertialToCollision, shape.get());
linkInfo->collider->setRestitution(static_cast<btScalar>(restitution));
linkInfo->collider->setRollingFriction(
static_cast<btScalar>(rollingFriction));
Expand Down Expand Up @@ -1437,7 +1437,8 @@ Identity SDFFeatures::ConstructSdfJoint(
}

/////////////////////////////////////////////////
void SDFFeatures::CreateLinkCollider(const Identity &_linkID, bool _isStatic)
void SDFFeatures::CreateLinkCollider(const Identity &_linkID, bool _isStatic,
btCollisionShape *_shape, const btTransform &_shapeTF)
{
auto *linkInfo = this->ReferenceInterface<LinkInfo>(_linkID);
auto *modelInfo = this->ReferenceInterface<ModelInfo>(linkInfo->model);
Expand All @@ -1450,6 +1451,10 @@ void SDFFeatures::CreateLinkCollider(const Identity &_linkID, bool _isStatic)
modelInfo->body.get(), linkIndexInModel);

linkInfo->shape = std::make_unique<btCompoundShape>();

if (_shape)
linkInfo->shape->addChildShape(_shapeTF, _shape);

linkInfo->collider->setCollisionShape(linkInfo->shape.get());

if (linkIndexInModel >= 0)
Expand Down
3 changes: 2 additions & 1 deletion bullet-featherstone/src/SDFFeatures.hh
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ class SDFFeatures :
/// \param[in] _isStatic True if the link is static
/// \param[in] _shape Collision shape to attach to link
private: void CreateLinkCollider(const Identity &_linkID,
bool _isStatic);
bool _isStatic, btCollisionShape *_shape = nullptr,
const btTransform &_shapeTF = btTransform::getIdentity());
};

} // namespace bullet_featherstone
Expand Down

0 comments on commit f1bd5b9

Please sign in to comment.