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