@@ -441,11 +441,6 @@ void Buoyancy::PreUpdate(const ignition::gazebo::UpdateInfo &_info,
441
441
{
442
442
auto newPose = enableComponent<components::Inertial>(_ecm, _entity);
443
443
newPose |= enableComponent<components::WorldPose>(_ecm, _entity);
444
- if (newPose)
445
- {
446
- // Skip entity if WorldPose and inertial are not yet ready
447
- return true ;
448
- }
449
444
450
445
// World pose of the link.
451
446
math::Pose3d linkWorldPose = worldPose (_entity, _ecm);
@@ -477,6 +472,13 @@ void Buoyancy::PreUpdate(const ignition::gazebo::UpdateInfo &_info,
477
472
else if (this ->dataPtr ->buoyancyType
478
473
== BuoyancyPrivate::BuoyancyType::GRADED_BUOYANCY)
479
474
{
475
+ if (newPose)
476
+ {
477
+ // Skip entity if WorldPose and inertial are not yet ready
478
+ // TODO(arjo): Find a way of disabling gravity effects for
479
+ // this first iteration.
480
+ return true ;
481
+ }
480
482
std::vector<Entity> collisions = _ecm.ChildrenByComponents (
481
483
_entity, components::Collision ());
482
484
this ->dataPtr ->buoyancyForces .clear ();
@@ -521,12 +523,13 @@ void Buoyancy::PreUpdate(const ignition::gazebo::UpdateInfo &_info,
521
523
}
522
524
}
523
525
}
524
- }
525
- auto [force, torque] = this ->dataPtr ->ResolveForces (
526
+ auto [force, torque] = this ->dataPtr ->ResolveForces (
526
527
link.WorldInertialPose (_ecm).value ());
527
- // Apply the wrench to the link. This wrench is applied in the
528
- // Physics System.
529
- link.AddWorldWrench (_ecm, force, torque);
528
+ // Apply the wrench to the link. This wrench is applied in the
529
+ // Physics System.
530
+ link.AddWorldWrench (_ecm, force, torque);
531
+ }
532
+
530
533
return true ;
531
534
});
532
535
}
0 commit comments