ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
2

pr2: writing a realtime joint controller

asked 2012-10-07 20:28:08 -0500

ccm gravatar image

updated 2014-11-22 17:05:13 -0500

ngrennan gravatar image

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 ...
(more)
edit retag flag offensive close merge delete

Comments

Are you sure your controller is running?

arzhed gravatar image arzhed  ( 2012-10-29 00:37:30 -0500 )edit

yes, what I did is in written in "EDIT2"

ccm gravatar image ccm  ( 2012-10-31 18:16:04 -0500 )edit

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

arzhed gravatar image arzhed  ( 2012-11-02 00:33:26 -0500 )edit

Yes, I do see it. updates in more detail in Edit3. Thanks a lot! :)

ccm gravatar image ccm  ( 2012-11-05 16:48:29 -0500 )edit

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

joseescobar60 gravatar image joseescobar60  ( 2012-11-05 22:35:59 -0500 )edit

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.

ccm gravatar image ccm  ( 2012-11-06 01:57:33 -0500 )edit

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.

arzhed gravatar image arzhed  ( 2012-11-07 21:08:41 -0500 )edit

3 Answers

Sort by ยป oldest newest most voted
2

answered 2012-10-11 23:33:46 -0500

arzhed gravatar image

updated 2012-11-07 02:05:16 -0500

Hi

The warning tells you to declare "my_controller_pkg/MyControllerPlugin" instead of "MyControllerPlugin" when you set your parameters to the parameter server. So the good command is :

rosparam set my_controller_name/type my_controller_pkg/MyControllerPlugin

I don't know what the problem is in Gazebo, but there might be a conflict due to your controller name. As it is said in the tutorial, if you use a yaml file, it should look like this :

my_controller_name:
    type: my_controller_pkg/MyControllerPlugin
    joint_name: r_shoulder_pan_joint

You may try another controller name.

Hope that helps.

edit flag offensive delete link more

Comments

what supposed is the controller name arthur???

joseescobar60 gravatar image joseescobar60  ( 2012-11-05 22:57:27 -0500 )edit

You can chose whatever name you want. It is the name you have to use when starting the controller using the pr2_controller_manager script. Also, I guess the indentation of the above yaml snipped is wrong. I take the liberty to edit @Arthur S. post (he can always revoke it if I'm wrong).

Lorenz gravatar image Lorenz  ( 2012-11-05 23:03:07 -0500 )edit

i'm using a lot of names but anyone works, when i run "rosrun pr2_controller_manager pr2_controller_manager list-type" my controller doesn't appaer and if i follow the tutorial i obtain a error with "rosrun pr2_controller_manager pr2_controller_manager load my_controller_name"

joseescobar60 gravatar image joseescobar60  ( 2012-11-05 23:07:23 -0500 )edit

Your problem probably has noting to do with the controller name. Is your package in the ROS_PACKAGE_PATH and is the plugin registered correctly (in a plugin xml file and in manifest.xml). I think it might be best if you open a separate question for that issue, provide all relevant information there.

Lorenz gravatar image Lorenz  ( 2012-11-06 00:03:36 -0500 )edit
1

Thx Lorenz. I updated it again since both code lines where not coherent. My advice to ccm was to use a different name for the controller and the plugin to declare it right, especially in that line from the tutorial : PLUGINLIB_DECLARE_CLASS(my_controller_pkg, ..., ...). Check files Lorenz told u to

arzhed gravatar image arzhed  ( 2012-11-07 02:16:56 -0500 )edit
1

answered 2012-12-06 04:00:42 -0500

Xiaolong gravatar image

Hi ccm, I have the same problem: everything is all right, but nothing happened in gazebo. I want to know did you solve your problem? Thank you.

edit flag offensive delete link more

Comments

no, I haven't solved it yet. :x

ccm gravatar image ccm  ( 2012-12-06 12:30:12 -0500 )edit
1

Hey guys, I just had the same problem but once I pressed reset in Gazebo everything started to work fine

MartinW gravatar image MartinW  ( 2013-02-05 10:52:59 -0500 )edit
0

answered 2015-06-29 23:20:22 -0500

jiangxihj gravatar image

you should stop the r_arm_controller first, use: "rosrun pr2_controller_manager pr2_controller_manager stop r_arm_controller".

edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-10-07 20:28:08 -0500

Seen: 649 times

Last updated: Dec 06 '12