ROS Resources: Documentation | Support | Discussion Forum | Service Status | Q&A answers.ros.org
Ask Your Question
0

Error Message for failed Service Call

asked 2011-10-20 03:46:13 -0500

Mimax gravatar image

updated 2011-10-23 05:28:25 -0500

kwc gravatar image

Hi there,

i've already looked into the roswiki and answers. Unfortunately answer.ros search gave me quite a lot of finding for Error and Service... :)

my question is related to failed service calls. Usually a service call returne true. But what if a service call fails. For instance the parameters sent where not valid or some function within the service throws an error.

In this case i would just return a boolean false within the service call and if i call this service by "rosservice call /service param1 param2" in the shell i get and error message:

ERROR: service [/service] responded with an error:

However I haven't seen any way to add an message to failed service call? Is there any way to do this?

cheers Mimax

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2011-10-20 20:30:41 -0500

Lorenz gravatar image

Roscpp doesn't support passing error messages to the caller as far as I know. If that's possible for you, you can change the service definition to include an error code in the result. Then, instead of returning false from the service callback, you can fill in the error code and return true.

When using rospy, you can raise a ServiceException which contains an error message. That message is passed to a rospy client. You can find more information on that here.

edit flag offensive delete link more

Comments

thanks for your answer. Unfortunately i'm using cpp. I could modify my return definitons... I also have thought about it.. but i don't like it since the service would return as true and i actually wanted to use a standardizes way of returning the error. do you know if there are any plans to
Mimax gravatar imageMimax ( 2011-10-20 21:17:42 -0500 )edit
implement the ServiceException within roscpp? Well i could write a pythonbased service wrapper for my roscpp services ;)......
Mimax gravatar imageMimax ( 2011-10-20 21:22:55 -0500 )edit
Not as far as I know, but you could file a feature request ticket at https://code.ros.org/trac/ros/
Lorenz gravatar imageLorenz ( 2011-10-20 21:23:19 -0500 )edit
Allright, i'll wait for some days and see whether there is any other input here and file a request.
Mimax gravatar imageMimax ( 2011-10-21 00:04:52 -0500 )edit
Please do remember to accept this answer before you forget about it so others know it answers your query. Just click the checkbox next to the thumbs up/down buttons.
tfoote gravatar imagetfoote ( 2011-10-23 18:49:47 -0500 )edit
Allright i do that know. I just wanted to wait to see whether there are any opinions during last weekend.
Mimax gravatar imageMimax ( 2011-10-23 21:12:08 -0500 )edit

Your Answer

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

Add Answer

Question Tools

Stats

Asked: 2011-10-20 03:46:13 -0500

Seen: 3,255 times

Last updated: Oct 20 '11