Skip to content

Commit

Permalink
Physics: remove *VelocityCmd at each time step
Browse files Browse the repository at this point in the history
Part of #1926.

Signed-off-by: Steve Peters <[email protected]>
  • Loading branch information
scpeters committed Nov 4, 2023
1 parent 7a460cd commit 28bccb3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
7 changes: 7 additions & 0 deletions Migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ 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.

## Gazebo Sim 8.x to 9.0

* **Modified**:
+ In the Physics system, all `*VelocityCmd` components are deleted after
each time step. Persistent velocity commands should be reapplied at
each time step.

## Gazebo Sim 7.x to 8.0
* **Deprecated**
+ `gz::sim::components::Factory::Register(const std::string &_type, ComponentDescriptorBase *_compDesc)` and
Expand Down
12 changes: 6 additions & 6 deletions src/systems/physics/Physics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3629,9 +3629,9 @@ void PhysicsPrivate::UpdateSim(EntityComponentManager &_ecm,
});

_ecm.Each<components::JointVelocityCmd>(
[&](const Entity &, components::JointVelocityCmd *_vel) -> bool
[&](const Entity &_entity, components::JointVelocityCmd *) -> bool
{
std::fill(_vel->Data().begin(), _vel->Data().end(), 0.0);
_ecm.RemoveComponent<components::JointVelocityCmd>(_entity);
return true;
});

Expand All @@ -3644,16 +3644,16 @@ void PhysicsPrivate::UpdateSim(EntityComponentManager &_ecm,
GZ_PROFILE_END();

_ecm.Each<components::AngularVelocityCmd>(
[&](const Entity &, components::AngularVelocityCmd *_vel) -> bool
[&](const Entity &_entity, components::AngularVelocityCmd *) -> bool
{
_vel->Data() = math::Vector3d::Zero;
_ecm.RemoveComponent<components::AngularVelocityCmd>(_entity);
return true;
});

_ecm.Each<components::LinearVelocityCmd>(
[&](const Entity &, components::LinearVelocityCmd *_vel) -> bool
[&](const Entity &_entity, components::LinearVelocityCmd *) -> bool
{
_vel->Data() = math::Vector3d::Zero;
_ecm.RemoveComponent<components::LinearVelocityCmd>(_entity);
return true;
});

Expand Down

0 comments on commit 28bccb3

Please sign in to comment.