pr2: writing a realtime joint controller
I'm currently attempting this tutorial http://www.ros.org/wiki/pr2_mechanism/Tutorials/Running%20a%20realtime%20joint%20controller
Everything is okay until I reach this step:
Loading and Starting the Controller
Finally, we need to check if our controller got registered to the controller manager. To get the list of registered controllers, type:
$ rosrun pr2_controller_manager pr2_controller_manager list-types
Look in the output for our controller MyControllerPlugin. If it's there you're ready to load and start it.
I don't see MyControllerPlugin anywhere. I just tried to continue anyway by typing
rosrun pr2_controller_manager pr2_controller_manager load MyControllerPlugin
rosrun pr2_controller_manager pr2_controller_manager start MyControllerPlugin
The controller successfully loads in and starts in Terminal but nothing is happening in Gazebo. I did exactly as the tutorial said except I changed my_controller_name to MyControllerPlugin. Did I do something wrong?
The warning reflected after trying to run MyControllerPlugin is
[ WARN] [1349677273.168201399, 243.496000000]: The deprecated controller type MyControllerPlugin was not found. Using the namespaced version my_controller_pkg/MyControllerPlugin instead. Please update your configuration to use the namespaced version.
I'm running ubuntu 12.04 and Fuerte.
Thanks.
EDIT: I managed to get rid of the warnings by
rosparam set my_controller_pkg/MyControllerPlugin/type my_controller_pkg/MyControllerPlugin
&
rosparam set my_controller_pkg/MyControllerPlugin/joint_type r_shoulder_pan_joint
However, when I load and start the plugin, nothing happens on gazebo. PR2 just stands there doing nothing. Does anyone else have the same problem?
EDIT2(to Arthur): What I typed
rosrun pr2_controller_manager pr2_controller_manager load my_controller_pkg/MyControllerPlugin
rosrun pr2_controller_manager pr2_controller_manager start my_controller_pkg/MyControllerPlugin
rosrun pr2_controller_manager pr2_controller_manager list
The results showed that the plugin was running[my_controller_pkg/MyControllerPlugin (running)] but nothing was happening in the simulator. :(
EDIT3: Thanks Arthur. I see "my_controller_pkg/MyControllerPlugin" when I run "$ rosrun pr2_controller_manager pr2_controller_manager list-types"
I changed "rosparam set my_controller_pkg/MyControllerPlugin/type my_controller_pkg/MyControllerPlugin" to "rosparam set my_controller_name/type my_controller_pkg/MyControllerPlugin".
I also changed this respectively "rosparam set my_controller_pkg/MyControllerPlugin/joint_type r_shoulder_pan_joint" to " rosparam set my_controller_name/joint_type r_shoulder_pan_joint" Is that what you mean by not using the same name for Plugin and controller?
After loading and starting the controller I ran this command $ rosrun pr2_controller_manager pr2_controller_manager list and found this: my_controller_name ( running )
Pr2 is still not doing anything in the simulator. :s
EDIT4: I think I gave information very messily before so here is it again. I followed the tutorial (http://www.ros.org/wiki/pr2_mechanism/Tutorials/Writing%20a%20realtime%20joint%20controller) quite closely and managed to get it to load successfully with the help of Arthur. However, despite loading successfully, pr2 does not do anything in the simulator.
This is the code at the end of my_controller_file.cpp(exactly the same from tutorial)
PLUGINLIB_DECLARE_CLASS(my_controller_pkg,MyControllerPlugin, my_controller_ns::MyControllerClass, pr2_controller_interface::Controller)
This is my contoller_plugins.xml file
<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>
Step1
rosparam set my_controller_name/type my_controller_pkg/MyControllerPlugin
Step2
rosparam set my_controller_name/joint_name r_shoulder_pan_joint
Step3
rosparam get -p my_controller_name
I get
joint_name: r_shoulder_pan_joint
type: my_controller_pkg/MyControllerPlugin
Step4
rosrun pr2_controller_manager pr2_controller_manager list-types
I get(yes, my_controller_pkg/MyControllerPlugin is there)
JointGravityController
JointPendulumController
ethercat_trigger_controllers ...
Are you sure your controller is running?
yes, what I did is in written in "EDIT2"
Do you see your controller plugin when you type '$ rosrun pr2_controller_manager pr2_controller_manager list-types' now? Again, be careful not to use the same name for your controller and your plugin
Yes, I do see it. updates in more detail in Edit3. Thanks a lot! :)
i want to tell you about my problem in this same tutorial, i ran everything like the tutorial, but when a run "$ rosrun pr2_controller_manager pr2_controller_manager list-types" the controller dosen't appear, i'm thinking that the problem is the controller name, you can tell me de name of the contr
Just do exactly as Arthur said. Use "my_controller_pkg/MyControllerPlugin" instead of MyControllerPlugin. The controller should appear as "my_controller_pkg/MyControllerPlugin" when you run that command.
I see nothing wrong in EDIT 4 after quick overview, although I wonder why there are so many other controllers running... Did you print out the effort applied on the joint? It might be useful to see what is going on in the code itself.