util.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 # -*- coding: utf-8 -*-
00003 
00004 from roslib.message import get_message_class
00005 
00006 
00007 def get_slot_type_field_names(msg, slot_type, field_name=None, found=None):
00008     if field_name is None:
00009         field_name = ''
00010     if found is None:
00011         found = []
00012     if msg is None:
00013         return []
00014 
00015     for slot, slot_t in zip(msg.__slots__, msg._slot_types):
00016         deeper_field_name = field_name + '/' + slot
00017         if slot_t == slot_type:
00018             found.append(deeper_field_name)
00019         elif slot_t == slot_type + '[]':
00020             # supports array of type field like string[]
00021             deeper_field_name += '[]'
00022             found.append(deeper_field_name)
00023         try:
00024             if slot_t.endswith('[]'):
00025                 # supports array of ros message like std_msgs/Header[]
00026                 deeper_field_name += '[]'
00027                 slot_t = slot_t.rstrip('[]')
00028             msg_impl = get_message_class(slot_t)
00029         except ValueError:
00030             continue
00031         found = get_slot_type_field_names(msg_impl, slot_type,
00032                                           deeper_field_name, found)
00033     return found


jsk_rqt_plugins
Author(s):
autogenerated on Sun Sep 13 2015 22:29:48