Skip to content

Commit

Permalink
Added parameters robot_param and robot_param_node (#275) (#280)
Browse files Browse the repository at this point in the history
Signed-off-by: Alejandro Hernández Cordero <[email protected]>
(cherry picked from commit 53b6c74)

Co-authored-by: Alejandro Hernández Cordero <[email protected]>
  • Loading branch information
mergify[bot] and ahcorde authored Apr 24, 2024
1 parent 492ed64 commit c3f2a96
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions gz_ros2_control/src/gz_ros2_control_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,9 @@ class GazeboSimROS2ControlPluginPrivate
controller_manager_{nullptr};

/// \brief String with the robot description param_name
// TODO(ahcorde): Add param in plugin tag
std::string robot_description_ = "robot_description";

/// \brief String with the name of the node that contains the robot_description
// TODO(ahcorde): Add param in plugin tag
std::string robot_description_node_ = "robot_state_publisher";

/// \brief Last time the update method was called
Expand Down Expand Up @@ -285,6 +283,23 @@ void GazeboSimROS2ControlPlugin::Configure(
return;
}

// Get params from SDF
std::string robot_param_node = _sdf->Get<std::string>("robot_param_node");
if (!robot_param_node.empty()) {
this->dataPtr->robot_description_node_ = robot_param_node;
}
RCLCPP_INFO(
logger,
"robot_param_node is %s", this->dataPtr->robot_description_node_.c_str());

std::string robot_description = _sdf->Get<std::string>("robot_param");
if (!robot_description.empty()) {
this->dataPtr->robot_description_ = robot_description;
}
RCLCPP_INFO(
logger,
"robot_param_node is %s", this->dataPtr->robot_description_.c_str());

std::vector<std::string> arguments = {"--ros-args"};

auto sdfPtr = const_cast<sdf::Element *>(_sdf.get());
Expand Down

0 comments on commit c3f2a96

Please sign in to comment.