Skip to content

Commit

Permalink
resolve conflicts
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Chen <[email protected]>
  • Loading branch information
iche033 committed Dec 20, 2024
1 parent 146aad2 commit 8f97f7e
Showing 1 changed file with 7 additions and 48 deletions.
55 changes: 7 additions & 48 deletions dartsim/src/GzCollisionDetector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,55 +33,7 @@ GzCollisionDetector::GzCollisionDetector()
}

/////////////////////////////////////////////////
<<<<<<< HEAD:dartsim/src/GzOdeCollisionDetector.cc
GzOdeCollisionDetector::Registrar<GzOdeCollisionDetector>
GzOdeCollisionDetector::mRegistrar{
GzOdeCollisionDetector::getStaticType(),
[]() -> std::shared_ptr<GzOdeCollisionDetector> {
return GzOdeCollisionDetector::create();
}};

/////////////////////////////////////////////////
std::shared_ptr<GzOdeCollisionDetector> 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<std::mutex> lock(odeInitMutex);
return std::shared_ptr<GzOdeCollisionDetector>(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;
Expand Down Expand Up @@ -164,6 +116,13 @@ GzOdeCollisionDetector::Registrar<GzOdeCollisionDetector>
/////////////////////////////////////////////////
std::shared_ptr<GzOdeCollisionDetector> 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<std::mutex> lock(odeInitMutex);
return std::shared_ptr<GzOdeCollisionDetector>(new GzOdeCollisionDetector());
}

Expand Down

0 comments on commit 8f97f7e

Please sign in to comment.