_CartesianGains.py
Go to the documentation of this file.
00001 """autogenerated by genpy from object_manipulation_msgs/CartesianGains.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 CartesianGains(genpy.Message):
00010   _md5sum = "ab347f046ca5736a156ec424cbb63635"
00011   _type = "object_manipulation_msgs/CartesianGains"
00012   _has_header = True #flag to mark the presence of a Header object
00013   _full_text = """Header header
00014 
00015 float64[] gains
00016 float64[] fixed_frame
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   __slots__ = ['header','gains','fixed_frame']
00038   _slot_types = ['std_msgs/Header','float64[]','float64[]']
00039 
00040   def __init__(self, *args, **kwds):
00041     """
00042     Constructor. Any message fields that are implicitly/explicitly
00043     set to None will be assigned a default value. The recommend
00044     use is keyword arguments as this is more robust to future message
00045     changes.  You cannot mix in-order arguments and keyword arguments.
00046 
00047     The available fields are:
00048        header,gains,fixed_frame
00049 
00050     :param args: complete set of field values, in .msg order
00051     :param kwds: use keyword arguments corresponding to message field names
00052     to set specific fields.
00053     """
00054     if args or kwds:
00055       super(CartesianGains, self).__init__(*args, **kwds)
00056       #message fields cannot be None, assign default values for those that are
00057       if self.header is None:
00058         self.header = std_msgs.msg.Header()
00059       if self.gains is None:
00060         self.gains = []
00061       if self.fixed_frame is None:
00062         self.fixed_frame = []
00063     else:
00064       self.header = std_msgs.msg.Header()
00065       self.gains = []
00066       self.fixed_frame = []
00067 
00068   def _get_types(self):
00069     """
00070     internal API method
00071     """
00072     return self._slot_types
00073 
00074   def serialize(self, buff):
00075     """
00076     serialize message into buffer
00077     :param buff: buffer, ``StringIO``
00078     """
00079     try:
00080       _x = self
00081       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00082       _x = self.header.frame_id
00083       length = len(_x)
00084       if python3 or type(_x) == unicode:
00085         _x = _x.encode('utf-8')
00086         length = len(_x)
00087       buff.write(struct.pack('<I%ss'%length, length, _x))
00088       length = len(self.gains)
00089       buff.write(_struct_I.pack(length))
00090       pattern = '<%sd'%length
00091       buff.write(struct.pack(pattern, *self.gains))
00092       length = len(self.fixed_frame)
00093       buff.write(_struct_I.pack(length))
00094       pattern = '<%sd'%length
00095       buff.write(struct.pack(pattern, *self.fixed_frame))
00096     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00097     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00098 
00099   def deserialize(self, str):
00100     """
00101     unpack serialized message in str into this message instance
00102     :param str: byte array of serialized message, ``str``
00103     """
00104     try:
00105       if self.header is None:
00106         self.header = std_msgs.msg.Header()
00107       end = 0
00108       _x = self
00109       start = end
00110       end += 12
00111       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00112       start = end
00113       end += 4
00114       (length,) = _struct_I.unpack(str[start:end])
00115       start = end
00116       end += length
00117       if python3:
00118         self.header.frame_id = str[start:end].decode('utf-8')
00119       else:
00120         self.header.frame_id = str[start:end]
00121       start = end
00122       end += 4
00123       (length,) = _struct_I.unpack(str[start:end])
00124       pattern = '<%sd'%length
00125       start = end
00126       end += struct.calcsize(pattern)
00127       self.gains = struct.unpack(pattern, str[start:end])
00128       start = end
00129       end += 4
00130       (length,) = _struct_I.unpack(str[start:end])
00131       pattern = '<%sd'%length
00132       start = end
00133       end += struct.calcsize(pattern)
00134       self.fixed_frame = struct.unpack(pattern, str[start:end])
00135       return self
00136     except struct.error as e:
00137       raise genpy.DeserializationError(e) #most likely buffer underfill
00138 
00139 
00140   def serialize_numpy(self, buff, numpy):
00141     """
00142     serialize message with numpy array types into buffer
00143     :param buff: buffer, ``StringIO``
00144     :param numpy: numpy python module
00145     """
00146     try:
00147       _x = self
00148       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00149       _x = self.header.frame_id
00150       length = len(_x)
00151       if python3 or type(_x) == unicode:
00152         _x = _x.encode('utf-8')
00153         length = len(_x)
00154       buff.write(struct.pack('<I%ss'%length, length, _x))
00155       length = len(self.gains)
00156       buff.write(_struct_I.pack(length))
00157       pattern = '<%sd'%length
00158       buff.write(self.gains.tostring())
00159       length = len(self.fixed_frame)
00160       buff.write(_struct_I.pack(length))
00161       pattern = '<%sd'%length
00162       buff.write(self.fixed_frame.tostring())
00163     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00164     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00165 
00166   def deserialize_numpy(self, str, numpy):
00167     """
00168     unpack serialized message in str into this message instance using numpy for array types
00169     :param str: byte array of serialized message, ``str``
00170     :param numpy: numpy python module
00171     """
00172     try:
00173       if self.header is None:
00174         self.header = std_msgs.msg.Header()
00175       end = 0
00176       _x = self
00177       start = end
00178       end += 12
00179       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00180       start = end
00181       end += 4
00182       (length,) = _struct_I.unpack(str[start:end])
00183       start = end
00184       end += length
00185       if python3:
00186         self.header.frame_id = str[start:end].decode('utf-8')
00187       else:
00188         self.header.frame_id = str[start:end]
00189       start = end
00190       end += 4
00191       (length,) = _struct_I.unpack(str[start:end])
00192       pattern = '<%sd'%length
00193       start = end
00194       end += struct.calcsize(pattern)
00195       self.gains = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00196       start = end
00197       end += 4
00198       (length,) = _struct_I.unpack(str[start:end])
00199       pattern = '<%sd'%length
00200       start = end
00201       end += struct.calcsize(pattern)
00202       self.fixed_frame = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00203       return self
00204     except struct.error as e:
00205       raise genpy.DeserializationError(e) #most likely buffer underfill
00206 
00207 _struct_I = genpy.struct_I
00208 _struct_3I = struct.Struct("<3I")


object_manipulation_msgs
Author(s): Matei Ciocarlie
autogenerated on Mon Oct 6 2014 02:58:11