$search
00001 """autogenerated by genmsg_py from CompressedImage.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 import std_msgs.msg 00006 00007 class CompressedImage(roslib.message.Message): 00008 _md5sum = "8f7a12909da2c9d3332d540a0977563f" 00009 _type = "sensor_msgs/CompressedImage" 00010 _has_header = True #flag to mark the presence of a Header object 00011 _full_text = """# This message contains a compressed image 00012 00013 Header header # Header timestamp should be acquisition time of image 00014 # Header frame_id should be optical frame of camera 00015 # origin of frame should be optical center of cameara 00016 # +x should point to the right in the image 00017 # +y should point down in the image 00018 # +z should point into to plane of the image 00019 00020 string format # Specifies the format of the data 00021 # Acceptable values: 00022 # jpeg, png 00023 uint8[] data # Compressed image buffer 00024 00025 ================================================================================ 00026 MSG: std_msgs/Header 00027 # Standard metadata for higher-level stamped data types. 00028 # This is generally used to communicate timestamped data 00029 # in a particular coordinate frame. 00030 # 00031 # sequence ID: consecutively increasing ID 00032 uint32 seq 00033 #Two-integer timestamp that is expressed as: 00034 # * stamp.secs: seconds (stamp_secs) since epoch 00035 # * stamp.nsecs: nanoseconds since stamp_secs 00036 # time-handling sugar is provided by the client library 00037 time stamp 00038 #Frame this data is associated with 00039 # 0: no frame 00040 # 1: global frame 00041 string frame_id 00042 00043 """ 00044 __slots__ = ['header','format','data'] 00045 _slot_types = ['Header','string','uint8[]'] 00046 00047 def __init__(self, *args, **kwds): 00048 """ 00049 Constructor. Any message fields that are implicitly/explicitly 00050 set to None will be assigned a default value. The recommend 00051 use is keyword arguments as this is more robust to future message 00052 changes. You cannot mix in-order arguments and keyword arguments. 00053 00054 The available fields are: 00055 header,format,data 00056 00057 @param args: complete set of field values, in .msg order 00058 @param kwds: use keyword arguments corresponding to message field names 00059 to set specific fields. 00060 """ 00061 if args or kwds: 00062 super(CompressedImage, self).__init__(*args, **kwds) 00063 #message fields cannot be None, assign default values for those that are 00064 if self.header is None: 00065 self.header = std_msgs.msg._Header.Header() 00066 if self.format is None: 00067 self.format = '' 00068 if self.data is None: 00069 self.data = '' 00070 else: 00071 self.header = std_msgs.msg._Header.Header() 00072 self.format = '' 00073 self.data = '' 00074 00075 def _get_types(self): 00076 """ 00077 internal API method 00078 """ 00079 return self._slot_types 00080 00081 def serialize(self, buff): 00082 """ 00083 serialize message into buffer 00084 @param buff: buffer 00085 @type buff: StringIO 00086 """ 00087 try: 00088 _x = self 00089 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00090 _x = self.header.frame_id 00091 length = len(_x) 00092 buff.write(struct.pack('<I%ss'%length, length, _x)) 00093 _x = self.format 00094 length = len(_x) 00095 buff.write(struct.pack('<I%ss'%length, length, _x)) 00096 _x = self.data 00097 length = len(_x) 00098 # - if encoded as a list instead, serialize as bytes instead of string 00099 if type(_x) in [list, tuple]: 00100 buff.write(struct.pack('<I%sB'%length, length, *_x)) 00101 else: 00102 buff.write(struct.pack('<I%ss'%length, length, _x)) 00103 except struct.error as se: self._check_types(se) 00104 except TypeError as te: self._check_types(te) 00105 00106 def deserialize(self, str): 00107 """ 00108 unpack serialized message in str into this message instance 00109 @param str: byte array of serialized message 00110 @type str: str 00111 """ 00112 try: 00113 if self.header is None: 00114 self.header = std_msgs.msg._Header.Header() 00115 end = 0 00116 _x = self 00117 start = end 00118 end += 12 00119 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00120 start = end 00121 end += 4 00122 (length,) = _struct_I.unpack(str[start:end]) 00123 start = end 00124 end += length 00125 self.header.frame_id = str[start:end] 00126 start = end 00127 end += 4 00128 (length,) = _struct_I.unpack(str[start:end]) 00129 start = end 00130 end += length 00131 self.format = str[start:end] 00132 start = end 00133 end += 4 00134 (length,) = _struct_I.unpack(str[start:end]) 00135 start = end 00136 end += length 00137 self.data = str[start:end] 00138 return self 00139 except struct.error as e: 00140 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00141 00142 00143 def serialize_numpy(self, buff, numpy): 00144 """ 00145 serialize message with numpy array types into buffer 00146 @param buff: buffer 00147 @type buff: StringIO 00148 @param numpy: numpy python module 00149 @type numpy module 00150 """ 00151 try: 00152 _x = self 00153 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00154 _x = self.header.frame_id 00155 length = len(_x) 00156 buff.write(struct.pack('<I%ss'%length, length, _x)) 00157 _x = self.format 00158 length = len(_x) 00159 buff.write(struct.pack('<I%ss'%length, length, _x)) 00160 _x = self.data 00161 length = len(_x) 00162 # - if encoded as a list instead, serialize as bytes instead of string 00163 if type(_x) in [list, tuple]: 00164 buff.write(struct.pack('<I%sB'%length, length, *_x)) 00165 else: 00166 buff.write(struct.pack('<I%ss'%length, length, _x)) 00167 except struct.error as se: self._check_types(se) 00168 except TypeError as te: self._check_types(te) 00169 00170 def deserialize_numpy(self, str, numpy): 00171 """ 00172 unpack serialized message in str into this message instance using numpy for array types 00173 @param str: byte array of serialized message 00174 @type str: str 00175 @param numpy: numpy python module 00176 @type numpy: module 00177 """ 00178 try: 00179 if self.header is None: 00180 self.header = std_msgs.msg._Header.Header() 00181 end = 0 00182 _x = self 00183 start = end 00184 end += 12 00185 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00186 start = end 00187 end += 4 00188 (length,) = _struct_I.unpack(str[start:end]) 00189 start = end 00190 end += length 00191 self.header.frame_id = str[start:end] 00192 start = end 00193 end += 4 00194 (length,) = _struct_I.unpack(str[start:end]) 00195 start = end 00196 end += length 00197 self.format = str[start:end] 00198 start = end 00199 end += 4 00200 (length,) = _struct_I.unpack(str[start:end]) 00201 start = end 00202 end += length 00203 self.data = str[start:end] 00204 return self 00205 except struct.error as e: 00206 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00207 00208 _struct_I = roslib.message.struct_I 00209 _struct_3I = struct.Struct("<3I")