_WrenchMonitorLimit.py
Go to the documentation of this file.
00001 """autogenerated by genpy from nasa_r2_common_msgs/WrenchMonitorLimit.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006 
00007 import std_msgs.msg
00008 
00009 class WrenchMonitorLimit(genpy.Message):
00010   _md5sum = "4535825230d82d19f739062cbc5d17ed"
00011   _type = "nasa_r2_common_msgs/WrenchMonitorLimit"
00012   _has_header = True #flag to mark the presence of a Header object
00013   _full_text = """Header header
00014 string[] name
00015 float64[] force
00016 float64[] torque
00017 bool[] isFraction
00018 
00019 ================================================================================
00020 MSG: std_msgs/Header
00021 # Standard metadata for higher-level stamped data types.
00022 # This is generally used to communicate timestamped data 
00023 # in a particular coordinate frame.
00024 # 
00025 # sequence ID: consecutively increasing ID 
00026 uint32 seq
00027 #Two-integer timestamp that is expressed as:
00028 # * stamp.secs: seconds (stamp_secs) since epoch
00029 # * stamp.nsecs: nanoseconds since stamp_secs
00030 # time-handling sugar is provided by the client library
00031 time stamp
00032 #Frame this data is associated with
00033 # 0: no frame
00034 # 1: global frame
00035 string frame_id
00036 
00037 """
00038   __slots__ = ['header','name','force','torque','isFraction']
00039   _slot_types = ['std_msgs/Header','string[]','float64[]','float64[]','bool[]']
00040 
00041   def __init__(self, *args, **kwds):
00042     """
00043     Constructor. Any message fields that are implicitly/explicitly
00044     set to None will be assigned a default value. The recommend
00045     use is keyword arguments as this is more robust to future message
00046     changes.  You cannot mix in-order arguments and keyword arguments.
00047 
00048     The available fields are:
00049        header,name,force,torque,isFraction
00050 
00051     :param args: complete set of field values, in .msg order
00052     :param kwds: use keyword arguments corresponding to message field names
00053     to set specific fields.
00054     """
00055     if args or kwds:
00056       super(WrenchMonitorLimit, self).__init__(*args, **kwds)
00057       #message fields cannot be None, assign default values for those that are
00058       if self.header is None:
00059         self.header = std_msgs.msg.Header()
00060       if self.name is None:
00061         self.name = []
00062       if self.force is None:
00063         self.force = []
00064       if self.torque is None:
00065         self.torque = []
00066       if self.isFraction is None:
00067         self.isFraction = []
00068     else:
00069       self.header = std_msgs.msg.Header()
00070       self.name = []
00071       self.force = []
00072       self.torque = []
00073       self.isFraction = []
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, ``StringIO``
00085     """
00086     try:
00087       _x = self
00088       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00089       _x = self.header.frame_id
00090       length = len(_x)
00091       if python3 or type(_x) == unicode:
00092         _x = _x.encode('utf-8')
00093         length = len(_x)
00094       buff.write(struct.pack('<I%ss'%length, length, _x))
00095       length = len(self.name)
00096       buff.write(_struct_I.pack(length))
00097       for val1 in self.name:
00098         length = len(val1)
00099         if python3 or type(val1) == unicode:
00100           val1 = val1.encode('utf-8')
00101           length = len(val1)
00102         buff.write(struct.pack('<I%ss'%length, length, val1))
00103       length = len(self.force)
00104       buff.write(_struct_I.pack(length))
00105       pattern = '<%sd'%length
00106       buff.write(struct.pack(pattern, *self.force))
00107       length = len(self.torque)
00108       buff.write(_struct_I.pack(length))
00109       pattern = '<%sd'%length
00110       buff.write(struct.pack(pattern, *self.torque))
00111       length = len(self.isFraction)
00112       buff.write(_struct_I.pack(length))
00113       pattern = '<%sB'%length
00114       buff.write(struct.pack(pattern, *self.isFraction))
00115     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00116     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00117 
00118   def deserialize(self, str):
00119     """
00120     unpack serialized message in str into this message instance
00121     :param str: byte array of serialized message, ``str``
00122     """
00123     try:
00124       if self.header is None:
00125         self.header = std_msgs.msg.Header()
00126       end = 0
00127       _x = self
00128       start = end
00129       end += 12
00130       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00131       start = end
00132       end += 4
00133       (length,) = _struct_I.unpack(str[start:end])
00134       start = end
00135       end += length
00136       if python3:
00137         self.header.frame_id = str[start:end].decode('utf-8')
00138       else:
00139         self.header.frame_id = str[start:end]
00140       start = end
00141       end += 4
00142       (length,) = _struct_I.unpack(str[start:end])
00143       self.name = []
00144       for i in range(0, length):
00145         start = end
00146         end += 4
00147         (length,) = _struct_I.unpack(str[start:end])
00148         start = end
00149         end += length
00150         if python3:
00151           val1 = str[start:end].decode('utf-8')
00152         else:
00153           val1 = str[start:end]
00154         self.name.append(val1)
00155       start = end
00156       end += 4
00157       (length,) = _struct_I.unpack(str[start:end])
00158       pattern = '<%sd'%length
00159       start = end
00160       end += struct.calcsize(pattern)
00161       self.force = struct.unpack(pattern, str[start:end])
00162       start = end
00163       end += 4
00164       (length,) = _struct_I.unpack(str[start:end])
00165       pattern = '<%sd'%length
00166       start = end
00167       end += struct.calcsize(pattern)
00168       self.torque = struct.unpack(pattern, str[start:end])
00169       start = end
00170       end += 4
00171       (length,) = _struct_I.unpack(str[start:end])
00172       pattern = '<%sB'%length
00173       start = end
00174       end += struct.calcsize(pattern)
00175       self.isFraction = struct.unpack(pattern, str[start:end])
00176       self.isFraction = map(bool, self.isFraction)
00177       return self
00178     except struct.error as e:
00179       raise genpy.DeserializationError(e) #most likely buffer underfill
00180 
00181 
00182   def serialize_numpy(self, buff, numpy):
00183     """
00184     serialize message with numpy array types into buffer
00185     :param buff: buffer, ``StringIO``
00186     :param numpy: numpy python module
00187     """
00188     try:
00189       _x = self
00190       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00191       _x = self.header.frame_id
00192       length = len(_x)
00193       if python3 or type(_x) == unicode:
00194         _x = _x.encode('utf-8')
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         if python3 or type(val1) == unicode:
00202           val1 = val1.encode('utf-8')
00203           length = len(val1)
00204         buff.write(struct.pack('<I%ss'%length, length, val1))
00205       length = len(self.force)
00206       buff.write(_struct_I.pack(length))
00207       pattern = '<%sd'%length
00208       buff.write(self.force.tostring())
00209       length = len(self.torque)
00210       buff.write(_struct_I.pack(length))
00211       pattern = '<%sd'%length
00212       buff.write(self.torque.tostring())
00213       length = len(self.isFraction)
00214       buff.write(_struct_I.pack(length))
00215       pattern = '<%sB'%length
00216       buff.write(self.isFraction.tostring())
00217     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00218     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00219 
00220   def deserialize_numpy(self, str, numpy):
00221     """
00222     unpack serialized message in str into this message instance using numpy for array types
00223     :param str: byte array of serialized message, ``str``
00224     :param numpy: numpy python module
00225     """
00226     try:
00227       if self.header is None:
00228         self.header = std_msgs.msg.Header()
00229       end = 0
00230       _x = self
00231       start = end
00232       end += 12
00233       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00234       start = end
00235       end += 4
00236       (length,) = _struct_I.unpack(str[start:end])
00237       start = end
00238       end += length
00239       if python3:
00240         self.header.frame_id = str[start:end].decode('utf-8')
00241       else:
00242         self.header.frame_id = str[start:end]
00243       start = end
00244       end += 4
00245       (length,) = _struct_I.unpack(str[start:end])
00246       self.name = []
00247       for i in range(0, length):
00248         start = end
00249         end += 4
00250         (length,) = _struct_I.unpack(str[start:end])
00251         start = end
00252         end += length
00253         if python3:
00254           val1 = str[start:end].decode('utf-8')
00255         else:
00256           val1 = str[start:end]
00257         self.name.append(val1)
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.force = 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.torque = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00272       start = end
00273       end += 4
00274       (length,) = _struct_I.unpack(str[start:end])
00275       pattern = '<%sB'%length
00276       start = end
00277       end += struct.calcsize(pattern)
00278       self.isFraction = numpy.frombuffer(str[start:end], dtype=numpy.bool, count=length)
00279       self.isFraction = map(bool, self.isFraction)
00280       return self
00281     except struct.error as e:
00282       raise genpy.DeserializationError(e) #most likely buffer underfill
00283 
00284 _struct_I = genpy.struct_I
00285 _struct_3I = struct.Struct("<3I")


nasa_r2_common_msgs
Author(s): Paul Dinh. Maintained by Jennifer Turner
autogenerated on Mon Oct 6 2014 02:42:34