_WrenchState.py
Go to the documentation of this file.
00001 """autogenerated by genpy from nasa_r2_common_msgs/WrenchState.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 geometry_msgs.msg
00008 import std_msgs.msg
00009 
00010 class WrenchState(genpy.Message):
00011   _md5sum = "ca65dd41fc9f0daae4d837bdbf522e55"
00012   _type = "nasa_r2_common_msgs/WrenchState"
00013   _has_header = True #flag to mark the presence of a Header object
00014   _full_text = """Header header
00015 string[] name
00016 geometry_msgs/Wrench[] wrench
00017 
00018 ================================================================================
00019 MSG: std_msgs/Header
00020 # Standard metadata for higher-level stamped data types.
00021 # This is generally used to communicate timestamped data 
00022 # in a particular coordinate frame.
00023 # 
00024 # sequence ID: consecutively increasing ID 
00025 uint32 seq
00026 #Two-integer timestamp that is expressed as:
00027 # * stamp.secs: seconds (stamp_secs) since epoch
00028 # * stamp.nsecs: nanoseconds since stamp_secs
00029 # time-handling sugar is provided by the client library
00030 time stamp
00031 #Frame this data is associated with
00032 # 0: no frame
00033 # 1: global frame
00034 string frame_id
00035 
00036 ================================================================================
00037 MSG: geometry_msgs/Wrench
00038 # This represents force in free space, separated into
00039 # its linear and angular parts.
00040 Vector3  force
00041 Vector3  torque
00042 
00043 ================================================================================
00044 MSG: geometry_msgs/Vector3
00045 # This represents a vector in free space. 
00046 
00047 float64 x
00048 float64 y
00049 float64 z
00050 """
00051   __slots__ = ['header','name','wrench']
00052   _slot_types = ['std_msgs/Header','string[]','geometry_msgs/Wrench[]']
00053 
00054   def __init__(self, *args, **kwds):
00055     """
00056     Constructor. Any message fields that are implicitly/explicitly
00057     set to None will be assigned a default value. The recommend
00058     use is keyword arguments as this is more robust to future message
00059     changes.  You cannot mix in-order arguments and keyword arguments.
00060 
00061     The available fields are:
00062        header,name,wrench
00063 
00064     :param args: complete set of field values, in .msg order
00065     :param kwds: use keyword arguments corresponding to message field names
00066     to set specific fields.
00067     """
00068     if args or kwds:
00069       super(WrenchState, self).__init__(*args, **kwds)
00070       #message fields cannot be None, assign default values for those that are
00071       if self.header is None:
00072         self.header = std_msgs.msg.Header()
00073       if self.name is None:
00074         self.name = []
00075       if self.wrench is None:
00076         self.wrench = []
00077     else:
00078       self.header = std_msgs.msg.Header()
00079       self.name = []
00080       self.wrench = []
00081 
00082   def _get_types(self):
00083     """
00084     internal API method
00085     """
00086     return self._slot_types
00087 
00088   def serialize(self, buff):
00089     """
00090     serialize message into buffer
00091     :param buff: buffer, ``StringIO``
00092     """
00093     try:
00094       _x = self
00095       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00096       _x = self.header.frame_id
00097       length = len(_x)
00098       if python3 or type(_x) == unicode:
00099         _x = _x.encode('utf-8')
00100         length = len(_x)
00101       buff.write(struct.pack('<I%ss'%length, length, _x))
00102       length = len(self.name)
00103       buff.write(_struct_I.pack(length))
00104       for val1 in self.name:
00105         length = len(val1)
00106         if python3 or type(val1) == unicode:
00107           val1 = val1.encode('utf-8')
00108           length = len(val1)
00109         buff.write(struct.pack('<I%ss'%length, length, val1))
00110       length = len(self.wrench)
00111       buff.write(_struct_I.pack(length))
00112       for val1 in self.wrench:
00113         _v1 = val1.force
00114         _x = _v1
00115         buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00116         _v2 = val1.torque
00117         _x = _v2
00118         buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00119     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00120     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00121 
00122   def deserialize(self, str):
00123     """
00124     unpack serialized message in str into this message instance
00125     :param str: byte array of serialized message, ``str``
00126     """
00127     try:
00128       if self.header is None:
00129         self.header = std_msgs.msg.Header()
00130       if self.wrench is None:
00131         self.wrench = None
00132       end = 0
00133       _x = self
00134       start = end
00135       end += 12
00136       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00137       start = end
00138       end += 4
00139       (length,) = _struct_I.unpack(str[start:end])
00140       start = end
00141       end += length
00142       if python3:
00143         self.header.frame_id = str[start:end].decode('utf-8')
00144       else:
00145         self.header.frame_id = str[start:end]
00146       start = end
00147       end += 4
00148       (length,) = _struct_I.unpack(str[start:end])
00149       self.name = []
00150       for i in range(0, length):
00151         start = end
00152         end += 4
00153         (length,) = _struct_I.unpack(str[start:end])
00154         start = end
00155         end += length
00156         if python3:
00157           val1 = str[start:end].decode('utf-8')
00158         else:
00159           val1 = str[start:end]
00160         self.name.append(val1)
00161       start = end
00162       end += 4
00163       (length,) = _struct_I.unpack(str[start:end])
00164       self.wrench = []
00165       for i in range(0, length):
00166         val1 = geometry_msgs.msg.Wrench()
00167         _v3 = val1.force
00168         _x = _v3
00169         start = end
00170         end += 24
00171         (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00172         _v4 = val1.torque
00173         _x = _v4
00174         start = end
00175         end += 24
00176         (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00177         self.wrench.append(val1)
00178       return self
00179     except struct.error as e:
00180       raise genpy.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, ``StringIO``
00187     :param numpy: numpy python module
00188     """
00189     try:
00190       _x = self
00191       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00192       _x = self.header.frame_id
00193       length = len(_x)
00194       if python3 or type(_x) == unicode:
00195         _x = _x.encode('utf-8')
00196         length = len(_x)
00197       buff.write(struct.pack('<I%ss'%length, length, _x))
00198       length = len(self.name)
00199       buff.write(_struct_I.pack(length))
00200       for val1 in self.name:
00201         length = len(val1)
00202         if python3 or type(val1) == unicode:
00203           val1 = val1.encode('utf-8')
00204           length = len(val1)
00205         buff.write(struct.pack('<I%ss'%length, length, val1))
00206       length = len(self.wrench)
00207       buff.write(_struct_I.pack(length))
00208       for val1 in self.wrench:
00209         _v5 = val1.force
00210         _x = _v5
00211         buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00212         _v6 = val1.torque
00213         _x = _v6
00214         buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00215     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00216     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00217 
00218   def deserialize_numpy(self, str, numpy):
00219     """
00220     unpack serialized message in str into this message instance using numpy for array types
00221     :param str: byte array of serialized message, ``str``
00222     :param numpy: numpy python module
00223     """
00224     try:
00225       if self.header is None:
00226         self.header = std_msgs.msg.Header()
00227       if self.wrench is None:
00228         self.wrench = None
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       self.wrench = []
00262       for i in range(0, length):
00263         val1 = geometry_msgs.msg.Wrench()
00264         _v7 = val1.force
00265         _x = _v7
00266         start = end
00267         end += 24
00268         (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00269         _v8 = val1.torque
00270         _x = _v8
00271         start = end
00272         end += 24
00273         (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00274         self.wrench.append(val1)
00275       return self
00276     except struct.error as e:
00277       raise genpy.DeserializationError(e) #most likely buffer underfill
00278 
00279 _struct_I = genpy.struct_I
00280 _struct_3I = struct.Struct("<3I")
00281 _struct_3d = struct.Struct("<3d")


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