Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge 7 -> main #604

Merged
merged 30 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
eb291a9
dartsim: fix handling inertia matrix pose rotation (#351)
scpeters Aug 1, 2022
f057341
Update github action workflows (#572)
azeey Nov 13, 2023
0e3858c
Merge remote-tracking branch 'origin/ign-physics2' into azeey/2_to_5
azeey Nov 14, 2023
6308155
port: 2 to 5 (#575)
mjcarroll Nov 14, 2023
af58fa5
CI workflow: use 22.04 for codecheck, coverage (#578)
scpeters Nov 20, 2023
5b74d1f
bullet-featherstone: Set collision spinning friction (#579)
iche033 Dec 7, 2023
216f174
Reduce error to debug messsage for mesh construction (#531) (#581)
iche033 Dec 11, 2023
32bef6d
Update CI badges in README (#583)
iche033 Dec 21, 2023
a2e14cf
Prepare for 2.6.2 release (#585)
azeey Jan 6, 2024
aa47956
Merge 2 to 5
azeey Jan 12, 2024
e20b0d1
Merge pull request #589 from azeey/2_to_5
azeey Jan 12, 2024
4fa59f2
Merge 5 into 6
azeey Jan 18, 2024
ce40465
Get bullet version from cmake instead of API (#591)
scpeters Jan 19, 2024
0fc25a9
Merge pull request #590 from azeey/5_to_6
scpeters Jan 19, 2024
97d50cb
Merge branch 'gz-physics6' into 6_to_7
caguero Jan 26, 2024
5f73faf
Merge pull request #592 from gazebosim/6_to_7
scpeters Jan 26, 2024
5367620
Support setting max contacts in dartsim's ODE collision detector (#582)
iche033 Jan 30, 2024
8e1aca6
Garden test cleanup (#587)
mjcarroll Jan 30, 2024
1016539
bazel: updates for garden (#513)
mjcarroll Jan 31, 2024
bc37884
Merge branch 'gz-physics6' into 6_to_7again
caguero Feb 3, 2024
3327fec
Update physics7 test for common worlds
mjcarroll Feb 6, 2024
ce205ac
Update Worlds.hh: fix world name
scpeters Feb 6, 2024
ea90ada
Revert "bazel: updates for garden (#513)"
mjcarroll Feb 6, 2024
cd290e0
Merge branch 'gz-physics6' into 6_to_7again
mjcarroll Feb 6, 2024
23a9109
Merge 6 ➡️ 7 (#594)
mjcarroll Feb 15, 2024
18e0dad
bullet-featherstone: Support nested models (#574)
iche033 Mar 6, 2024
e42cf34
bullet-featherstone: Improve mesh collision stability (#600)
iche033 Mar 7, 2024
92e02c3
Merge branch 'gz-physics6' into merge_6_7_20240306
iche033 Mar 7, 2024
b312755
Merge pull request #602 from gazebosim/merge_6_7_20240306
scpeters Mar 7, 2024
1b247ba
merge from gz-physics7
iche033 Mar 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
name: Ubuntu CI

on: [push, pull_request]
on:
pull_request:
push:
branches:
- 'ign-physics[0-9]'
- 'gz-physics[0-9]?'
- 'main'

jobs:
jammy-ci:
runs-on: ubuntu-latest
name: Ubuntu Jammy CI
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Compile and test
id: ci
uses: gazebo-tooling/action-gz-ci@jammy
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/triage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@ jobs:
with:
project-url: https://github.com/orgs/gazebosim/projects/7
github-token: ${{ secrets.TRIAGE_TOKEN }}

5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ gz_find_package(gz-common6
REQUIRED_BY heightmap mesh dartsim tpe tpelib bullet)
set(GZ_COMMON_VER ${gz-common6_VERSION_MAJOR})

# This is only used for test support
gz_find_package(gz-common6 REQUIRED COMPONENTS testing)

#--------------------------------------
# Find gz-math
gz_find_package(gz-math8 REQUIRED COMPONENTS eigen3)
Expand Down Expand Up @@ -90,8 +93,6 @@ gz_find_package(GzBullet

message(STATUS "-------------------------------------------\n")

set(GZ_PHYSICS_RESOURCE_DIR "${CMAKE_SOURCE_DIR}/resources")

# Plugin install dirs
set(GZ_PHYSICS_ENGINE_RELATIVE_INSTALL_DIR
${GZ_LIB_INSTALL_DIR}/gz-${GZ_DESIGNATION}-${PROJECT_VERSION_MAJOR}/engine-plugins
Expand Down
13 changes: 13 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,19 @@

## Gazebo Physics 2.x

### Gazebo Physics 2.6.2 (2024-01-05)

1. dartsim: fix handling inertia matrix pose rotation
* [Pull request #351](https://github.com/gazebosim/gz-physics/pull/351)

1. Fix a crash due to an invalid pointer
* [Pull request #486](https://github.com/gazebosim/gz-physics/pull/486)

1. Infrastructure
* [Pull request #488](https://github.com/gazebosim/gz-physics/pull/488)
* [Pull request #487](https://github.com/gazebosim/gz-physics/pull/487)
* [Pull request #572](https://github.com/gazebosim/gz-physics/pull/572)

### Gazebo Physics 2.6.1 (2023-01-09)

1. Fix build errors and warnings for DART 6.13.0
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

Build | Status
-- | --
Test coverage | [![codecov](https://codecov.io/gh/gazebosim/gz-physics/branch/gz-physics8/graph/badge.svg)](https://codecov.io/gh/gazebosim/gz-physics/branch/gz-physics8)
Ubuntu Focal | [![Build Status](https://build.osrfoundation.org/buildStatus/icon?job=ignition_physics-ci-gz-physics8-focal-amd64)](https://build.osrfoundation.org/job/ignition_physics-ci-gz-physics8-focal-amd64)
Homebrew | [![Build Status](https://build.osrfoundation.org/buildStatus/icon?job=ignition_physics-ci-gz-physics8-homebrew-amd64)](https://build.osrfoundation.org/job/ignition_physics-ci-gz-physics8-homebrew-amd64)
Windows | [![Build Status](https://build.osrfoundation.org/buildStatus/icon?job=ign_physics-gz-8-win)](https://build.osrfoundation.org/job/ign_physics-gz-8-win)
Test coverage | [![codecov](https://codecov.io/gh/gazebosim/gz-physics/tree/gz-physics8/graph/badge.svg)](https://codecov.io/gh/gazebosim/gz-physics/tree/gz-physics8)
Ubuntu Jammy | [![Build Status](https://build.osrfoundation.org/buildStatus/icon?job=gz_physics-ci-gz-physics8-jammy-amd64)](https://build.osrfoundation.org/job/gz_physics-ci-gz-physics8-jammy-amd64)
Homebrew | [![Build Status](https://build.osrfoundation.org/buildStatus/icon?job=gz_physics-ci-gz-physics8-homebrew-amd64)](https://build.osrfoundation.org/job/gz_physics-ci-gz-physics8-homebrew-amd64)
Windows | [![Build Status](https://build.osrfoundation.org/buildStatus/icon?job=gz_physics-8-win)](https://build.osrfoundation.org/job/gz_physics-8-win)

Gazebo Physics, a component of [Gazebo](https://gazebosim.org), provides an abstract physics interface
designed to support simulation and rapid development of robot applications.
Expand Down
7 changes: 7 additions & 0 deletions bullet-featherstone/src/Base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ WorldInfo::WorldInfo(std::string name_)
// Needed for force-torque sensor
this->world->getSolverInfo().m_jointFeedbackInJointFrame = true;
this->world->getSolverInfo().m_jointFeedbackInWorldSpace = false;

// By default a large impulse is applied when collisions penetrate
// which causes unstable behavior. Bullet featherstone does not support
// configuring split impulse and penetration threshold parameters. Instead the
// penentration impulse depends on the erp2 parameter so set to a small value
// (default is 0.2).
this->world->getSolverInfo().m_erp2 = btScalar(0.002);
}

} // namespace bullet_featherstone
Expand Down
145 changes: 134 additions & 11 deletions bullet-featherstone/src/Base.hh
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,14 @@
Identity world;
int indexInWorld;
Eigen::Isometry3d baseInertiaToLinkFrame;
std::unique_ptr<btMultiBody> body;
std::shared_ptr<btMultiBody> body;

std::vector<std::size_t> linkEntityIds;
std::vector<std::size_t> jointEntityIds;
std::vector<std::size_t> nestedModelEntityIds;
std::unordered_map<std::string, std::size_t> linkNameToEntityId;
std::unordered_map<std::string, std::size_t> jointNameToEntityId;
std::unordered_map<std::string, std::size_t> nestedModelNameToEntityId;

/// These are joints that connect this model to other models, e.g. fixed
/// constraints.
Expand All @@ -100,7 +102,7 @@
std::string _name,
Identity _world,
Eigen::Isometry3d _baseInertiaToLinkFrame,
std::unique_ptr<btMultiBody> _body)
std::shared_ptr<btMultiBody> _body)
: name(std::move(_name)),
world(std::move(_world)),
baseInertiaToLinkFrame(_baseInertiaToLinkFrame),
Expand Down Expand Up @@ -275,14 +277,24 @@
const auto id = this->GetNextEntity();
auto world = std::make_shared<WorldInfo>(std::move(_worldInfo));
this->worlds[id] = world;
return this->GenerateIdentity(id, world);
auto worldID = this->GenerateIdentity(id, world);

auto worldModel = std::make_shared<ModelInfo>(
world->name, worldID,
Eigen::Isometry3d::Identity(), nullptr);
this->models[id] = worldModel;
world->modelNameToEntityId[worldModel->name] = id;
worldModel->indexInWorld = -1;
world->modelIndexToEntityId[worldModel->indexInWorld] = id;

return worldID;
}

public: inline Identity AddModel(
std::string _name,
Identity _worldID,
Eigen::Isometry3d _baseInertialToLinkFrame,
std::unique_ptr<btMultiBody> _body)
std::shared_ptr<btMultiBody> _body)
{
const auto id = this->GetNextEntity();
auto model = std::make_shared<ModelInfo>(
Expand All @@ -294,6 +306,30 @@
world->modelNameToEntityId[model->name] = id;
model->indexInWorld = world->nextModelIndex++;
world->modelIndexToEntityId[model->indexInWorld] = id;

auto worldModel = this->models.at(model->world);
worldModel->nestedModelEntityIds.push_back(id);
worldModel->nestedModelNameToEntityId[model->name] = id;

return this->GenerateIdentity(id, model);
}

public: inline Identity AddNestedModel(
std::string _name,
Identity _parentID,
Identity _worldID,
Eigen::Isometry3d _baseInertialToLinkFrame,
std::shared_ptr<btMultiBody> _body)
{
const auto id = this->GetNextEntity();
auto model = std::make_shared<ModelInfo>(
std::move(_name), std::move(_worldID),
std::move(_baseInertialToLinkFrame), std::move(_body));

this->models[id] = model;
const auto parentModel = this->models.at(_parentID);
parentModel->nestedModelEntityIds.push_back(id);
parentModel->nestedModelNameToEntityId[model->name] = id;
return this->GenerateIdentity(id, model);
}

Expand All @@ -305,13 +341,7 @@

auto *model = this->ReferenceInterface<ModelInfo>(_linkInfo.model);
model->linkNameToEntityId[link->name] = id;
if (link->indexInModel.has_value())
{
// We expect the links to be added in order
assert(static_cast<std::size_t>(*link->indexInModel + 1) ==
model->linkEntityIds.size());
}
else
if (!link->indexInModel.has_value())
{
// We are adding the root link. This means the model should not already
// have a root link
Expand Down Expand Up @@ -359,6 +389,99 @@
return this->GenerateIdentity(id, joint);
}

public: bool RemoveModelImpl(const Identity &_parentID,
const Identity &_modelID)
{
auto *model = this->ReferenceInterface<ModelInfo>(_modelID);
if (!model)
return false;

Check warning on line 397 in bullet-featherstone/src/Base.hh

View check run for this annotation

Codecov / codecov/patch

bullet-featherstone/src/Base.hh#L397

Added line #L397 was not covered by tests

// Remove nested models
for (auto &nestedModelID : model->nestedModelEntityIds)
{
this->RemoveModelImpl(_modelID, this->GenerateIdentity(nestedModelID,
this->models.at(nestedModelID)));
}
model->nestedModelEntityIds.clear();

// remove references in parent model or world model
auto parentModelIt = this->models.find(_parentID);
if (parentModelIt != this->models.end())
{
auto parentModel = parentModelIt->second;
auto nestedModelIt =
parentModel->nestedModelNameToEntityId.find(model->name);
if (nestedModelIt !=
parentModel->nestedModelNameToEntityId.end())
{
std::size_t nestedModelID = nestedModelIt->second;
parentModel->nestedModelNameToEntityId.erase(nestedModelIt);
parentModel->nestedModelEntityIds.erase(std::remove(
parentModel->nestedModelEntityIds.begin(),
parentModel->nestedModelEntityIds.end(), nestedModelID),
parentModel->nestedModelEntityIds.end());
}
}

// If nested, no need to remove multibody
// \todo(iche033) Remove links and joints in nested model
bool isNested = this->worlds.find(_parentID) == this->worlds.end();
if (isNested)
{
return true;
}

// Remove model from world
auto *world = this->ReferenceInterface<WorldInfo>(model->world);
if (!world)
return false;

Check warning on line 437 in bullet-featherstone/src/Base.hh

View check run for this annotation

Codecov / codecov/patch

bullet-featherstone/src/Base.hh#L437

Added line #L437 was not covered by tests
if (world->modelIndexToEntityId.erase(model->indexInWorld) == 0)
{
// The model has already been removed at some point
return false;

Check warning on line 441 in bullet-featherstone/src/Base.hh

View check run for this annotation

Codecov / codecov/patch

bullet-featherstone/src/Base.hh#L441

Added line #L441 was not covered by tests
}
world->modelNameToEntityId.erase(model->name);

// Remove all constraints related to this model
for (const auto jointID : model->jointEntityIds)
{
const auto joint = this->joints.at(jointID);
if (joint->motor)
{
world->world->removeMultiBodyConstraint(joint->motor.get());

Check warning on line 451 in bullet-featherstone/src/Base.hh

View check run for this annotation

Codecov / codecov/patch

bullet-featherstone/src/Base.hh#L451

Added line #L451 was not covered by tests
}
if (joint->fixedConstraint)
{
world->world->removeMultiBodyConstraint(joint->fixedConstraint.get());

Check warning on line 455 in bullet-featherstone/src/Base.hh

View check run for this annotation

Codecov / codecov/patch

bullet-featherstone/src/Base.hh#L455

Added line #L455 was not covered by tests
}
if (joint->jointLimits)
{
world->world->removeMultiBodyConstraint(joint->jointLimits.get());
}
this->joints.erase(jointID);
}
// \todo(iche033) Remove external constraints related to this model
// (model->external_constraints) once this is supported

world->world->removeMultiBody(model->body.get());
for (const auto linkID : model->linkEntityIds)
{
const auto &link = this->links.at(linkID);
if (link->collider)
{
world->world->removeCollisionObject(link->collider.get());
for (const auto shapeID : link->collisionEntityIds)
this->collisions.erase(shapeID);
}

this->links.erase(linkID);
}

this->models.erase(_modelID);

return true;
}

public: ~Base() override {
// The order of destruction between meshesGImpact and triangleMeshes is
// important.
Expand Down
Loading