Skip to content

Commit

Permalink
Check if params already declared.
Browse files Browse the repository at this point in the history
  • Loading branch information
livanov93 committed Aug 25, 2021
1 parent 176c062 commit f996475
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,12 @@ JointTrajectoryController::on_configure(const rclcpp_lifecycle::State &)
// declare per joint parameters
for (auto i = 0ul; i < joint_names_.size(); ++i) {
const std::string prefix = "constraints." + joint_names_[i];
node_->declare_parameter<double>(prefix + ".trajectory", 0.0);
node_->declare_parameter<double>(prefix + ".goal", 0.0);
if (!node_->has_parameter(prefix + ".trajectory")){
node_->declare_parameter<double>(prefix + ".trajectory", 0.0);
}
if (!node_->has_parameter(prefix + ".trajectory")) {
node_->declare_parameter<double>(prefix + ".goal", 0.0);
}
}

if (!reset()) {
Expand Down

0 comments on commit f996475

Please sign in to comment.