diff --git a/franka_gazebo/src/franka_hw_sim.cpp b/franka_gazebo/src/franka_hw_sim.cpp index fb80907b2..15d353339 100644 --- a/franka_gazebo/src/franka_hw_sim.cpp +++ b/franka_gazebo/src/franka_hw_sim.cpp @@ -35,14 +35,12 @@ 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;