From b7c1c9b189819a5cf970db0f528ef5504376b649 Mon Sep 17 00:00:00 2001 From: Ian Chen Date: Fri, 20 Dec 2024 21:08:49 +0000 Subject: [PATCH] resolve conflicts Signed-off-by: Ian Chen --- dartsim/src/GzCollisionDetector.cc | 55 ++++-------------------------- 1 file changed, 7 insertions(+), 48 deletions(-) diff --git a/dartsim/src/GzCollisionDetector.cc b/dartsim/src/GzCollisionDetector.cc index 80be800c3..e32403525 100644 --- a/dartsim/src/GzCollisionDetector.cc +++ b/dartsim/src/GzCollisionDetector.cc @@ -33,55 +33,7 @@ GzCollisionDetector::GzCollisionDetector() } ///////////////////////////////////////////////// -<<<<<<< HEAD:dartsim/src/GzOdeCollisionDetector.cc -GzOdeCollisionDetector::Registrar - GzOdeCollisionDetector::mRegistrar{ - GzOdeCollisionDetector::getStaticType(), - []() -> std::shared_ptr { - return GzOdeCollisionDetector::create(); - }}; - -///////////////////////////////////////////////// -std::shared_ptr GzOdeCollisionDetector::create() -{ - // GzOdeCollisionDetector constructor calls the OdeCollisionDetector - // constructor, that calls the non-thread safe dInitODE2(0). - // To mitigate this problem, we use a static mutex to ensure that - // each GzOdeCollisionDetector constructor is called not at the same time. - // See https://github.com/gazebosim/gz-sim/issues/18 for more info. - static std::mutex odeInitMutex; - std::unique_lock lock(odeInitMutex); - return std::shared_ptr(new GzOdeCollisionDetector()); -} - -///////////////////////////////////////////////// -bool GzOdeCollisionDetector::collide( - CollisionGroup *_group, - const CollisionOption &_option, - CollisionResult *_result) -{ - bool ret = OdeCollisionDetector::collide(_group, _option, _result); - this->LimitCollisionPairMaxContacts(_result); - return ret; -} - -///////////////////////////////////////////////// -bool GzOdeCollisionDetector::collide( - CollisionGroup *_group1, - CollisionGroup *_group2, - const CollisionOption &_option, - CollisionResult *_result) -{ - bool ret = OdeCollisionDetector::collide(_group1, _group2, _option, _result); - this->LimitCollisionPairMaxContacts(_result); - return ret; -} - -///////////////////////////////////////////////// -void GzOdeCollisionDetector::SetCollisionPairMaxContacts( -======= void GzCollisionDetector::SetCollisionPairMaxContacts( ->>>>>>> a4eee2f (Support setting max contacts in dart's bullet collision detector (#593)):dartsim/src/GzCollisionDetector.cc std::size_t _maxContacts) { this->maxCollisionPairContacts = _maxContacts; @@ -164,6 +116,13 @@ GzOdeCollisionDetector::Registrar ///////////////////////////////////////////////// std::shared_ptr GzOdeCollisionDetector::create() { + // GzOdeCollisionDetector constructor calls the OdeCollisionDetector + // constructor, that calls the non-thread safe dInitODE2(0). + // To mitigate this problem, we use a static mutex to ensure that + // each GzOdeCollisionDetector constructor is called not at the same time. + // See https://github.com/gazebosim/gz-sim/issues/18 for more info. + static std::mutex odeInitMutex; + std::unique_lock lock(odeInitMutex); return std::shared_ptr(new GzOdeCollisionDetector()); }