Skip to content

Commit

Permalink
ForceTorque use SystemConfigurePriority
Browse files Browse the repository at this point in the history
Set the default priority to 10 so we don't have to
set the priority in XML for every world that uses
force-torque sensors.

Signed-off-by: Steve Peters <[email protected]>
  • Loading branch information
scpeters committed Jul 29, 2024
1 parent c1dc30e commit 2abad01
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
1 change: 0 additions & 1 deletion examples/worlds/sensors.sdf
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
<plugin
filename="gz-sim-forcetorque-system"
name="gz::sim::systems::ForceTorque">
<gz::system_priority>10</gz::system_priority>
</plugin>
<plugin
filename="gz-sim-user-commands-system"
Expand Down
7 changes: 7 additions & 0 deletions src/systems/force_torque/ForceTorque.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ ForceTorque::ForceTorque()
//////////////////////////////////////////////////
ForceTorque::~ForceTorque() = default;

//////////////////////////////////////////////////
System::PriorityType ForceTorque::ConfigurePriority()
{
return 10;
}

//////////////////////////////////////////////////
void ForceTorque::PreUpdate(const UpdateInfo &/*_info*/,
EntityComponentManager &_ecm)
Expand Down Expand Up @@ -449,6 +455,7 @@ void ForceTorquePrivate::RemoveForceTorqueEntities(
}

GZ_ADD_PLUGIN(ForceTorque, System,
ForceTorque::ISystemConfigurePriority,
ForceTorque::ISystemPreUpdate,
ForceTorque::ISystemUpdate
)
Expand Down
4 changes: 4 additions & 0 deletions src/systems/force_torque/ForceTorque.hh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ namespace systems
/// quantites are expressed, not the point of application.
class ForceTorque:
public System,
public ISystemConfigurePriority,
public ISystemPreUpdate,
public ISystemUpdate
{
Expand All @@ -50,6 +51,9 @@ namespace systems
/// \brief Destructor
public: ~ForceTorque() override;

/// Documentation inherited
public: System::PriorityType ConfigurePriority() final;

/// Documentation inherited
public: void PreUpdate(const UpdateInfo &_info,
EntityComponentManager &_ecm) final;
Expand Down
4 changes: 1 addition & 3 deletions test/worlds/force_torque.sdf
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
<real_time_factor>0</real_time_factor>
</physics>
<plugin filename="gz-sim-physics-system" name="gz::sim::systems::Physics" />
<plugin filename="gz-sim-forcetorque-system" name="gz::sim::systems::ForceTorque">
<gz:system_priority>10</gz:system_priority>
</plugin>
<plugin filename="gz-sim-forcetorque-system" name="gz::sim::systems::ForceTorque" />
<plugin filename='gz-sim-scene-broadcaster-system' name='gz::sim::systems::SceneBroadcaster' />
<model name="ground_plane">
<static>true</static>
Expand Down

0 comments on commit 2abad01

Please sign in to comment.