diff --git a/controller_manager/controller_manager/launch_utils.py b/controller_manager/controller_manager/launch_utils.py index 14d0ad68d1..3bbb050433 100644 --- a/controller_manager/controller_manager/launch_utils.py +++ b/controller_manager/controller_manager/launch_utils.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import warnings from launch import LaunchDescription from launch.actions import DeclareLaunchArgument from launch.substitutions import LaunchConfiguration, PythonExpression @@ -21,7 +20,7 @@ def generate_load_controller_launch_description( - controller_name, controller_type=None, controller_params_file=None, extra_spawner_args=[] + controller_name, controller_params_file=None, extra_spawner_args=[] ): """ Generate launch description for loading a controller using spawner. @@ -32,13 +31,12 @@ def generate_load_controller_launch_description( Examples -------- - # Assuming the controller type and controller parameters are known to the controller_manager + # Assuming the controller parameters are known to the controller_manager generate_load_controller_launch_description('joint_state_broadcaster') - # Passing controller type and controller parameter file to load + # Passing controller parameter file to load the controller (Controller type is retrieved from config file) generate_load_controller_launch_description( 'joint_state_broadcaster', - controller_type='joint_state_broadcaster/JointStateBroadcaster', controller_params_file=os.path.join(get_package_share_directory('my_pkg'), 'config', 'controller_params.yaml'), extra_spawner_args=[--load-only] @@ -62,15 +60,6 @@ def generate_load_controller_launch_description( LaunchConfiguration("controller_manager_name"), ] - if controller_type: - warnings.warn( - "The 'controller_type' argument is deprecated and will be removed in future releases." - " Declare the controller type parameter in the param file instead.", - DeprecationWarning, - stacklevel=2, - ) - spawner_arguments += ["--controller-type", controller_type] - if controller_params_file: spawner_arguments += ["--param-file", controller_params_file] diff --git a/controller_manager/controller_manager/spawner.py b/controller_manager/controller_manager/spawner.py index dbefd360b9..2778bddebd 100644 --- a/controller_manager/controller_manager/spawner.py +++ b/controller_manager/controller_manager/spawner.py @@ -166,6 +166,7 @@ def main(args=None): "-p", "--param-file", help="Controller param file to be loaded into controller node before configure", + default=None, required=False, ) parser.add_argument( @@ -183,13 +184,6 @@ def main(args=None): action="store_true", required=False, ) - parser.add_argument( - "-t", - "--controller-type", - help="If not provided it should exist in the controller manager namespace (deprecated)", - default=None, - required=False, - ) parser.add_argument( "-u", "--unload-on-kill", @@ -227,14 +221,6 @@ def main(args=None): param_file = args.param_file controller_manager_timeout = args.controller_manager_timeout - if args.controller_type: - warnings.filterwarnings("always") - warnings.warn( - "The '--controller-type' argument is deprecated and will be removed in future releases." - " Declare the controller type parameter in the param file instead.", - DeprecationWarning, - ) - if param_file and not os.path.isfile(param_file): raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), param_file) @@ -258,7 +244,6 @@ def main(args=None): for controller_name in controller_names: fallback_controllers = args.fallback_controllers - controller_type = args.controller_type prefixed_controller_name = controller_name if controller_namespace: prefixed_controller_name = controller_namespace + "/" + controller_name @@ -270,10 +255,11 @@ def main(args=None): + bcolors.ENDC ) else: - if not controller_type and param_file: - controller_type = get_parameter_from_param_file( - controller_name, param_file, "type" - ) + controller_type = ( + None + if param_file is None + else get_parameter_from_param_file(controller_name, param_file, "type") + ) if controller_type: parameter = Parameter() parameter.name = prefixed_controller_name + ".type" diff --git a/controller_manager/test/test_spawner_unspawner.cpp b/controller_manager/test/test_spawner_unspawner.cpp index 7680d8270c..a7c2432959 100644 --- a/controller_manager/test/test_spawner_unspawner.cpp +++ b/controller_manager/test/test_spawner_unspawner.cpp @@ -244,22 +244,6 @@ TEST_F(TestLoadController, multi_ctrls_test_type_in_param) } } -TEST_F(TestLoadController, spawner_test_type_in_arg) -{ - // Provide controller type via -t argument - EXPECT_EQ( - call_spawner( - "ctrl_2 -c test_controller_manager -t " + - std::string(test_controller::TEST_CONTROLLER_CLASS_NAME)), - 0); - - ASSERT_EQ(cm_->get_loaded_controllers().size(), 1ul); - auto ctrl_2 = cm_->get_loaded_controllers()[0]; - ASSERT_EQ(ctrl_2.info.name, "ctrl_2"); - ASSERT_EQ(ctrl_2.info.type, test_controller::TEST_CONTROLLER_CLASS_NAME); - ASSERT_EQ(ctrl_2.c->get_state().id(), lifecycle_msgs::msg::State::PRIMARY_STATE_ACTIVE); -} - TEST_F(TestLoadController, spawner_test_type_in_params_file) { const std::string test_file_path = ament_index_cpp::get_package_prefix("controller_manager") + diff --git a/doc/release_notes.rst b/doc/release_notes.rst index a4a6f31734..e2b22bf7a6 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -69,6 +69,7 @@ controller_manager The parameters within the ``ros2_control`` tag are not supported any more. * The support for the ``description`` parameter for loading the URDF was removed (`#1358 `_). +* The ``--controller-type`` or ``-t`` spawner arg is removed. Now the controller type is defined in the controller configuration file with ``type`` field (`#1639 `_). hardware_interface ******************