parameters: (field_type, default_package = None)
return_statement: return instance
docstring: returns a single instance of field_type, where field_type can be a
      message or ros primitive or an flexible size array.
docstring_summary: returns a single instance of field_type, where field_type can be a
      message or ros primitive or an flexible size array.
docstring_tokens: returns a single instance of field_type where field_type can be a message or ros primitive or an flexible size array .
function: def get_array_type_instance(field_type, default_package = None):
      """
      returns a single instance of field_type, where field_type can be a
      message or ros primitive or an flexible size array.
      """
      field_type = field_type.strip().rstrip("[]")
      if field_type == "empty":
          return None
      if not "/" in field_type:
          # is either built-in, Header, or in same package
          # it seems built-in types get a priority
          if field_type in ['byte', 'int8', 'int16', 'int32', 'int64',\
                            'char', 'uint8', 'uint16', 'uint32', 'uint64']:
              return 0
          elif field_type in ['float32', 'float64']:
              return 0
          elif field_type in ['string']:
              return ""
          elif field_type == 'bool':
              return False
          elif field_type == 'time':
              field_type = "std_msgs/Time"
          elif field_type == 'duration':
              field_type = "std_msgs/Duration"
          elif field_type == 'Header':
              field_type = "std_msgs/Header"
          else:
              if default_package is None:
                  return None
              field_type = default_package + "/" + field_type
      msg_class = roslib.message.get_message_class(field_type)
      if (msg_class == None):
          # not important enough to raise exception?
          return None
      instance = msg_class()
      return instance
function_tokens: def get_array_type_instance ( field_type , default_package = None ) : field_type = field_type . strip ( ) . rstrip ( "[]" ) if field_type == "empty" : return None if not "/" in field_type : # is either built-in, Header, or in same package # it seems built-in types get a priority if field_type in [ 'byte' , 'int8' , 'int16' , 'int32' , 'int64' , 'char' , 'uint8' , 'uint16' , 'uint32' , 'uint64' ] : return 0 elif field_type in [ 'float32' , 'float64' ] : return 0 elif field_type in [ 'string' ] : return "" elif field_type == 'bool' : return False elif field_type == 'time' : field_type = "std_msgs/Time" elif field_type == 'duration' : field_type = "std_msgs/Duration" elif field_type == 'Header' : field_type = "std_msgs/Header" else : if default_package is None : return None field_type = default_package + "/" + field_type msg_class = roslib . message . get_message_class ( field_type ) if ( msg_class == None ) : # not important enough to raise exception? return None instance = msg_class ( ) return instance