Skip to content

Commit fd5cbbc

Browse files
committed
Merge remote-tracking branch 'origin/gz-sim9' into default_visual_for_model
2 parents 2fc1369 + 502e99d commit fd5cbbc

File tree

15 files changed

+594
-56
lines changed

15 files changed

+594
-56
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
# More info:
22
# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners
33

4-
* @mjcarroll
4+
* @arjo129
55
*/rendering/* @iche033
6-
examples/* @mabelzhang
76
src/systems/physics/* @azeey
87
src/systems/sensors/* @iche033
98
*/gui/* @jennuine
10-
tutorials/* @mabelzhang

Changelog.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2012,6 +2012,68 @@
20122012

20132013
## Gazebo Sim 6.x
20142014

2015+
### Gazebo Sim 6.17.0 (2025-01-10)
2016+
2017+
1. Add parameter for adjust current sign in battery plugin
2018+
* [Pull request #2696](https://github.com/gazebosim/gz-sim/pull/2696)
2019+
2020+
1. Fix uncontrolled cast of size_t to uint
2021+
* [Pull request #2687](https://github.com/gazebosim/gz-sim/pull/2687)
2022+
2023+
1. Improve load times by skipping serialization of entities when unnecessary
2024+
* [Pull request #2596](https://github.com/gazebosim/gz-sim/pull/2596)
2025+
2026+
1. Fix crash in OpticalTactilePlugin by checking for valid visualize pointer
2027+
* [Pull request #2674](https://github.com/gazebosim/gz-sim/pull/2674)
2028+
2029+
1. Disable detachable_joint integration test case on Windows
2030+
* [Pull request #2523](https://github.com/gazebosim/gz-sim/pull/2523)
2031+
2032+
1. Initialize threadsNeedCleanUp
2033+
* [Pull request #2503](https://github.com/gazebosim/gz-sim/pull/2503)
2034+
2035+
1. Remove systems if their parent entity is removed
2036+
* [Pull request #2232](https://github.com/gazebosim/gz-sim/pull/2232)
2037+
2038+
1. Disable failing testFixture_TEST for MacOS
2039+
* [Pull request #2499](https://github.com/gazebosim/gz-sim/pull/2499)
2040+
2041+
1. backport lidar visualization frame_id fix
2042+
* [Pull request #2483](https://github.com/gazebosim/gz-sim/pull/2483)
2043+
2044+
1. Fix DLL linkage/visibility issues
2045+
* [Pull request #2254](https://github.com/gazebosim/gz-sim/pull/2254)
2046+
2047+
1. Address a few Windows CI Issues
2048+
* [Pull request #1911](https://github.com/gazebosim/gz-sim/pull/1911)
2049+
2050+
1. Add GravityEnabled boolean component
2051+
* [Pull request #2451](https://github.com/gazebosim/gz-sim/pull/2451)
2052+
2053+
1. Add support for no gravity link
2054+
* [Pull request #2398](https://github.com/gazebosim/gz-sim/pull/2398)
2055+
2056+
1. Use VERSION_GREATER_EQUAL in cmake logic
2057+
* [Pull request #2418](https://github.com/gazebosim/gz-sim/pull/2418)
2058+
2059+
1. Rephrase cmake comment about CMP0077
2060+
* [Pull request #2419](https://github.com/gazebosim/gz-sim/pull/2419)
2061+
2062+
1. Fix bug where iterator was used after the underlying item was erased from the container
2063+
* [Pull request #2412](https://github.com/gazebosim/gz-sim/pull/2412)
2064+
2065+
1. Fix namespace and class links in documentation references that use namespace `gz`
2066+
* [Pull request #2385](https://github.com/gazebosim/gz-sim/pull/2385)
2067+
2068+
1. Fix ModelPhotoShootTest test failures
2069+
* [Pull request #2294](https://github.com/gazebosim/gz-sim/pull/2294)
2070+
2071+
1. Setup rendering environment before cmake runs
2072+
* [Pull request #1965](https://github.com/gazebosim/gz-sim/pull/1965)
2073+
2074+
1. Detachable joint: support for nested models of the same name
2075+
* [Pull request 1097](https://github.com/gazebosim/gz-sim/pull/1097)
2076+
20152077
### Gazebo Sim 6.16.0 (2024-01-12)
20162078

20172079
1. Allow using plugin file names and environment variables compatible with Garden and later

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Gazebo Sim : A Robotic Simulator
22

3-
**Maintainer:** michael AT openrobotics DOT org
3+
**Maintainer:** arjoc AT intrinsic DOT ai
44

55
[![GitHub open issues](https://img.shields.io/github/issues-raw/gazebosim/gz-sim.svg)](https://github.com/gazebosim/gz-sim/issues)
66
[![GitHub open pull requests](https://img.shields.io/github/issues-pr-raw/gazebosim/gz-sim.svg)](https://github.com/gazebosim/gz-sim/pulls)

examples/worlds/shader_param.sdf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,12 @@ ShaderParam visual plugin over time.
181181
<include>
182182
<name>deformable_sphere</name>
183183
<pose>0 0 1.5 0 0 0</pose>
184-
<uri>https://fuel.gazebosim.org/1.0/openrobotics/models/deformable_sphere</uri>
184+
<uri>https://fuel.gazebosim.org/1.0/openrobotics/models/deformable_sphere/5</uri>
185185
</include>
186186
<include>
187187
<name>waves</name>
188188
<pose>0 0 0 0 0 0</pose>
189-
<uri>https://fuel.gazebosim.org/1.0/openrobotics/models/waves</uri>
189+
<uri>https://fuel.gazebosim.org/1.0/openrobotics/models/waves/4</uri>
190190
</include>
191191

192192
<model name="camera">

src/ServerPrivate.cc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,16 +200,22 @@ bool ServerPrivate::Run(const uint64_t _iterations,
200200
}
201201
else
202202
{
203+
if (!this->workerPool.has_value())
204+
{
205+
// Initialize the workerpool if we do have multiple simulation runners and
206+
// it hasn't been initialized before
207+
this->workerPool.emplace(2);
208+
}
203209
for (std::unique_ptr<SimulationRunner> &runner : this->simRunners)
204210
{
205-
this->workerPool.AddWork([&runner, &_iterations] ()
211+
this->workerPool->AddWork([&runner, &_iterations] ()
206212
{
207213
runner->Run(_iterations);
208214
});
209215
}
210216

211217
// Wait for the runner to complete.
212-
result = this->workerPool.WaitForResults();
218+
result = this->workerPool->WaitForResults();
213219
}
214220

215221
// See comments ServerPrivate::Stop() for why we lock this mutex here.

src/ServerPrivate.hh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,10 @@ namespace gz
154154
const gz::msgs::ServerControl &_req, msgs::Boolean &_res);
155155

156156
/// \brief A pool of worker threads.
157-
public: common::WorkerPool workerPool{2};
157+
/// \note We use optional here since most of the time, there will be a
158+
/// single simulation runner and a workerpool is not needed. We will
159+
/// initialize the workerpool as necessary later on.
160+
public: std::optional<common::WorkerPool> workerPool;
158161

159162
/// \brief All the simulation runners.
160163
public: std::vector<std::unique_ptr<SimulationRunner>> simRunners;

src/Server_TEST.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,6 @@ TEST_P(ServerFixture,
481481
sim::Server server(serverConfig);
482482
EXPECT_EQ(0u, *server.IterationCount());
483483
EXPECT_EQ(3u, *server.EntityCount());
484-
485484
EXPECT_EQ(4u, *server.SystemCount());
486485
}
487486

src/SimulationRunner.hh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
#include <sdf/World.hh>
4242

4343
#include <gz/common/Event.hh>
44-
#include <gz/common/WorkerPool.hh>
4544
#include <gz/math/Stopwatch.hh>
4645
#include <gz/transport/Node.hh>
4746

@@ -427,9 +426,6 @@ namespace gz
427426
/// \brief Manager of distributing/receiving network work.
428427
private: std::unique_ptr<NetworkManager> networkMgr{nullptr};
429428

430-
/// \brief A pool of worker threads.
431-
private: common::WorkerPool workerPool{2};
432-
433429
/// \brief Wall time of the previous update.
434430
private: std::chrono::steady_clock::time_point prevUpdateRealTime;
435431

src/systems/detachable_joint/DetachableJoint.cc

Lines changed: 118 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,105 @@ void DetachableJoint::Configure(const Entity &_entity,
210210
.first;
211211

212212
this->validConfig = true;
213+
214+
this->GetChildModelAndLinkEntities(_ecm);
213215
}
214216

217+
//////////////////////////////////////////////////
218+
void DetachableJoint::GetChildModelAndLinkEntities(
219+
EntityComponentManager &_ecm)
220+
{
221+
this->childLinkEntity = kNullEntity;
222+
// Look for the child model and link
223+
Entity modelEntity{kNullEntity};
224+
225+
if ("__model__" == this->childModelName)
226+
{
227+
modelEntity = this->model.Entity();
228+
}
229+
else
230+
{
231+
auto entitiesMatchingName = entitiesFromScopedName(
232+
this->childModelName, _ecm);
233+
234+
// TODO(arjoc): There is probably a more efficient way
235+
// of combining entitiesFromScopedName
236+
// With filtering.
237+
// Filter for entities with only models
238+
std::vector<Entity> candidateEntities;
239+
std::copy_if(entitiesMatchingName.begin(), entitiesMatchingName.end(),
240+
std::back_inserter(candidateEntities),
241+
[&_ecm](Entity e) {
242+
return _ecm.EntityHasComponentType(e,
243+
components::Model::typeId);
244+
});
245+
246+
if (candidateEntities.size() == 1)
247+
{
248+
// If there is one entity select that entity itself
249+
modelEntity = *candidateEntities.begin();
250+
}
251+
else
252+
{
253+
std::string selectedModelName;
254+
auto parentEntityScopedPath = scopedName(this->model.Entity(), _ecm);
255+
// If there is more than one model with the given child model name,
256+
// the plugin looks for a model which is
257+
// - a descendant of the plugin's parent model with that name, and
258+
// - has a child link with the given child link name
259+
for (auto entity : candidateEntities)
260+
{
261+
auto childEntityScope = scopedName(entity, _ecm);
262+
if (childEntityScope.size() < parentEntityScopedPath.size())
263+
{
264+
continue;
265+
}
266+
if (childEntityScope.rfind(parentEntityScopedPath, 0) != 0)
267+
{
268+
continue;
269+
}
270+
if (modelEntity == kNullEntity)
271+
{
272+
273+
this->childLinkEntity = _ecm.EntityByComponents(
274+
components::Link(), components::ParentEntity(entity),
275+
components::Name(this->childLinkName));
276+
277+
if (kNullEntity != this->childLinkEntity)
278+
{
279+
// Only select this child model entity if the entity
280+
// has a link with the given child link name
281+
modelEntity = entity;
282+
selectedModelName = childEntityScope;
283+
gzdbg << "Selecting " << childEntityScope
284+
<< " as model to be detached" << std::endl;
285+
}
286+
else
287+
{
288+
gzwarn << "Found " << childEntityScope
289+
<< " with no link named " << this->childLinkName << std::endl;
290+
}
291+
}
292+
else
293+
{
294+
gzwarn << "Found multiple models skipping " << childEntityScope
295+
<< "Using " << selectedModelName << " instead" << std::endl;
296+
}
297+
}
298+
}
299+
}
300+
if (kNullEntity != modelEntity)
301+
{
302+
this->childLinkEntity = _ecm.EntityByComponents(
303+
components::Link(), components::ParentEntity(modelEntity),
304+
components::Name(this->childLinkName));
305+
}
306+
else if (!this->suppressChildWarning)
307+
{
308+
gzwarn << "Child Model " << this->childModelName
309+
<< " could not be found.\n";
310+
}
311+
}
215312
//////////////////////////////////////////////////
216313
void DetachableJoint::PreUpdate(
217314
const UpdateInfo &/*_info*/,
@@ -225,54 +322,36 @@ void DetachableJoint::PreUpdate(
225322
if (!this->attachRequested){
226323
return;
227324
}
228-
// Look for the child model and link
229-
Entity modelEntity{kNullEntity};
230325

231-
if ("__model__" == this->childModelName)
326+
if (this->childLinkEntity == kNullEntity ||
327+
!_ecm.HasEntity(this->childLinkEntity))
328+
this->GetChildModelAndLinkEntities(_ecm);
329+
330+
if (kNullEntity != this->childLinkEntity)
232331
{
233-
modelEntity = this->model.Entity();
332+
// Attach the models
333+
// We do this by creating a detachable joint entity.
334+
this->detachableJointEntity = _ecm.CreateEntity();
335+
336+
_ecm.CreateComponent(
337+
this->detachableJointEntity,
338+
components::DetachableJoint({this->parentLinkEntity,
339+
this->childLinkEntity, "fixed"}));
340+
this->attachRequested = false;
341+
this->isAttached = true;
342+
this->PublishJointState(this->isAttached);
343+
gzdbg << "Attaching entity: " << this->detachableJointEntity
344+
<< std::endl;
234345
}
235346
else
236347
{
237-
modelEntity = _ecm.EntityByComponents(
238-
components::Model(), components::Name(this->childModelName));
239-
}
240-
if (kNullEntity != modelEntity)
241-
{
242-
this->childLinkEntity = _ecm.EntityByComponents(
243-
components::Link(), components::ParentEntity(modelEntity),
244-
components::Name(this->childLinkName));
245-
246-
if (kNullEntity != this->childLinkEntity)
247-
{
248-
// Attach the models
249-
// We do this by creating a detachable joint entity.
250-
this->detachableJointEntity = _ecm.CreateEntity();
251-
252-
_ecm.CreateComponent(
253-
this->detachableJointEntity,
254-
components::DetachableJoint({this->parentLinkEntity,
255-
this->childLinkEntity, "fixed"}));
256-
this->attachRequested = false;
257-
this->isAttached = true;
258-
this->PublishJointState(this->isAttached);
259-
gzdbg << "Attaching entity: " << this->detachableJointEntity
260-
<< std::endl;
261-
}
262-
else
263-
{
264-
gzwarn << "Child Link " << this->childLinkName
265-
<< " could not be found.\n";
266-
}
267-
}
268-
else if (!this->suppressChildWarning)
269-
{
270-
gzwarn << "Child Model " << this->childModelName
348+
gzwarn << "Child Link " << this->childLinkName
271349
<< " could not be found.\n";
272350
}
351+
273352
}
274353

275-
// only allow detaching if child entity is attached
354+
// only allow detaching if child entity is attached
276355
if (this->isAttached)
277356
{
278357
if (this->detachRequested && (kNullEntity != this->detachableJointEntity))

src/systems/detachable_joint/DetachableJoint.hh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ namespace systems
101101
/// \brief Callback for detach request topic
102102
private: void OnDetachRequest(const msgs::Empty &_msg);
103103

104+
/// \brief Retrieve the relevant link entity
105+
private: void GetChildModelAndLinkEntities(
106+
gz::sim::EntityComponentManager &_ecm);
107+
104108
/// \brief The model associated with this system.
105109
private: Model model;
106110

0 commit comments

Comments
 (0)