From 24321eef10488b555609d58371ddba885a63bef6 Mon Sep 17 00:00:00 2001 From: rickstaa Date: Sun, 3 Sep 2023 22:14:21 +0200 Subject: [PATCH] refactor(franka_gazebo): remove FrankaHWSim robot namespace warning This commit removes the robot namespace warning found in the FrankaHWSim since it is no longer needed now that #196 has been merged. It also replaced the 'arm_id' default with the model name. --- CHANGELOG.md | 1 + franka_gazebo/src/franka_hw_sim.cpp | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a075741f..b822d7980 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ Requires `libfranka` >= 0.8.0 * `franka_description`: `` macro now supports to customize the `parent` frame and its `xyz` + `rpy` offset * `franka_hw`: Fix the bug where the previous controller is still running after switching the controller. ([#326](https://github.com/frankaemika/franka_ros/issues/326)) * `franka_gazebo`: Add `set_franka_model_configuration` service. + * `franka_gazebo`: remove FrankaHWSim robot namespace warning ## 0.10.1 - 2022-09-15 diff --git a/franka_gazebo/src/franka_hw_sim.cpp b/franka_gazebo/src/franka_hw_sim.cpp index fb80907b2..8a0c1ed9b 100644 --- a/franka_gazebo/src/franka_hw_sim.cpp +++ b/franka_gazebo/src/franka_hw_sim.cpp @@ -35,14 +35,14 @@ bool FrankaHWSim::initSim(const std::string& robot_namespace, gazebo::physics::ModelPtr parent, const urdf::Model* const urdf, std::vector transmissions) { - model_nh.param("arm_id", this->arm_id_, robot_namespace); - if (this->arm_id_ != robot_namespace) { - ROS_WARN_STREAM_NAMED( - "franka_hw_sim", - "Caution: Robot names differ! Read 'arm_id: " - << this->arm_id_ << "' from parameter server but URDF defines '" - << robot_namespace << "'. Will use '" << this->arm_id_ << "'!"); + // Try to get the arm_id from the robot_namespace otherwise use the model name. + if (!model_nh.hasParam("arm_id")) { + ROS_WARN_STREAM_NAMED("franka_hw_sim", "No 'arm_id' found on '" << model_nh.getNamespace() + << "' parameter namespace." + << " Using model name instead (" + << parent->GetName() << ")."); } + model_nh.param("arm_id", this->arm_id_, parent->GetName()); this->robot_ = parent; this->robot_initialized_ = false;