Go to the documentation of this file.00001 """autogenerated by genpy from opencv_fitting/Poses2D.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
00009 class Poses2D(genpy.Message):
00010 _md5sum = "31a710d661541413a823a4591402c488"
00011 _type = "opencv_fitting/Poses2D"
00012 _has_header = False
00013 _full_text = """geometry_msgs/Pose2D[] poses
00014
00015 ================================================================================
00016 MSG: geometry_msgs/Pose2D
00017 # This expresses a position and orientation on a 2D manifold.
00018
00019 float64 x
00020 float64 y
00021 float64 theta
00022 """
00023 __slots__ = ['poses']
00024 _slot_types = ['geometry_msgs/Pose2D[]']
00025
00026 def __init__(self, *args, **kwds):
00027 """
00028 Constructor. Any message fields that are implicitly/explicitly
00029 set to None will be assigned a default value. The recommend
00030 use is keyword arguments as this is more robust to future message
00031 changes. You cannot mix in-order arguments and keyword arguments.
00032
00033 The available fields are:
00034 poses
00035
00036 :param args: complete set of field values, in .msg order
00037 :param kwds: use keyword arguments corresponding to message field names
00038 to set specific fields.
00039 """
00040 if args or kwds:
00041 super(Poses2D, self).__init__(*args, **kwds)
00042
00043 if self.poses is None:
00044 self.poses = []
00045 else:
00046 self.poses = []
00047
00048 def _get_types(self):
00049 """
00050 internal API method
00051 """
00052 return self._slot_types
00053
00054 def serialize(self, buff):
00055 """
00056 serialize message into buffer
00057 :param buff: buffer, ``StringIO``
00058 """
00059 try:
00060 length = len(self.poses)
00061 buff.write(_struct_I.pack(length))
00062 for val1 in self.poses:
00063 _x = val1
00064 buff.write(_struct_3d.pack(_x.x, _x.y, _x.theta))
00065 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00066 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00067
00068 def deserialize(self, str):
00069 """
00070 unpack serialized message in str into this message instance
00071 :param str: byte array of serialized message, ``str``
00072 """
00073 try:
00074 if self.poses is None:
00075 self.poses = None
00076 end = 0
00077 start = end
00078 end += 4
00079 (length,) = _struct_I.unpack(str[start:end])
00080 self.poses = []
00081 for i in range(0, length):
00082 val1 = geometry_msgs.msg.Pose2D()
00083 _x = val1
00084 start = end
00085 end += 24
00086 (_x.x, _x.y, _x.theta,) = _struct_3d.unpack(str[start:end])
00087 self.poses.append(val1)
00088 return self
00089 except struct.error as e:
00090 raise genpy.DeserializationError(e)
00091
00092
00093 def serialize_numpy(self, buff, numpy):
00094 """
00095 serialize message with numpy array types into buffer
00096 :param buff: buffer, ``StringIO``
00097 :param numpy: numpy python module
00098 """
00099 try:
00100 length = len(self.poses)
00101 buff.write(_struct_I.pack(length))
00102 for val1 in self.poses:
00103 _x = val1
00104 buff.write(_struct_3d.pack(_x.x, _x.y, _x.theta))
00105 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00106 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00107
00108 def deserialize_numpy(self, str, numpy):
00109 """
00110 unpack serialized message in str into this message instance using numpy for array types
00111 :param str: byte array of serialized message, ``str``
00112 :param numpy: numpy python module
00113 """
00114 try:
00115 if self.poses is None:
00116 self.poses = None
00117 end = 0
00118 start = end
00119 end += 4
00120 (length,) = _struct_I.unpack(str[start:end])
00121 self.poses = []
00122 for i in range(0, length):
00123 val1 = geometry_msgs.msg.Pose2D()
00124 _x = val1
00125 start = end
00126 end += 24
00127 (_x.x, _x.y, _x.theta,) = _struct_3d.unpack(str[start:end])
00128 self.poses.append(val1)
00129 return self
00130 except struct.error as e:
00131 raise genpy.DeserializationError(e)
00132
00133 _struct_I = genpy.struct_I
00134 _struct_3d = struct.Struct("<3d")