Skip to content

Commit

Permalink
Merge branch 'main' into bump_edifice_ign-common
Browse files Browse the repository at this point in the history
Signed-off-by: Louise Poubel <[email protected]>
  • Loading branch information
chapulina committed Feb 19, 2021
2 parents 53251e4 + 765e6c7 commit ba00ff1
Show file tree
Hide file tree
Showing 43 changed files with 1,059 additions and 177 deletions.
1 change: 0 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@

* @mxgrey
include/* @scpeters
tpe/* @claireyywang
29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: Bug report
about: Report a bug
labels: bug
---

<!-- If you're not sure whether your problem is a bug, please ask a question at
http://answers.gazebosim.org instead.-->

## Environment
* OS Version: <!-- e.g, Ubuntu 20.04 -->
* Source or binary build?
<!-- If binary, which version? -->
<!-- If source, which branch and what is the latest commit? -->

## Description
* Expected behavior: <!-- Tell us what you expected to happen -->
* Actual behavior: <!-- What happened instead -->

## Steps to reproduce
<!-- Provide steps so we can try to reproduce this issue -->

1.
2.
3.

## Output
<!-- Provide screenshots, console logs, backtraces, and/or anything that could
be useful to us resolving this issue -->
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Feature request
about: Request a new feature
labels: enhancement
---

<!-- If you're not sure on the specifics of the feature or would like a broader
discussion, please ask consider posting a proposal to
http://community.gazebosim.org/ instead.-->

## Desired behavior
<!-- Describe the current problem and the feature you want implemented.-->

## Alternatives considered
<!-- Describe alternate solutions or features you've considered.-->

## Implementation suggestion
<!-- Provide a suggestion on how to implement this feature, which could help us
expedite this implementation.-->

## Additional context
<!-- Provide any other additional context (e.g., screenshots) about your feature
request.-->
52 changes: 52 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<!-- Please remove the appropriate section.
For example, if this is a new feature, remove the "Bug Report" section -->

# Bug Report

Fixes issue #<NUMBER>

## Summary
<!-- Describe your fix, including an explanation of how to reproduce the bug
before and after the PR.-->

## Checklist
- [ ] Signed all commits for DCO
- [ ] Added tests
- [ ] Updated documentation (as needed)
- [ ] Updated migration guide (as needed)
- [ ] `codecheck` passed (See
[contributing](https://ignitionrobotics.org/docs/all/contributing#contributing-code))
- [ ] All tests passed (See
[test coverage](https://ignitionrobotics.org/docs/all/contributing#test-coverage))
- [ ] While waiting for a review on your PR, please help review
[another open pull request](https://github.com/pulls?q=is%3Aopen+is%3Apr+user%3Aignitionrobotics+archived%3Afalse+)
to support the maintainers

**Note to maintainers**: Remember to use **Squash-Merge**

---

# New feature

Closes #<NUMBER>

## Summary
<!--Explain changes made, the expected behavior, and provide any other additional
context (e.g., screenshots, gifs) if appropriate.-->

## Test it
<!--Explain how reviewers can test this new feature manually.-->

## Checklist
- [ ] Signed all commits for DCO
- [ ] Added tests
- [ ] Added example world and/or tutorial
- [ ] Updated documentation (as needed)
- [ ] Updated migration guide (as needed)
- [ ] `codecheck` passed (See [contributing](https://ignitionrobotics.org/docs/all/contributing#contributing-code))
- [ ] All tests passed (See [test coverage](https://ignitionrobotics.org/docs/all/contributing#test-coverage))
- [ ] While waiting for a review on your PR, please help review
[another open pull request](https://github.com/pulls?q=is%3Aopen+is%3Apr+user%3Aignitionrobotics+archived%3Afalse+)
to support the maintainers

**Note to maintainers**: Remember to use **Squash-Merge**
6 changes: 6 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/port.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Port <FROM_BRANCH> to <TO_BRANCH>

Branch comparison: https://github.com/ignitionrobotics/ign-physics/compare/<FROM_BRANCH>...<TO_BRANCH>

**Note to maintainers**: Remember to **Merge** with commit (not squash-merge
or rebase)
1 change: 1 addition & 0 deletions .github/ci/packages.apt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ libignition-common4-dev
libignition-math6-dev
libignition-math6-eigen3-dev
libignition-plugin-dev
libignition-utils-dev
libsdformat11-dev
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ set(IGN_MATH_VER ${ignition-math6_VERSION_MAJOR})
ign_find_package(ignition-plugin1 REQUIRED COMPONENTS all VERSION 1.1)
set(IGN_PLUGIN_VER ${ignition-plugin1_VERSION_MAJOR})

#--------------------------------------
# Find ignition-utils
ign_find_package(ignition-utils1 REQUIRED COMPONENTS cli)
set(IGN_UTILS_VER ${ignition-utils1_VERSION_MAJOR})

#--------------------------------------
# Find Eigen
ign_find_package(EIGEN3 REQUIRED)
Expand Down
14 changes: 14 additions & 0 deletions Migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,20 @@ Deprecated code produces compile-time warnings. These warning serve as
notification to users that their code should be upgraded. The next major
release will remove the deprecated code.

## Ignition Physics 3.X to 4.X

### Modifications

1. Depends on ignition-utils1.

1. Depends on sdformat11.

## Ignition Physics 2.X to 3.X

### Modifications

1. Depends on sdformat10.

## Ignition Physics 1.X to 2.X

### Modifications
Expand Down
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ designed to support simulation and rapid development of robot applications.

[Usage](#usage)

[Documentation](#documentation)

[Testing](#testing)

[Folder Structure](#folder-structure)

[Code of Conduct](#code-of-conduct)
Expand Down Expand Up @@ -93,7 +89,7 @@ You can also generate the documentation from a clone of this repository by follo
2. Clone the repository
```
git clone https://github.com/ignitionrobotics/ign-physics -b master
git clone https://github.com/ignitionrobotics/ign-physics -b ign-physics3
```
3. Configure and build the documentation.
Expand Down
65 changes: 64 additions & 1 deletion dartsim/src/Base.hh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
#include <ignition/common/Console.hh>
#include <ignition/physics/Implements.hh>

#include <sdf/Types.hh>

namespace ignition {
namespace physics {
namespace dartsim {
Expand Down Expand Up @@ -256,6 +258,7 @@ class Base : public Implements3d<FeatureList<Feature>>
this->worlds.idToContainerID[id] = 0;

_world->setName(_name);
this->frames[id] = dart::dynamics::Frame::World();

return id;
}
Expand All @@ -278,6 +281,7 @@ class Base : public Implements3d<FeatureList<Feature>>
world->addSkeleton(entry.model);

this->models.idToContainerID[id] = _worldID;
this->frames[id] = _info.frame.get();

assert(indexInContainerToID.size() == world->getNumSkeletons());

Expand Down Expand Up @@ -341,12 +345,71 @@ class Base : public Implements3d<FeatureList<Feature>>
world->removeSkeleton(skel);
}

static bool SkeletonNameEndsWithModelName(
const std::string &_skeletonName, const std::string &_modelName)
{
if (_modelName.empty())
return true;

if (_skeletonName.size() < _modelName.size())
return false;

// If _modelName comes from a nested model, it might actually be shorter
// than _skeletonName. E.g -> _skeletonName = a::b::c, _modelName = b::c
const size_t compareStartPosition =
_skeletonName.size() - _modelName.size();
return _skeletonName.compare(
compareStartPosition, _modelName.size(), _modelName) == 0;
}

/// \brief Finds the skeleton in the world that matches the qualified name
/// If more than one match exists, it will return null
/// \param[in] _worldID Which world to search.
/// \param[in] _name Name of entity.
/// \return Pointer to skeleton if exactly one match was found, otherwise null
public: DartSkeletonPtr FindContainingSkeletonFromName(
const dart::simulation::WorldPtr &_world, const std::string &_name)
{
if (_world == nullptr)
return nullptr;

if (_name == "world")
return nullptr;

const auto[skeletonName, entityName] = ::sdf::SplitName(_name);
std::vector<DartSkeletonPtr> matches;
for (size_t i = 0; i < _world->getNumSkeletons(); ++i)
{
auto candidateSkeleton = _world->getSkeleton(i);
if (SkeletonNameEndsWithModelName(
candidateSkeleton->getName(), skeletonName))
{
// There may be multiple skeletons that match the model name, only match
// those that contain a matching entity
auto * node = candidateSkeleton->getBodyNode(entityName);
if (nullptr != node)
matches.push_back(candidateSkeleton);
}
}

// It's possible there was more than 1 match
// (e.g. b::c matches both a::b::c and d::b::c)
if (matches.size() == 1)
return matches.front();
else if (matches.size() > 1)
{
ignerr << "Found " << matches.size() << " for " << _name << std::endl;
return nullptr;
}
return nullptr;
}

public: EntityStorage<DartWorldPtr, std::string> worlds;
public: EntityStorage<ModelInfoPtr, DartConstSkeletonPtr> models;
public: EntityStorage<LinkInfoPtr, const DartBodyNode*> links;
public: EntityStorage<JointInfoPtr, const DartJoint*> joints;
public: EntityStorage<ShapeInfoPtr, const DartShapeNode*> shapes;
public: std::unordered_map<std::size_t, const dart::dynamics::Frame*> frames;
public: std::unordered_map<std::size_t, dart::dynamics::Frame*> frames;
};

}
Expand Down
Loading

0 comments on commit ba00ff1

Please sign in to comment.