util.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 
4 from roslib.message import get_message_class
5 
6 
7 def get_slot_type_field_names(msg, slot_type, field_name=None, found=None):
8  if field_name is None:
9  field_name = ''
10  if found is None:
11  found = []
12  if msg is None:
13  return []
14 
15  for slot, slot_t in zip(msg.__slots__, msg._slot_types):
16  deeper_field_name = field_name + '/' + slot
17  if slot_t == slot_type:
18  found.append(deeper_field_name)
19  elif slot_t == slot_type + '[]':
20  # supports array of type field like string[]
21  deeper_field_name += '[]'
22  found.append(deeper_field_name)
23  try:
24  if slot_t.endswith('[]'):
25  # supports array of ros message like std_msgs/Header[]
26  deeper_field_name += '[]'
27  slot_t = slot_t.rstrip('[]')
28  msg_impl = get_message_class(slot_t)
29  except ValueError:
30  continue
31  found = get_slot_type_field_names(msg_impl, slot_type,
32  deeper_field_name, found)
33  return found
def get_slot_type_field_names(msg, slot_type, field_name=None, found=None)
Definition: util.py:7


jsk_rqt_plugins
Author(s):
autogenerated on Fri Feb 5 2021 04:03:20