We can define the plugin definition file, which is given in the following code. The plugin file is being saved inside the package folder under the name of controller_plugins.xml:
<library path="lib/libmy_controller_lib"> <class name="my_controller_ns/MyControllerClass" type="my_controller_ns::MyControllerClass" base_class_type="controller_interface::ControllerBase" /> </library>