Skip to content

Commit

Permalink
Fix #247 (#248)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fixit-Davide authored Mar 15, 2024
1 parent c5b0b90 commit 94745e6
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 @@ -234,15 +234,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 94745e6

Please sign in to comment.