00001 """autogenerated by genpy from youbot_overhead_localization/Path.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006
00007
00008 class Path(genpy.Message):
00009 _md5sum = "c80fb7c4576dd8be95961655daa5eeb8"
00010 _type = "youbot_overhead_localization/Path"
00011 _has_header = False
00012 _full_text = """float32[] pathx
00013 float32[] pathy
00014 float32[] distances
00015 float32 remainingDistance
00016 int16 pathLength
00017
00018 """
00019 __slots__ = ['pathx','pathy','distances','remainingDistance','pathLength']
00020 _slot_types = ['float32[]','float32[]','float32[]','float32','int16']
00021
00022 def __init__(self, *args, **kwds):
00023 """
00024 Constructor. Any message fields that are implicitly/explicitly
00025 set to None will be assigned a default value. The recommend
00026 use is keyword arguments as this is more robust to future message
00027 changes. You cannot mix in-order arguments and keyword arguments.
00028
00029 The available fields are:
00030 pathx,pathy,distances,remainingDistance,pathLength
00031
00032 :param args: complete set of field values, in .msg order
00033 :param kwds: use keyword arguments corresponding to message field names
00034 to set specific fields.
00035 """
00036 if args or kwds:
00037 super(Path, self).__init__(*args, **kwds)
00038
00039 if self.pathx is None:
00040 self.pathx = []
00041 if self.pathy is None:
00042 self.pathy = []
00043 if self.distances is None:
00044 self.distances = []
00045 if self.remainingDistance is None:
00046 self.remainingDistance = 0.
00047 if self.pathLength is None:
00048 self.pathLength = 0
00049 else:
00050 self.pathx = []
00051 self.pathy = []
00052 self.distances = []
00053 self.remainingDistance = 0.
00054 self.pathLength = 0
00055
00056 def _get_types(self):
00057 """
00058 internal API method
00059 """
00060 return self._slot_types
00061
00062 def serialize(self, buff):
00063 """
00064 serialize message into buffer
00065 :param buff: buffer, ``StringIO``
00066 """
00067 try:
00068 length = len(self.pathx)
00069 buff.write(_struct_I.pack(length))
00070 pattern = '<%sf'%length
00071 buff.write(struct.pack(pattern, *self.pathx))
00072 length = len(self.pathy)
00073 buff.write(_struct_I.pack(length))
00074 pattern = '<%sf'%length
00075 buff.write(struct.pack(pattern, *self.pathy))
00076 length = len(self.distances)
00077 buff.write(_struct_I.pack(length))
00078 pattern = '<%sf'%length
00079 buff.write(struct.pack(pattern, *self.distances))
00080 _x = self
00081 buff.write(_struct_fh.pack(_x.remainingDistance, _x.pathLength))
00082 except struct.error as se: self._check_types(se)
00083 except TypeError as te: self._check_types(te)
00084
00085 def deserialize(self, str):
00086 """
00087 unpack serialized message in str into this message instance
00088 :param str: byte array of serialized message, ``str``
00089 """
00090 try:
00091 end = 0
00092 start = end
00093 end += 4
00094 (length,) = _struct_I.unpack(str[start:end])
00095 pattern = '<%sf'%length
00096 start = end
00097 end += struct.calcsize(pattern)
00098 self.pathx = struct.unpack(pattern, str[start:end])
00099 start = end
00100 end += 4
00101 (length,) = _struct_I.unpack(str[start:end])
00102 pattern = '<%sf'%length
00103 start = end
00104 end += struct.calcsize(pattern)
00105 self.pathy = struct.unpack(pattern, str[start:end])
00106 start = end
00107 end += 4
00108 (length,) = _struct_I.unpack(str[start:end])
00109 pattern = '<%sf'%length
00110 start = end
00111 end += struct.calcsize(pattern)
00112 self.distances = struct.unpack(pattern, str[start:end])
00113 _x = self
00114 start = end
00115 end += 6
00116 (_x.remainingDistance, _x.pathLength,) = _struct_fh.unpack(str[start:end])
00117 return self
00118 except struct.error as e:
00119 raise genpy.DeserializationError(e)
00120
00121
00122 def serialize_numpy(self, buff, numpy):
00123 """
00124 serialize message with numpy array types into buffer
00125 :param buff: buffer, ``StringIO``
00126 :param numpy: numpy python module
00127 """
00128 try:
00129 length = len(self.pathx)
00130 buff.write(_struct_I.pack(length))
00131 pattern = '<%sf'%length
00132 buff.write(self.pathx.tostring())
00133 length = len(self.pathy)
00134 buff.write(_struct_I.pack(length))
00135 pattern = '<%sf'%length
00136 buff.write(self.pathy.tostring())
00137 length = len(self.distances)
00138 buff.write(_struct_I.pack(length))
00139 pattern = '<%sf'%length
00140 buff.write(self.distances.tostring())
00141 _x = self
00142 buff.write(_struct_fh.pack(_x.remainingDistance, _x.pathLength))
00143 except struct.error as se: self._check_types(se)
00144 except TypeError as te: self._check_types(te)
00145
00146 def deserialize_numpy(self, str, numpy):
00147 """
00148 unpack serialized message in str into this message instance using numpy for array types
00149 :param str: byte array of serialized message, ``str``
00150 :param numpy: numpy python module
00151 """
00152 try:
00153 end = 0
00154 start = end
00155 end += 4
00156 (length,) = _struct_I.unpack(str[start:end])
00157 pattern = '<%sf'%length
00158 start = end
00159 end += struct.calcsize(pattern)
00160 self.pathx = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00161 start = end
00162 end += 4
00163 (length,) = _struct_I.unpack(str[start:end])
00164 pattern = '<%sf'%length
00165 start = end
00166 end += struct.calcsize(pattern)
00167 self.pathy = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00168 start = end
00169 end += 4
00170 (length,) = _struct_I.unpack(str[start:end])
00171 pattern = '<%sf'%length
00172 start = end
00173 end += struct.calcsize(pattern)
00174 self.distances = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00175 _x = self
00176 start = end
00177 end += 6
00178 (_x.remainingDistance, _x.pathLength,) = _struct_fh.unpack(str[start:end])
00179 return self
00180 except struct.error as e:
00181 raise genpy.DeserializationError(e)
00182
00183 _struct_I = genpy.struct_I
00184 _struct_fh = struct.Struct("<fh")