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

Bump to 2.1 ⬆️ #54

Merged
merged 30 commits into from
May 8, 2020
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
7a763b6
Introducing AttachPlaneShape feature
mxgrey Jan 14, 2019
36b82b6
Syntax corrections
mxgrey Feb 4, 2019
43b0611
merge + implement PlaneShape features for dartsim wrapper
mxgrey Feb 4, 2019
e98802f
Adding test for mesh-plane collisions
mxgrey Feb 7, 2019
06ac269
Finish test for plane features
mxgrey Feb 8, 2019
4aa9cef
Fix conflict
mxgrey Feb 8, 2019
0a1a685
Merged default into use_ode_collision_detection
scpeters Feb 13, 2019
33701d7
fix whitespace
scpeters Feb 14, 2019
ab696c2
Merge from ign-physics1
azeey Apr 10, 2020
e796905
Bump to 1.7.0
chapulina Apr 13, 2020
45055e8
Close branch bump_1.7.0
chapulina Apr 13, 2020
46eddd8
Merged in bump_1.7.0 (pull request #137)
chapulina Apr 13, 2020
ac4843a
Added tag ignition-physics_1.7.0 for changeset 90e58cd7ba26
chapulina Apr 13, 2020
79acf71
Use LinearVector for the normal vector of planes
azeey Apr 13, 2020
f5e20fe
Update function documentation, remove unnecessary include
azeey Apr 13, 2020
5d260ab
Close branch use_ode_collision_detection
scpeters Apr 14, 2020
18c5e89
Merged in use_ode_collision_detection (pull request #66)
scpeters Apr 14, 2020
0a47f8a
add .gitignore from .hgignore
Apr 17, 2020
30b0048
remove hg syntax and add comment
Apr 17, 2020
4496acd
[ign-physics1] Update BitBucket links (#33)
chapulina Apr 21, 2020
6f03a08
Fix collision issue with detachable joints (#31)
azeey Apr 23, 2020
520f6f0
Add CODEOWNERS (cherry-pick of #43) (#48)
scpeters Apr 30, 2020
a051f07
[ign-physics1] Workflow updates (#51)
chapulina May 4, 2020
192f11b
Merged from ign-physics1
chapulina May 7, 2020
56adc6d
Version and changelog
chapulina May 7, 2020
956aa47
more changelog
chapulina May 7, 2020
c28c24f
Add extra changelog entry merged from 1.x.x
scpeters May 7, 2020
9936e3a
Restore detached BodyNodes to original skeleton (#42)
azeey May 7, 2020
49dfd83
Merge branch 'ign-physics1' into bump_2.1
chapulina May 8, 2020
975aad3
changelog
chapulina May 8, 2020
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
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.5.1 FATAL_ERROR)
#============================================================================
# Initialize the project
#============================================================================
project(ignition-physics2 VERSION 2.0.0)
project(ignition-physics2 VERSION 2.1.0)

#============================================================================
# Find ignition-cmake
Expand Down
46 changes: 46 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

### Ignition Physics 2.x.x (20XX-XX-XX)

### Ignition Physics 2.1.0 (2020-05-07)

1. Add RequestFeatures API for casting the features of an entity to a new feature set when possible.
* [BitBucket pull request 130](https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-physics/pull-requests/130)

Expand All @@ -17,6 +19,39 @@
1. Added support for collision bitmasks for collision filtering
* [BitBucket pull request 116](https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-physics/pull-requests/116)

1. Clean up internal resources when a model gets removed
* [BitBucket pull request 115](https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-physics/pull-requests/115)

1. Trivial Physics Engine - partial implementation
* [BitBucket pull request 125](https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-physics/pull-requests/125)
* [BitBucket pull request 126](https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-physics/pull-requests/126)
* [Pull request 30](https://github.com/ignitionrobotics/ign-physics/pull/30)
* [Pull request 45](https://github.com/ignitionrobotics/ign-physics/pull/45)

1. Add simple example of physics plugin and loader
* [BitBucket pull request 115](https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-physics/pull-requests/115)

1. Update BitBucket links, add .gitignore, CODEOWNERS, workflow
* [Pull request 34](https://github.com/ignitionrobotics/ign-physics/pull/34)
* [Pull request 39](https://github.com/ignitionrobotics/ign-physics/pull/39)
* [Pull request 47](https://github.com/ignitionrobotics/ign-physics/pull/47)
* [Pull request 52](https://github.com/ignitionrobotics/ign-physics/pull/52)

1. Physics Plugin Documentation
* [Pull request 36](https://github.com/ignitionrobotics/ign-physics/pull/36)

1. Reduce the symbol load caused by feature templates
* [Pull request 41](https://github.com/ignitionrobotics/ign-physics/pull/41)

1. Fix collision issue with detachable joints
* [Pull request 31](https://github.com/ignitionrobotics/ign-physics/pull/31)

1. Add PlaneShape feature and implement in dartsim with test.
* [BitBucket pull request 66](https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-physics/pull-requests/66)

1. Restore detached BodyNodes to original skeleton
* [Pull request 42](https://github.com/ignitionrobotics/ign-physics/pull/42)

### Ignition Physics 2.0.0 (2019-12-10)

1. Support compiling against dart 6.9.
Expand All @@ -36,6 +71,17 @@

### Ignition Physics 1.x.x (20XX-XX-XX)

1. Restore detached BodyNodes to original skeleton
* [Pull request 42](https://github.com/ignitionrobotics/ign-physics/pull/42)

1. Fix collision issue with detachable joints
* [Pull request 31](https://github.com/ignitionrobotics/ign-physics/pull/31)
scpeters marked this conversation as resolved.
Show resolved Hide resolved

1. Add PlaneShape feature and implement in dartsim with test.
* [BitBucket pull request 66](https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-physics/pull-requests/66)

### Ignition Physics 1.7.0 (2020-04-13)

1. Add RequestFeatures API for casting the features of an entity to a new feature set when possible.
* [BitBucket pull request 130](https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-physics/pull-requests/130)

Expand Down
17 changes: 17 additions & 0 deletions dartsim/src/Base.hh
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ struct ModelInfo
struct LinkInfo
{
dart::dynamics::BodyNodePtr link;
/// \brief It may be necessary for dartsim to rename a BodyNode (eg. when
/// moving the BodyNode to a new skeleton), so we store the Gazebo-specified
/// name of the Link here.
std::string name;
};

struct JointInfo
Expand Down Expand Up @@ -125,6 +129,16 @@ struct EntityStorage
return idToObject.at(_id);
}

Value1 &at(const Key2 &_key)
{
return idToObject.at(objectToID.at(_key));
}

const Value1 &at(const Key2 &_key) const
{
return idToObject.at(objectToID.at(_key));
}

std::size_t size() const
{
return idToObject.size();
Expand Down Expand Up @@ -275,6 +289,9 @@ class Base : public Implements3d<FeatureList<Feature>>
const std::size_t id = this->GetNextEntity();
this->links.idToObject[id] = std::make_shared<LinkInfo>();
this->links.idToObject[id]->link = _bn;
// The name of the BodyNode during creation is assumed to be the
// Gazebo-specified name.
this->links.idToObject[id]->name = _bn->getName();
this->links.objectToID[_bn] = id;
this->frames[id] = _bn;

Expand Down
163 changes: 163 additions & 0 deletions dartsim/src/Collisions_TEST.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
/*
* Copyright (C) 2019 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

#include <gtest/gtest.h>

#include <test/PhysicsPluginsList.hh>

#include <ignition/physics/FindFeatures.hh>
#include <ignition/physics/RequestEngine.hh>
#include <ignition/plugin/Loader.hh>

// Features
#include <ignition/physics/ConstructEmpty.hh>
#include <ignition/physics/ForwardStep.hh>
#include <ignition/physics/FrameSemantics.hh>
#include <ignition/physics/FreeJoint.hh>
#include <ignition/physics/GetEntities.hh>
#include <ignition/physics/mesh/MeshShape.hh>
#include <ignition/physics/PlaneShape.hh>
#include <ignition/physics/FixedJoint.hh>

#include <ignition/common/MeshManager.hh>

using TestFeatureList = ignition::physics::FeatureList<
ignition::physics::LinkFrameSemantics,
ignition::physics::ForwardStep,
ignition::physics::GetEntities,
ignition::physics::ConstructEmptyWorldFeature,
ignition::physics::ConstructEmptyModelFeature,
ignition::physics::ConstructEmptyLinkFeature,
ignition::physics::mesh::AttachMeshShapeFeature,
ignition::physics::AttachPlaneShapeFeature,
ignition::physics::SetFreeJointRelativeTransformFeature,
ignition::physics::AttachFixedJointFeature
>;

using TestWorldPtr = ignition::physics::World3dPtr<TestFeatureList>;
using TestEnginePtr = ignition::physics::Engine3dPtr<TestFeatureList>;

using WorldConstructor = std::function<TestWorldPtr(const TestEnginePtr&)>;

std::unordered_set<TestWorldPtr> LoadWorlds(
const std::string &_library,
const WorldConstructor &_constructor)
{
ignition::plugin::Loader loader;
loader.LoadLib(_library);

const std::set<std::string> pluginNames =
ignition::physics::FindFeatures3d<TestFeatureList>::From(loader);

std::unordered_set<TestWorldPtr> worlds;
for (const std::string &name : pluginNames)
{
ignition::plugin::PluginPtr plugin = loader.Instantiate(name);

std::cout << " -- Plugin name: " << name << std::endl;

auto engine =
ignition::physics::RequestEngine3d<TestFeatureList>::From(plugin);
EXPECT_NE(nullptr, engine);

worlds.insert(_constructor(engine));
}

return worlds;
}

class Collisions_TEST
: public ::testing::Test,
public ::testing::WithParamInterface<std::string>
{};

INSTANTIATE_TEST_CASE_P(PhysicsPlugins, Collisions_TEST,
::testing::ValuesIn(ignition::physics::test::g_PhysicsPluginLibraries),); // NOLINT

TestWorldPtr ConstructMeshPlaneWorld(
const ignition::physics::Engine3dPtr<TestFeatureList> &_engine,
const ignition::common::Mesh &_mesh)
{
auto world = _engine->ConstructEmptyWorld("world");

Eigen::Isometry3d tf = Eigen::Isometry3d::Identity();
tf.translation()[2] = 2.0;

auto model = world->ConstructEmptyModel("mesh");
auto link = model->ConstructEmptyLink("link");
// TODO(anyone): This test is somewhat awkward because we lift up the mesh
// from the center of the link instead of lifting up the link or the model.
// We're doing this because we don't currently have an API for moving models
// or links around. See the conversation here for more:
// https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-physics/pull-requests/46/page/1#comment-87592809
link->AttachMeshShape("mesh", _mesh, tf);

model = world->ConstructEmptyModel("plane");
link = model->ConstructEmptyLink("link");

link->AttachPlaneShape("plane", ignition::physics::LinearVector3d::UnitZ());
link->AttachFixedJoint(nullptr);

return world;
}

TEST_P(Collisions_TEST, MeshAndPlane)
{
const std::string library = GetParam();
if (library.empty())
return;

const std::string meshFilename = IGNITION_PHYSICS_RESOURCE_DIR "/chassis.dae";
auto &meshManager = *ignition::common::MeshManager::Instance();
auto *mesh = meshManager.Load(meshFilename);

std::cout << "Testing library " << library << std::endl;
auto worlds = LoadWorlds(library, [&](const TestEnginePtr &_engine)
{
return ConstructMeshPlaneWorld(_engine, *mesh);
});

for (const auto &world : worlds)
{
const auto link = world->GetModel(0)->GetLink(0);

EXPECT_NEAR(
0.0, link->FrameDataRelativeToWorld().pose.translation()[2], 1e-6);

ignition::physics::ForwardStep::Output output;
ignition::physics::ForwardStep::State state;
ignition::physics::ForwardStep::Input input;
for (std::size_t i = 0; i < 1000; ++i)
{
world->Step(output, state, input);
}

// Make sure the mesh was stopped by the plane. In 2000 time steps at the
// default step size of 0.001, a free falling body should drop approximately
// 19.6 meters. As long as the body is somewhere near 1.91, then it has been
// stopped by the plane (the exact value might vary because the body might
// be rocking side-to-side after falling).
EXPECT_NEAR(
-1.91, link->FrameDataRelativeToWorld().pose.translation()[2], 0.05);
}
}

int main(int argc, char *argv[])
{
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
2 changes: 1 addition & 1 deletion dartsim/src/EntityManagementFeatures.cc
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ Identity EntityManagementFeatures::GetJoint(
const std::string &EntityManagementFeatures::GetLinkName(
const Identity &_linkID) const
{
return this->ReferenceInterface<LinkInfo>(_linkID)->link->getName();
return this->ReferenceInterface<LinkInfo>(_linkID)->name;
}

/////////////////////////////////////////////////
Expand Down
Loading