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