$search
00001 """autogenerated by genmsg_py from CommonHeader.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 00006 class CommonHeader(roslib.message.Message): 00007 _md5sum = "cb573def7f5977ee910df3469d33c060" 00008 _type = "applanix_msgs/CommonHeader" 00009 _has_header = False #flag to mark the presence of a Header object 00010 _full_text = """string START_GROUP=$GRP 00011 string START_MESSAGE=$MSG 00012 00013 uint8[4] start 00014 uint16 id 00015 uint16 length 00016 00017 """ 00018 # Pseudo-constants 00019 START_GROUP = '$GRP' 00020 START_MESSAGE = '$MSG' 00021 00022 __slots__ = ['start','id','length'] 00023 _slot_types = ['uint8[4]','uint16','uint16'] 00024 00025 def __init__(self, *args, **kwds): 00026 """ 00027 Constructor. Any message fields that are implicitly/explicitly 00028 set to None will be assigned a default value. The recommend 00029 use is keyword arguments as this is more robust to future message 00030 changes. You cannot mix in-order arguments and keyword arguments. 00031 00032 The available fields are: 00033 start,id,length 00034 00035 @param args: complete set of field values, in .msg order 00036 @param kwds: use keyword arguments corresponding to message field names 00037 to set specific fields. 00038 """ 00039 if args or kwds: 00040 super(CommonHeader, self).__init__(*args, **kwds) 00041 #message fields cannot be None, assign default values for those that are 00042 if self.start is None: 00043 self.start = chr(0)*4 00044 if self.id is None: 00045 self.id = 0 00046 if self.length is None: 00047 self.length = 0 00048 else: 00049 self.start = chr(0)*4 00050 self.id = 0 00051 self.length = 0 00052 00053 def _get_types(self): 00054 """ 00055 internal API method 00056 """ 00057 return self._slot_types 00058 00059 def serialize(self, buff): 00060 """ 00061 serialize message into buffer 00062 @param buff: buffer 00063 @type buff: StringIO 00064 """ 00065 try: 00066 _x = self.start 00067 # - if encoded as a list instead, serialize as bytes instead of string 00068 if type(_x) in [list, tuple]: 00069 buff.write(_struct_4B.pack(*_x)) 00070 else: 00071 buff.write(_struct_4s.pack(_x)) 00072 _x = self 00073 buff.write(_struct_2H.pack(_x.id, _x.length)) 00074 except struct.error as se: self._check_types(se) 00075 except TypeError as te: self._check_types(te) 00076 00077 def deserialize(self, str): 00078 """ 00079 unpack serialized message in str into this message instance 00080 @param str: byte array of serialized message 00081 @type str: str 00082 """ 00083 try: 00084 end = 0 00085 start = end 00086 end += 4 00087 self.start = str[start:end] 00088 _x = self 00089 start = end 00090 end += 4 00091 (_x.id, _x.length,) = _struct_2H.unpack(str[start:end]) 00092 return self 00093 except struct.error as e: 00094 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00095 00096 00097 def serialize_numpy(self, buff, numpy): 00098 """ 00099 serialize message with numpy array types into buffer 00100 @param buff: buffer 00101 @type buff: StringIO 00102 @param numpy: numpy python module 00103 @type numpy module 00104 """ 00105 try: 00106 _x = self.start 00107 # - if encoded as a list instead, serialize as bytes instead of string 00108 if type(_x) in [list, tuple]: 00109 buff.write(_struct_4B.pack(*_x)) 00110 else: 00111 buff.write(_struct_4s.pack(_x)) 00112 _x = self 00113 buff.write(_struct_2H.pack(_x.id, _x.length)) 00114 except struct.error as se: self._check_types(se) 00115 except TypeError as te: self._check_types(te) 00116 00117 def deserialize_numpy(self, str, numpy): 00118 """ 00119 unpack serialized message in str into this message instance using numpy for array types 00120 @param str: byte array of serialized message 00121 @type str: str 00122 @param numpy: numpy python module 00123 @type numpy: module 00124 """ 00125 try: 00126 end = 0 00127 start = end 00128 end += 4 00129 self.start = str[start:end] 00130 _x = self 00131 start = end 00132 end += 4 00133 (_x.id, _x.length,) = _struct_2H.unpack(str[start:end]) 00134 return self 00135 except struct.error as e: 00136 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00137 00138 _struct_I = roslib.message.struct_I 00139 _struct_2H = struct.Struct("<2H") 00140 _struct_4B = struct.Struct("<4B") 00141 _struct_4s = struct.Struct("<4s")