We can define the plugin definition file, which is given in the following. The plugin file is being saved inside the package folder with a name of controller_plugins.xml:
<library path="lib/libmy_controller_lib">
<class name="my_controller_pkg/MyControllerPlugin"
type="my_controller_ns::MyControllerClass"
base_class_type="pr2_controller_interface::Controller" />
</library>