Using Controller Manager and getting it to work.
Hi all
I'm trying to get a controller to run in a ros_control controller manager and followed the general principles listed on the ros_control git wiki.
Now in the controller manager runs in a non-realtime loop .
The controller init routine runs and completes successfully, however, no further starting(), stopping(), or update routines get run().
At various times, I have adjusted the interface setup on the controller to open some custom interfaces, and usually they cause the init() to fail (but with out any warnings that it will or does)
EDIT Here is the loggers for the controller manager program when rosservice /controller_manager/list_controllers is called: <since removed="">
ANSWER If you aren't interested in following the comment thread attached to adolfo's answer, the problem was summed up by: 1. Not understanding how the controller manager started and stopped controllers. 2. Getting the services on the controller manager to work.
The controller manager has no exposed start or stop routine or service. Instead the user has to use switch_controllers(startcontroller, stopcontroller, strictness). or the equivalent service. To use a controller, it must first be loaded by the controller_manager, using load_controller(controller), and then started. To perform a start of a newly loaded controller, the switch_controllers() routine is used with an empty field for the stopcontroller. Strictness has value of 1 (accepts errors) or 2 (switch must be perfect (STRICT)). The service call is:
rosservice call /controller_manager/switch_controllers [starting_controller_name] [stopping_controller_name] 1
If you find that the controller_manager is not processing the service calls but instead 'freezes' then your hardware implementation program is not effectively dealing with the callbacks of the controller_manager (and possibly your controller)
It was found that a specific ros::callbackqueue needed to be established for the implementation's nodehandle using nodehandle::setCallbackQueue()
. It was found that an AsyncSpinner was required to work on that queue, using the ros::AsyncSpinner spinner(0, &my_callback_queue);
This allowed the spinner to explicitly work on the callbacks passed to the nodehandle. As this nodehandle was passed to the controller manager, the controller manager service callbacks were also pushed onto this queue. This link details the different ways of dealing with callbacks and spinners. Section 4 covers the details of the method that worked.
Thanks to Adolfo for his perserverence and help in resolving this matter.
looking through controller_manager/controller_manager.cpp, I cant see where the cm is starting the controllers. in ControllerManager::loadcontroller(). The init routine is run, but the cm does not go on to start the controllers. The update() only seems to apply to those that are running.