Skip to content

Commit

Permalink
changes baed on suggestions
Browse files Browse the repository at this point in the history
Signed-off-by: root <[email protected]>
  • Loading branch information
cjds committed Jun 17, 2021
1 parent b871fce commit 58a7bca
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/systems/joint_controller/JointController.cc
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,10 @@ void JointController::Configure(const Entity &_entity,
{
ignerr << "Joint with name[" << this->dataPtr->jointName << "] not found. "
<< "The JointController will not control this joint.\n";
return;
}

validConfig = true;
if (_sdf->HasElement("initial_velocity"))
{
this->dataPtr->jointVelCmd = _sdf->Get<double>("initial_velocity");
Expand Down Expand Up @@ -185,17 +187,10 @@ void JointController::PreUpdate(const ignition::gazebo::UpdateInfo &_info,
{
ignwarn << "Detected jump back in time ["
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
<< "s]. System may not work properly." << std::endl;
}

// If the joint hasn't been identified yet, look for it
if (this->dataPtr->jointEntity == kNullEntity)
{
this->dataPtr->jointEntity =
this->dataPtr->model.JointByName(_ecm, this->dataPtr->jointName);
<< "s]. System will not work properly." << std::endl;
}

if (this->dataPtr->jointEntity == kNullEntity)
if (!validConfig)
return;

// Nothing left to do if paused.
Expand Down
3 changes: 3 additions & 0 deletions src/systems/joint_controller/JointController.hh
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ namespace systems

/// \brief Private data pointer
private: std::unique_ptr<JointControllerPrivate> dataPtr;

/// \brief Private tells us if the configuration is considered valid
bool validConfig = false;
};
}
}
Expand Down

0 comments on commit 58a7bca

Please sign in to comment.