Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
cd8efc1
add support for models of the same name
arjo129 Oct 8, 2021
b072901
codecheck
arjo129 Oct 8, 2021
5fb5a74
Add unit test
arjo129 Oct 8, 2021
c42aa0b
Merge branch 'ign-gazebo6' into arjo/fix/detachable_joint
arjo129 Oct 8, 2021
0bf387d
Address some feedback
arjo129 Oct 12, 2021
102e93d
Merge branch 'arjo/fix/detachable_joint' of github.com:ignitionroboti…
arjo129 Oct 12, 2021
a4cd125
Merge branch 'ign-gazebo6' into arjo/fix/detachable_joint
chapulina Nov 16, 2021
c8aec3f
🎈 3.15.1 (#2279)
mjcarroll Jan 5, 2024
a3e9f8d
Setup rendering environment before cmake runs (#1965)
azeey Mar 25, 2024
07e5d9c
Fix bug where iterator was used after the underlying item was erased …
azeey May 24, 2024
2bcfe0e
Merge 3 into 6
azeey Jul 9, 2024
894bce1
Merge pull request #2470 from azeey/3_to_6
azeey Jul 10, 2024
9d35f5c
Address a few Windows CI Issues (#1911)
mjcarroll Mar 3, 2023
a2a9c53
Fix DLL linkage/visibility issues (#2254)
mjcarroll Nov 22, 2023
9277c0b
backport lidar visualization frame_id fix
iche033 Jul 17, 2024
9891844
Disable failing testFixture_TEST for MacOS (#2499)
Crola1702 Jul 26, 2024
fb25971
Remove systems if their parent entity is removed (#2232)
arjo129 Jul 17, 2024
67cf543
Initialize threadsNeedCleanUp (#2503)
shameekganguly Jul 31, 2024
96dddad
Fix shader param test
iche033 Aug 2, 2024
2310050
Merge branch 'ign-gazebo6' into arjo/fix/detachable_joint
arjo129 Aug 7, 2024
45f6dc3
Update test files
arjo129 Aug 7, 2024
13f5c93
Fix tests
arjo129 Aug 7, 2024
2ae65a3
Use `scopedName` to support grandchildren as well.
arjo129 Aug 7, 2024
e8e1b16
Address Feedback
arjo129 Aug 12, 2024
a5c9cb6
Better logging
arjo129 Aug 12, 2024
19bdc85
Clean up tests.
arjo129 Aug 12, 2024
1a7083d
Refactor out link discovery into a new function
arjo129 Aug 13, 2024
d2e991c
Style
arjo129 Aug 13, 2024
6fa7157
Style
arjo129 Aug 13, 2024
5bf9bf5
Merge pull request #1097 from gazebosim/arjo/fix/detachable_joint
shameekganguly Aug 13, 2024
c3f271c
Disable detachable_joint integration test case on Windows (#2523)
shameekganguly Aug 13, 2024
a7ea4ac
check valid pointer (#2674) (#2675)
mergify[bot] Nov 12, 2024
8022579
Improve load times by skipping serialization of entities when unecess…
mergify[bot] Nov 20, 2024
0d3af5b
Fix uncontrolled cast of size_t to uint (#2687)
j-rivero Nov 27, 2024
5384cd8
Add parameter for adjust current sign in battery plugin (#2696)
Tacha-S Dec 17, 2024
d9b18d8
Preparation for 6.17.0 release (#2712)
j-rivero Jan 13, 2025
2f1c49f
Fix mesh import filters not displaying correctly on KDE #2731 (#2732)…
mergify[bot] Jan 27, 2025
36c1533
Reduce/Eliminate `sdf::Model` and `sdf::World` serialization warnings…
azeey Jan 31, 2025
cb6fa87
Also handle SIGTERM gracefully (#2747) (#2757)
mergify[bot] Mar 13, 2025
5e31757
Set IGN_IP=127.0.0.1 in cmd tests (#2959)
scpeters Jun 26, 2025
9eeb58d
Add support for loading physics engine plugins from static plugin reg…
iche033 Jul 31, 2025
ec0cac5
Assign new gz-sim maintainer (#3008)
azeey Aug 6, 2025
6f1f867
Assign new gz-sim maintainer (#3008)
azeey Aug 6, 2025
b2a9022
Assign new gz-sim maintainer (#3008)
azeey Aug 6, 2025
1ee77fc
Fix log playback GUI display (#2611)
azeey Sep 12, 2024
8943d82
Backport changes
arjo129 Aug 5, 2025
e5cd8f9
Style
arjo129 Aug 5, 2025
98b6037
Update test expectations
arjo129 Aug 6, 2025
aab29bc
Fix crash when calling setPose service on static and nolink entity (#…
XINJIANGMO Aug 7, 2025
cdd1a76
Update our usage of workerpools (#2995)
azeey Jul 24, 2025
504ee34
Update our usage of workerpools (#2995)
azeey Jul 24, 2025
0699ffe
JointController: supported nested joints (#2979)
srmainwaring Aug 8, 2025
0bfe7cf
Revert "Fix crash when calling setPose service on static and nolink e…
iche033 Aug 8, 2025
e45be2a
Add param in physics system to enforce fixed constraint (#2984)
iche033 Aug 9, 2025
b90dd72
Add missing algorithm include (#3022)
nim65s Aug 9, 2025
b2fc6de
Merge 6 into 8
azeey Aug 12, 2025
b682e0a
Address style related issues in the Detachable Joint Plugin
arjo129 Aug 12, 2025
f4a3b61
Merge pull request #3028 from gazebosim/6_to_8_dettachable_joints
azeey Aug 12, 2025
22b814e
Merge 8 into 9
azeey Aug 12, 2025
502e99d
Merge pull request #3029 from azeey/8_to_9
azeey Aug 13, 2025
eee2605
Merge 9 into main
azeey Aug 13, 2025
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: 2 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,7 @@ gz_sim_system_libraries(
"@gz-sensors",
"@gz-sensors//:dvl",
"@gz-transport",
"@gz-utils//:ImplPtr",
],
)

Expand Down Expand Up @@ -1556,6 +1557,7 @@ gz_sim_system_libraries(
visibility = ["//visibility:public"],
deps = [
":gz-sim",
"@gz-common//:gz-common",
"@gz-common//profiler",
"@gz-math",
"@gz-msgs",
Expand Down
62 changes: 62 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2016,6 +2016,68 @@

## Gazebo Sim 6.x

### Gazebo Sim 6.17.0 (2025-01-10)

1. Add parameter for adjust current sign in battery plugin
* [Pull request #2696](https://github.com/gazebosim/gz-sim/pull/2696)

1. Fix uncontrolled cast of size_t to uint
* [Pull request #2687](https://github.com/gazebosim/gz-sim/pull/2687)

1. Improve load times by skipping serialization of entities when unnecessary
* [Pull request #2596](https://github.com/gazebosim/gz-sim/pull/2596)

1. Fix crash in OpticalTactilePlugin by checking for valid visualize pointer
* [Pull request #2674](https://github.com/gazebosim/gz-sim/pull/2674)

1. Disable detachable_joint integration test case on Windows
* [Pull request #2523](https://github.com/gazebosim/gz-sim/pull/2523)

1. Initialize threadsNeedCleanUp
* [Pull request #2503](https://github.com/gazebosim/gz-sim/pull/2503)

1. Remove systems if their parent entity is removed
* [Pull request #2232](https://github.com/gazebosim/gz-sim/pull/2232)

1. Disable failing testFixture_TEST for MacOS
* [Pull request #2499](https://github.com/gazebosim/gz-sim/pull/2499)

1. backport lidar visualization frame_id fix
* [Pull request #2483](https://github.com/gazebosim/gz-sim/pull/2483)

1. Fix DLL linkage/visibility issues
* [Pull request #2254](https://github.com/gazebosim/gz-sim/pull/2254)

1. Address a few Windows CI Issues
* [Pull request #1911](https://github.com/gazebosim/gz-sim/pull/1911)

1. Add GravityEnabled boolean component
* [Pull request #2451](https://github.com/gazebosim/gz-sim/pull/2451)

1. Add support for no gravity link
* [Pull request #2398](https://github.com/gazebosim/gz-sim/pull/2398)

1. Use VERSION_GREATER_EQUAL in cmake logic
* [Pull request #2418](https://github.com/gazebosim/gz-sim/pull/2418)

1. Rephrase cmake comment about CMP0077
* [Pull request #2419](https://github.com/gazebosim/gz-sim/pull/2419)

1. Fix bug where iterator was used after the underlying item was erased from the container
* [Pull request #2412](https://github.com/gazebosim/gz-sim/pull/2412)

1. Fix namespace and class links in documentation references that use namespace `gz`
* [Pull request #2385](https://github.com/gazebosim/gz-sim/pull/2385)

1. Fix ModelPhotoShootTest test failures
* [Pull request #2294](https://github.com/gazebosim/gz-sim/pull/2294)

1. Setup rendering environment before cmake runs
* [Pull request #1965](https://github.com/gazebosim/gz-sim/pull/1965)

1. Detachable joint: support for nested models of the same name
* [Pull request 1097](https://github.com/gazebosim/gz-sim/pull/1097)

### Gazebo Sim 6.16.0 (2024-01-12)

1. Allow using plugin file names and environment variables compatible with Garden and later
Expand Down
12 changes: 12 additions & 0 deletions include/gz/sim/Util.hh
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,15 @@ namespace gz
GZ_SIM_VISIBLE std::optional<math::AxisAlignedBox> meshAxisAlignedBox(
const sdf::Mesh &_sdfMesh);

/// \brief Get the static plugin prefix
/// \return The static plugin prefix
GZ_SIM_VISIBLE const std::string &staticPluginPrefixStr();

/// \brief Check if input filename of a library is a static plugin or not.
/// \param _filename_ Library filename to check
/// \return True if input filename has a static plugin string format.
GZ_SIM_VISIBLE bool isStaticPlugin(const std::string &_filename);

/// \brief Environment variable holding resource paths.
const std::string kResourcePathEnv{"GZ_SIM_RESOURCE_PATH"};

Expand All @@ -355,6 +364,9 @@ namespace gz
/// \brief Environment variable holding paths to custom rendering engine
/// plugins.
const std::string kRenderPluginPathEnv{"GZ_SIM_RENDER_ENGINE_PATH"};

/// \brief Static plugin filename prefix string.
const std::string kStaticPluginFilenamePrefix{"static://"};
}
}
}
Expand Down
1 change: 0 additions & 1 deletion src/Server_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,6 @@ TEST_P(ServerFixture,
sim::Server server(serverConfig);
EXPECT_EQ(0u, *server.IterationCount());
EXPECT_EQ(3u, *server.EntityCount());

EXPECT_EQ(4u, *server.SystemCount());
}

Expand Down
10 changes: 3 additions & 7 deletions src/SystemLoader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,13 @@
#include <gz/plugin/Loader.hh>

#include "gz/sim/InstallationDirectories.hh"
#include "gz/sim/Util.hh"
#include <gz/sim/config.hh>

using namespace gz::sim;

class gz::sim::SystemLoaderPrivate
{
//////////////////////////////////////////////////
public: static constexpr std::string_view kStaticPluginFilenamePrefix =
"static://";

//////////////////////////////////////////////////
public: explicit SystemLoaderPrivate() = default;

Expand Down Expand Up @@ -85,7 +82,7 @@ class gz::sim::SystemLoaderPrivate
public: bool InstantiateStaticSystemPlugin(const sdf::Plugin &_sdfPlugin,
gz::plugin::PluginPtr &_gzPlugin)
{
const size_t prefixLen = kStaticPluginFilenamePrefix.size();
const size_t prefixLen = staticPluginPrefixStr().size();
const std::string filenameWoPrefix =
_sdfPlugin.Filename().substr(prefixLen);
std::string pluginToInstantiate =
Expand Down Expand Up @@ -136,8 +133,7 @@ class gz::sim::SystemLoaderPrivate
<< "]. Using [" << filename << "] instead." << std::endl;
}

if (filename.substr(0, kStaticPluginFilenamePrefix.size()) ==
kStaticPluginFilenamePrefix)
if (isStaticPlugin(filename))
{
return this->InstantiateStaticSystemPlugin(_sdfPlugin, _gzPlugin);
}
Expand Down
11 changes: 11 additions & 0 deletions src/Util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1022,6 +1022,17 @@ math::AxisAlignedBox transformAxisAlignedBox(
);
}

const std::string &staticPluginPrefixStr()
{
return kStaticPluginFilenamePrefix;
}

bool isStaticPlugin(const std::string &_filename)
{
return _filename.substr(0, staticPluginPrefixStr().size()) ==
staticPluginPrefixStr();
}

}
}
}
9 changes: 9 additions & 0 deletions src/Util_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1136,3 +1136,12 @@ TEST_F(UtilTest, TransformAxisAlignedBoxFrame)
aabExp = aabExp + transform.Pos();
EXPECT_EQ(aabExp, transformAxisAlignedBox(aab, transform));
}

/////////////////////////////////////////////////
TEST_F(UtilTest, StaticPlugin)
{
EXPECT_FALSE(staticPluginPrefixStr().empty());
EXPECT_FALSE(isStaticPlugin("my_plugin"));
EXPECT_FALSE(isStaticPlugin(""));
EXPECT_TRUE(isStaticPlugin(staticPluginPrefixStr() + "my_plugin"));
}
157 changes: 118 additions & 39 deletions src/systems/detachable_joint/DetachableJoint.cc
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,105 @@ void DetachableJoint::Configure(const Entity &_entity,
.first;

this->validConfig = true;

this->GetChildModelAndLinkEntities(_ecm);
}

//////////////////////////////////////////////////
void DetachableJoint::GetChildModelAndLinkEntities(
EntityComponentManager &_ecm)
{
this->childLinkEntity = kNullEntity;
// Look for the child model and link
Entity modelEntity{kNullEntity};

if ("__model__" == this->childModelName)
{
modelEntity = this->model.Entity();
}
else
{
auto entitiesMatchingName = entitiesFromScopedName(
this->childModelName, _ecm);

// TODO(arjoc): There is probably a more efficient way
// of combining entitiesFromScopedName
// With filtering.
// Filter for entities with only models
std::vector<Entity> candidateEntities;
std::copy_if(entitiesMatchingName.begin(), entitiesMatchingName.end(),
std::back_inserter(candidateEntities),
[&_ecm](Entity e) {
return _ecm.EntityHasComponentType(e,
components::Model::typeId);
});

if (candidateEntities.size() == 1)
{
// If there is one entity select that entity itself
modelEntity = *candidateEntities.begin();
}
else
{
std::string selectedModelName;
auto parentEntityScopedPath = scopedName(this->model.Entity(), _ecm);
// If there is more than one model with the given child model name,
// the plugin looks for a model which is
// - a descendant of the plugin's parent model with that name, and
// - has a child link with the given child link name
for (auto entity : candidateEntities)
{
auto childEntityScope = scopedName(entity, _ecm);
if (childEntityScope.size() < parentEntityScopedPath.size())
{
continue;
}
if (childEntityScope.rfind(parentEntityScopedPath, 0) != 0)
{
continue;
}
if (modelEntity == kNullEntity)
{

this->childLinkEntity = _ecm.EntityByComponents(
components::Link(), components::ParentEntity(entity),
components::Name(this->childLinkName));

if (kNullEntity != this->childLinkEntity)
{
// Only select this child model entity if the entity
// has a link with the given child link name
modelEntity = entity;
selectedModelName = childEntityScope;
gzdbg << "Selecting " << childEntityScope
<< " as model to be detached" << std::endl;
}
else
{
gzwarn << "Found " << childEntityScope
<< " with no link named " << this->childLinkName << std::endl;
}
}
else
{
gzwarn << "Found multiple models skipping " << childEntityScope
<< "Using " << selectedModelName << " instead" << std::endl;
}
}
}
}
if (kNullEntity != modelEntity)
{
this->childLinkEntity = _ecm.EntityByComponents(
components::Link(), components::ParentEntity(modelEntity),
components::Name(this->childLinkName));
}
else if (!this->suppressChildWarning)
{
gzwarn << "Child Model " << this->childModelName
<< " could not be found.\n";
}
}
//////////////////////////////////////////////////
void DetachableJoint::PreUpdate(
const UpdateInfo &/*_info*/,
Expand All @@ -225,54 +322,36 @@ void DetachableJoint::PreUpdate(
if (!this->attachRequested){
return;
}
// Look for the child model and link
Entity modelEntity{kNullEntity};

if ("__model__" == this->childModelName)
if (this->childLinkEntity == kNullEntity ||
!_ecm.HasEntity(this->childLinkEntity))
this->GetChildModelAndLinkEntities(_ecm);

if (kNullEntity != this->childLinkEntity)
{
modelEntity = this->model.Entity();
// Attach the models
// We do this by creating a detachable joint entity.
this->detachableJointEntity = _ecm.CreateEntity();

_ecm.CreateComponent(
this->detachableJointEntity,
components::DetachableJoint({this->parentLinkEntity,
this->childLinkEntity, "fixed"}));
this->attachRequested = false;
this->isAttached = true;
this->PublishJointState(this->isAttached);
gzdbg << "Attaching entity: " << this->detachableJointEntity
<< std::endl;
}
else
{
modelEntity = _ecm.EntityByComponents(
components::Model(), components::Name(this->childModelName));
}
if (kNullEntity != modelEntity)
{
this->childLinkEntity = _ecm.EntityByComponents(
components::Link(), components::ParentEntity(modelEntity),
components::Name(this->childLinkName));

if (kNullEntity != this->childLinkEntity)
{
// Attach the models
// We do this by creating a detachable joint entity.
this->detachableJointEntity = _ecm.CreateEntity();

_ecm.CreateComponent(
this->detachableJointEntity,
components::DetachableJoint({this->parentLinkEntity,
this->childLinkEntity, "fixed"}));
this->attachRequested = false;
this->isAttached = true;
this->PublishJointState(this->isAttached);
gzdbg << "Attaching entity: " << this->detachableJointEntity
<< std::endl;
}
else
{
gzwarn << "Child Link " << this->childLinkName
<< " could not be found.\n";
}
}
else if (!this->suppressChildWarning)
{
gzwarn << "Child Model " << this->childModelName
gzwarn << "Child Link " << this->childLinkName
<< " could not be found.\n";
}

}

// only allow detaching if child entity is attached
// only allow detaching if child entity is attached
if (this->isAttached)
{
if (this->detachRequested && (kNullEntity != this->detachableJointEntity))
Expand Down
4 changes: 4 additions & 0 deletions src/systems/detachable_joint/DetachableJoint.hh
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ namespace systems
/// \brief Callback for detach request topic
private: void OnDetachRequest(const msgs::Empty &_msg);

/// \brief Retrieve the relevant link entity
private: void GetChildModelAndLinkEntities(
gz::sim::EntityComponentManager &_ecm);

/// \brief The model associated with this system.
private: Model model;

Expand Down
Loading
Loading