Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added flag to turn off movement halting
Browse files Browse the repository at this point in the history
Signed-off-by: Tomas Lorente <[email protected]>
Lobotuerk committed Mar 31, 2021
1 parent 9f0c918 commit 19acc8d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/systems/kinetic_energy_monitor/KineticEnergyMonitor.cc
Original file line number Diff line number Diff line change
@@ -67,6 +67,9 @@ class ignition::gazebo::systems::KineticEnergyMonitorPrivate

/// \brief This model halt motion state.
public: bool haltMotionState {false};

/// \brief Halting motion Mode
public: bool haltMode;
};

//////////////////////////////////////////////////
@@ -129,6 +132,8 @@ void KineticEnergyMonitor::Configure(const Entity &_entity,
ignmsg << "KineticEnergyMonitor publishing messages on "
<< "[" << topic << "]" << std::endl;

this->dataPtr->haltMode = sdfClone->Get<bool>("halt_mode", false).first;

transport::Node node;
this->dataPtr->pub = node.Advertise<msgs::Double>(topic);

@@ -198,7 +203,8 @@ void KineticEnergyMonitor::Update(const UpdateInfo &_info,
_ecm.Component<components::HaltMotion>(
_ecm.ParentEntity(this->dataPtr->linkEntity));

if (haltMotionComp->Data() != this->dataPtr->haltMotionState)
if (this->dataPtr->haltMode &&
haltMotionComp->Data() != this->dataPtr->haltMotionState)
{
haltMotionComp->Data() = this->dataPtr->haltMotionState;
}

0 comments on commit 19acc8d

Please sign in to comment.