Skip to content

Commit

Permalink
Fix #247 (#248)
Browse files Browse the repository at this point in the history
(cherry picked from commit 94745e6)
  • Loading branch information
Fixit-Davide authored and mergify[bot] committed Mar 15, 2024
1 parent 6b3f282 commit db449db
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions gz_ros2_control/src/gz_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,15 +204,14 @@ bool GazeboSimSystem::initSim(
this->dataPtr->joints_.resize(this->dataPtr->n_dof_);

constexpr double default_gain = 0.1;
if (!this->nh_->get_parameter_or(
"position_proportional_gain",
this->dataPtr->position_proportional_gain_, default_gain))
{
RCLCPP_WARN_STREAM(
this->nh_->get_logger(),
"The position_proportional_gain parameter was not defined, defaulting to: " <<
default_gain);
}

this->dataPtr->position_proportional_gain_ = this->nh_->declare_parameter<double>(
"position_proportional_gain", default_gain);

RCLCPP_INFO_STREAM(
this->nh_->get_logger(),
"The position_proportional_gain has been set to: " <<
this->dataPtr->position_proportional_gain_);

if (this->dataPtr->n_dof_ == 0) {
RCLCPP_ERROR_STREAM(this->nh_->get_logger(), "There is no joint available");
Expand Down

0 comments on commit db449db

Please sign in to comment.