rosservice: allow dictionary as main argument, though prefer list

This commit is contained in:
Ken Conley 2009-09-22 02:08:01 +00:00
parent f82ce3bb84
commit d8b2ec8f39
1 changed files with 7 additions and 2 deletions

View File

@ -334,6 +334,11 @@ def call_service(service_name, service_args, service_class=None):
request = service_class._request_class()
try:
roslib.message.fill_message_args(request, service_args)
except roslib.message.ROSMessageException:
# check to see if we have a single, dictionary argument instead
if len(service_args) == 1 and type(service_args[0]) == dict:
try:
roslib.message.fill_message_args(request, service_args[0])
except roslib.message.ROSMessageException:
raise ROSServiceException("Not enough arguments to call service.\n"+\
"Args are: [%s]"%roslib.message.get_printable_message_args(request))