$search
00001 """autogenerated by genmsg_py from grasp.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 00006 class grasp(roslib.message.Message): 00007 _md5sum = "cbd3885e5b559dd3c0fbffd8fcb36583" 00008 _type = "srs_object_database_msgs/grasp" 00009 _has_header = False #flag to mark the presence of a Header object 00010 _full_text = """int32 objectId 00011 string Objecttype 00012 string pose 00013 string fileDescription 00014 uint8[] bs 00015 int32 size 00016 00017 """ 00018 __slots__ = ['objectId','Objecttype','pose','fileDescription','bs','size'] 00019 _slot_types = ['int32','string','string','string','uint8[]','int32'] 00020 00021 def __init__(self, *args, **kwds): 00022 """ 00023 Constructor. Any message fields that are implicitly/explicitly 00024 set to None will be assigned a default value. The recommend 00025 use is keyword arguments as this is more robust to future message 00026 changes. You cannot mix in-order arguments and keyword arguments. 00027 00028 The available fields are: 00029 objectId,Objecttype,pose,fileDescription,bs,size 00030 00031 @param args: complete set of field values, in .msg order 00032 @param kwds: use keyword arguments corresponding to message field names 00033 to set specific fields. 00034 """ 00035 if args or kwds: 00036 super(grasp, self).__init__(*args, **kwds) 00037 #message fields cannot be None, assign default values for those that are 00038 if self.objectId is None: 00039 self.objectId = 0 00040 if self.Objecttype is None: 00041 self.Objecttype = '' 00042 if self.pose is None: 00043 self.pose = '' 00044 if self.fileDescription is None: 00045 self.fileDescription = '' 00046 if self.bs is None: 00047 self.bs = '' 00048 if self.size is None: 00049 self.size = 0 00050 else: 00051 self.objectId = 0 00052 self.Objecttype = '' 00053 self.pose = '' 00054 self.fileDescription = '' 00055 self.bs = '' 00056 self.size = 0 00057 00058 def _get_types(self): 00059 """ 00060 internal API method 00061 """ 00062 return self._slot_types 00063 00064 def serialize(self, buff): 00065 """ 00066 serialize message into buffer 00067 @param buff: buffer 00068 @type buff: StringIO 00069 """ 00070 try: 00071 buff.write(_struct_i.pack(self.objectId)) 00072 _x = self.Objecttype 00073 length = len(_x) 00074 buff.write(struct.pack('<I%ss'%length, length, _x)) 00075 _x = self.pose 00076 length = len(_x) 00077 buff.write(struct.pack('<I%ss'%length, length, _x)) 00078 _x = self.fileDescription 00079 length = len(_x) 00080 buff.write(struct.pack('<I%ss'%length, length, _x)) 00081 _x = self.bs 00082 length = len(_x) 00083 # - if encoded as a list instead, serialize as bytes instead of string 00084 if type(_x) in [list, tuple]: 00085 buff.write(struct.pack('<I%sB'%length, length, *_x)) 00086 else: 00087 buff.write(struct.pack('<I%ss'%length, length, _x)) 00088 buff.write(_struct_i.pack(self.size)) 00089 except struct.error as se: self._check_types(se) 00090 except TypeError as te: self._check_types(te) 00091 00092 def deserialize(self, str): 00093 """ 00094 unpack serialized message in str into this message instance 00095 @param str: byte array of serialized message 00096 @type str: str 00097 """ 00098 try: 00099 end = 0 00100 start = end 00101 end += 4 00102 (self.objectId,) = _struct_i.unpack(str[start:end]) 00103 start = end 00104 end += 4 00105 (length,) = _struct_I.unpack(str[start:end]) 00106 start = end 00107 end += length 00108 self.Objecttype = str[start:end] 00109 start = end 00110 end += 4 00111 (length,) = _struct_I.unpack(str[start:end]) 00112 start = end 00113 end += length 00114 self.pose = str[start:end] 00115 start = end 00116 end += 4 00117 (length,) = _struct_I.unpack(str[start:end]) 00118 start = end 00119 end += length 00120 self.fileDescription = str[start:end] 00121 start = end 00122 end += 4 00123 (length,) = _struct_I.unpack(str[start:end]) 00124 start = end 00125 end += length 00126 self.bs = str[start:end] 00127 start = end 00128 end += 4 00129 (self.size,) = _struct_i.unpack(str[start:end]) 00130 return self 00131 except struct.error as e: 00132 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00133 00134 00135 def serialize_numpy(self, buff, numpy): 00136 """ 00137 serialize message with numpy array types into buffer 00138 @param buff: buffer 00139 @type buff: StringIO 00140 @param numpy: numpy python module 00141 @type numpy module 00142 """ 00143 try: 00144 buff.write(_struct_i.pack(self.objectId)) 00145 _x = self.Objecttype 00146 length = len(_x) 00147 buff.write(struct.pack('<I%ss'%length, length, _x)) 00148 _x = self.pose 00149 length = len(_x) 00150 buff.write(struct.pack('<I%ss'%length, length, _x)) 00151 _x = self.fileDescription 00152 length = len(_x) 00153 buff.write(struct.pack('<I%ss'%length, length, _x)) 00154 _x = self.bs 00155 length = len(_x) 00156 # - if encoded as a list instead, serialize as bytes instead of string 00157 if type(_x) in [list, tuple]: 00158 buff.write(struct.pack('<I%sB'%length, length, *_x)) 00159 else: 00160 buff.write(struct.pack('<I%ss'%length, length, _x)) 00161 buff.write(_struct_i.pack(self.size)) 00162 except struct.error as se: self._check_types(se) 00163 except TypeError as te: self._check_types(te) 00164 00165 def deserialize_numpy(self, str, numpy): 00166 """ 00167 unpack serialized message in str into this message instance using numpy for array types 00168 @param str: byte array of serialized message 00169 @type str: str 00170 @param numpy: numpy python module 00171 @type numpy: module 00172 """ 00173 try: 00174 end = 0 00175 start = end 00176 end += 4 00177 (self.objectId,) = _struct_i.unpack(str[start:end]) 00178 start = end 00179 end += 4 00180 (length,) = _struct_I.unpack(str[start:end]) 00181 start = end 00182 end += length 00183 self.Objecttype = str[start:end] 00184 start = end 00185 end += 4 00186 (length,) = _struct_I.unpack(str[start:end]) 00187 start = end 00188 end += length 00189 self.pose = str[start:end] 00190 start = end 00191 end += 4 00192 (length,) = _struct_I.unpack(str[start:end]) 00193 start = end 00194 end += length 00195 self.fileDescription = str[start:end] 00196 start = end 00197 end += 4 00198 (length,) = _struct_I.unpack(str[start:end]) 00199 start = end 00200 end += length 00201 self.bs = str[start:end] 00202 start = end 00203 end += 4 00204 (self.size,) = _struct_i.unpack(str[start:end]) 00205 return self 00206 except struct.error as e: 00207 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00208 00209 _struct_I = roslib.message.struct_I 00210 _struct_i = struct.Struct("<i")