$search
00001 """autogenerated by genmsg_py from GripperControllerState.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 import std_msgs.msg 00006 00007 class GripperControllerState(roslib.message.Message): 00008 _md5sum = "57ba9ed166f48062eddf3c6e509f2dc0" 00009 _type = "katana_msgs/GripperControllerState" 00010 _has_header = True #flag to mark the presence of a Header object 00011 _full_text = """# The actual and desired angles (in radian) of the gripper joints, 00012 # and the error between actual and desired. 00013 # 00014 # Each joint is uniquely identified by its name. 00015 # 00016 # The header specifies the time at which the joint states were recorded. All the joint states 00017 # in one message have to be recorded at the same time. 00018 # 00019 # This message consists of a multiple arrays, one for each part of the joint state. 00020 # 00021 # All arrays in this message should have the same size. 00022 # This is the only way to uniquely associate the joint name with the correct 00023 # states. 00024 Header header 00025 00026 string[] name 00027 float64[] actual 00028 float64[] desired 00029 float64[] error 00030 00031 ================================================================================ 00032 MSG: std_msgs/Header 00033 # Standard metadata for higher-level stamped data types. 00034 # This is generally used to communicate timestamped data 00035 # in a particular coordinate frame. 00036 # 00037 # sequence ID: consecutively increasing ID 00038 uint32 seq 00039 #Two-integer timestamp that is expressed as: 00040 # * stamp.secs: seconds (stamp_secs) since epoch 00041 # * stamp.nsecs: nanoseconds since stamp_secs 00042 # time-handling sugar is provided by the client library 00043 time stamp 00044 #Frame this data is associated with 00045 # 0: no frame 00046 # 1: global frame 00047 string frame_id 00048 00049 """ 00050 __slots__ = ['header','name','actual','desired','error'] 00051 _slot_types = ['Header','string[]','float64[]','float64[]','float64[]'] 00052 00053 def __init__(self, *args, **kwds): 00054 """ 00055 Constructor. Any message fields that are implicitly/explicitly 00056 set to None will be assigned a default value. The recommend 00057 use is keyword arguments as this is more robust to future message 00058 changes. You cannot mix in-order arguments and keyword arguments. 00059 00060 The available fields are: 00061 header,name,actual,desired,error 00062 00063 @param args: complete set of field values, in .msg order 00064 @param kwds: use keyword arguments corresponding to message field names 00065 to set specific fields. 00066 """ 00067 if args or kwds: 00068 super(GripperControllerState, self).__init__(*args, **kwds) 00069 #message fields cannot be None, assign default values for those that are 00070 if self.header is None: 00071 self.header = std_msgs.msg._Header.Header() 00072 if self.name is None: 00073 self.name = [] 00074 if self.actual is None: 00075 self.actual = [] 00076 if self.desired is None: 00077 self.desired = [] 00078 if self.error is None: 00079 self.error = [] 00080 else: 00081 self.header = std_msgs.msg._Header.Header() 00082 self.name = [] 00083 self.actual = [] 00084 self.desired = [] 00085 self.error = [] 00086 00087 def _get_types(self): 00088 """ 00089 internal API method 00090 """ 00091 return self._slot_types 00092 00093 def serialize(self, buff): 00094 """ 00095 serialize message into buffer 00096 @param buff: buffer 00097 @type buff: StringIO 00098 """ 00099 try: 00100 _x = self 00101 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00102 _x = self.header.frame_id 00103 length = len(_x) 00104 buff.write(struct.pack('<I%ss'%length, length, _x)) 00105 length = len(self.name) 00106 buff.write(_struct_I.pack(length)) 00107 for val1 in self.name: 00108 length = len(val1) 00109 buff.write(struct.pack('<I%ss'%length, length, val1)) 00110 length = len(self.actual) 00111 buff.write(_struct_I.pack(length)) 00112 pattern = '<%sd'%length 00113 buff.write(struct.pack(pattern, *self.actual)) 00114 length = len(self.desired) 00115 buff.write(_struct_I.pack(length)) 00116 pattern = '<%sd'%length 00117 buff.write(struct.pack(pattern, *self.desired)) 00118 length = len(self.error) 00119 buff.write(_struct_I.pack(length)) 00120 pattern = '<%sd'%length 00121 buff.write(struct.pack(pattern, *self.error)) 00122 except struct.error as se: self._check_types(se) 00123 except TypeError as te: self._check_types(te) 00124 00125 def deserialize(self, str): 00126 """ 00127 unpack serialized message in str into this message instance 00128 @param str: byte array of serialized message 00129 @type str: str 00130 """ 00131 try: 00132 if self.header is None: 00133 self.header = std_msgs.msg._Header.Header() 00134 end = 0 00135 _x = self 00136 start = end 00137 end += 12 00138 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00139 start = end 00140 end += 4 00141 (length,) = _struct_I.unpack(str[start:end]) 00142 start = end 00143 end += length 00144 self.header.frame_id = str[start:end] 00145 start = end 00146 end += 4 00147 (length,) = _struct_I.unpack(str[start:end]) 00148 self.name = [] 00149 for i in range(0, length): 00150 start = end 00151 end += 4 00152 (length,) = _struct_I.unpack(str[start:end]) 00153 start = end 00154 end += length 00155 val1 = str[start:end] 00156 self.name.append(val1) 00157 start = end 00158 end += 4 00159 (length,) = _struct_I.unpack(str[start:end]) 00160 pattern = '<%sd'%length 00161 start = end 00162 end += struct.calcsize(pattern) 00163 self.actual = struct.unpack(pattern, str[start:end]) 00164 start = end 00165 end += 4 00166 (length,) = _struct_I.unpack(str[start:end]) 00167 pattern = '<%sd'%length 00168 start = end 00169 end += struct.calcsize(pattern) 00170 self.desired = struct.unpack(pattern, str[start:end]) 00171 start = end 00172 end += 4 00173 (length,) = _struct_I.unpack(str[start:end]) 00174 pattern = '<%sd'%length 00175 start = end 00176 end += struct.calcsize(pattern) 00177 self.error = struct.unpack(pattern, str[start:end]) 00178 return self 00179 except struct.error as e: 00180 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00181 00182 00183 def serialize_numpy(self, buff, numpy): 00184 """ 00185 serialize message with numpy array types into buffer 00186 @param buff: buffer 00187 @type buff: StringIO 00188 @param numpy: numpy python module 00189 @type numpy module 00190 """ 00191 try: 00192 _x = self 00193 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00194 _x = self.header.frame_id 00195 length = len(_x) 00196 buff.write(struct.pack('<I%ss'%length, length, _x)) 00197 length = len(self.name) 00198 buff.write(_struct_I.pack(length)) 00199 for val1 in self.name: 00200 length = len(val1) 00201 buff.write(struct.pack('<I%ss'%length, length, val1)) 00202 length = len(self.actual) 00203 buff.write(_struct_I.pack(length)) 00204 pattern = '<%sd'%length 00205 buff.write(self.actual.tostring()) 00206 length = len(self.desired) 00207 buff.write(_struct_I.pack(length)) 00208 pattern = '<%sd'%length 00209 buff.write(self.desired.tostring()) 00210 length = len(self.error) 00211 buff.write(_struct_I.pack(length)) 00212 pattern = '<%sd'%length 00213 buff.write(self.error.tostring()) 00214 except struct.error as se: self._check_types(se) 00215 except TypeError as te: self._check_types(te) 00216 00217 def deserialize_numpy(self, str, numpy): 00218 """ 00219 unpack serialized message in str into this message instance using numpy for array types 00220 @param str: byte array of serialized message 00221 @type str: str 00222 @param numpy: numpy python module 00223 @type numpy: module 00224 """ 00225 try: 00226 if self.header is None: 00227 self.header = std_msgs.msg._Header.Header() 00228 end = 0 00229 _x = self 00230 start = end 00231 end += 12 00232 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00233 start = end 00234 end += 4 00235 (length,) = _struct_I.unpack(str[start:end]) 00236 start = end 00237 end += length 00238 self.header.frame_id = str[start:end] 00239 start = end 00240 end += 4 00241 (length,) = _struct_I.unpack(str[start:end]) 00242 self.name = [] 00243 for i in range(0, length): 00244 start = end 00245 end += 4 00246 (length,) = _struct_I.unpack(str[start:end]) 00247 start = end 00248 end += length 00249 val1 = str[start:end] 00250 self.name.append(val1) 00251 start = end 00252 end += 4 00253 (length,) = _struct_I.unpack(str[start:end]) 00254 pattern = '<%sd'%length 00255 start = end 00256 end += struct.calcsize(pattern) 00257 self.actual = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length) 00258 start = end 00259 end += 4 00260 (length,) = _struct_I.unpack(str[start:end]) 00261 pattern = '<%sd'%length 00262 start = end 00263 end += struct.calcsize(pattern) 00264 self.desired = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length) 00265 start = end 00266 end += 4 00267 (length,) = _struct_I.unpack(str[start:end]) 00268 pattern = '<%sd'%length 00269 start = end 00270 end += struct.calcsize(pattern) 00271 self.error = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length) 00272 return self 00273 except struct.error as e: 00274 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00275 00276 _struct_I = roslib.message.struct_I 00277 _struct_3I = struct.Struct("<3I")