Ask Your Question

can't access std_srvs

asked 2012-02-24 08:09:05 -0500

cassander gravatar image

The turtlesim node offers a service called "/reset" that allows me to reset the position of the turtle. The type of message accepted by the "/reset" service is of type


I tried to do,

import std_srvs
from std_srvs.srv import Empty

but it didn't work. I kept getting error messages saying std_srvs couldn't be found. I then tried adding 'std_srvs' as one of the dependencies in the manifest file of the package. Now the node was able to access std_srvs but not 'Empty'. Finally I had to do,

roscp std_srvs Empty mypackage/srv

and then rosmake and finally it worked.

Could someone please tell me, why I wasn't able to access std_srv.Empty before copying it to the srv folder in my package?


edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2012-02-24 08:16:21 -0500

DimitriProsser gravatar image

updated 2012-02-24 08:26:17 -0500

You must include the following before importing any ROS packages:

import roslib; roslib.load_manifest('package_name')


You must also have the packages that you want to use in your manifest.xml.

Here's an example... If your package is called "beginner_tutorials", you would put the following in your node:

import roslib; roslib.load_manifest('beginner_tutorials')

If your node uses the std_srvs package, your manifest.xml file must contain the following line:

<depend package="std_srvs" />
edit flag offensive delete link more


I got those errors I mentioned earlier in spite of having that line which you have mentioned. But did you mean to say I should have had the line "import roslib; roslib.load_manifest('std_srvs')"? I don't suppose so..

cassander gravatar image cassander  ( 2012-02-24 08:19:45 -0500 )edit

answered 2014-03-25 08:31:52 -0500

efrainra7 gravatar image

updated 2014-03-25 08:34:02 -0500

i did try this: atention for type Empty into msg and srv

for import msg

from std_msgs.msg import String, Float32, Empty

for import service - without problem Empty

import std_srvs.srv

publish message


call service

rospy.ServiceProxy('ardrone/flattrim', std_srvs.srv.Empty())

good luck!

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2012-02-24 08:09:05 -0500

Seen: 3,398 times

Last updated: Mar 25 '14