00001 """autogenerated by genpy from clearpath_base/Encoders.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 clearpath_base.msg
00008 import std_msgs.msg
00009
00010 class Encoders(genpy.Message):
00011 _md5sum = "2ea748832c2014369ffabd316d5aad8c"
00012 _type = "clearpath_base/Encoders"
00013 _has_header = True
00014 _full_text = """Header header
00015 Encoder[] encoders
00016
00017 ================================================================================
00018 MSG: std_msgs/Header
00019 # Standard metadata for higher-level stamped data types.
00020 # This is generally used to communicate timestamped data
00021 # in a particular coordinate frame.
00022 #
00023 # sequence ID: consecutively increasing ID
00024 uint32 seq
00025 #Two-integer timestamp that is expressed as:
00026 # * stamp.secs: seconds (stamp_secs) since epoch
00027 # * stamp.nsecs: nanoseconds since stamp_secs
00028 # time-handling sugar is provided by the client library
00029 time stamp
00030 #Frame this data is associated with
00031 # 0: no frame
00032 # 1: global frame
00033 string frame_id
00034
00035 ================================================================================
00036 MSG: clearpath_base/Encoder
00037 float64 travel
00038 float64 speed
00039
00040 """
00041 __slots__ = ['header','encoders']
00042 _slot_types = ['std_msgs/Header','clearpath_base/Encoder[]']
00043
00044 def __init__(self, *args, **kwds):
00045 """
00046 Constructor. Any message fields that are implicitly/explicitly
00047 set to None will be assigned a default value. The recommend
00048 use is keyword arguments as this is more robust to future message
00049 changes. You cannot mix in-order arguments and keyword arguments.
00050
00051 The available fields are:
00052 header,encoders
00053
00054 :param args: complete set of field values, in .msg order
00055 :param kwds: use keyword arguments corresponding to message field names
00056 to set specific fields.
00057 """
00058 if args or kwds:
00059 super(Encoders, self).__init__(*args, **kwds)
00060
00061 if self.header is None:
00062 self.header = std_msgs.msg.Header()
00063 if self.encoders is None:
00064 self.encoders = []
00065 else:
00066 self.header = std_msgs.msg.Header()
00067 self.encoders = []
00068
00069 def _get_types(self):
00070 """
00071 internal API method
00072 """
00073 return self._slot_types
00074
00075 def serialize(self, buff):
00076 """
00077 serialize message into buffer
00078 :param buff: buffer, ``StringIO``
00079 """
00080 try:
00081 _x = self
00082 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00083 _x = self.header.frame_id
00084 length = len(_x)
00085 if python3 or type(_x) == unicode:
00086 _x = _x.encode('utf-8')
00087 length = len(_x)
00088 buff.write(struct.pack('<I%ss'%length, length, _x))
00089 length = len(self.encoders)
00090 buff.write(_struct_I.pack(length))
00091 for val1 in self.encoders:
00092 _x = val1
00093 buff.write(_struct_2d.pack(_x.travel, _x.speed))
00094 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00095 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00096
00097 def deserialize(self, str):
00098 """
00099 unpack serialized message in str into this message instance
00100 :param str: byte array of serialized message, ``str``
00101 """
00102 try:
00103 if self.header is None:
00104 self.header = std_msgs.msg.Header()
00105 if self.encoders is None:
00106 self.encoders = None
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 self.encoders = []
00125 for i in range(0, length):
00126 val1 = clearpath_base.msg.Encoder()
00127 _x = val1
00128 start = end
00129 end += 16
00130 (_x.travel, _x.speed,) = _struct_2d.unpack(str[start:end])
00131 self.encoders.append(val1)
00132 return self
00133 except struct.error as e:
00134 raise genpy.DeserializationError(e)
00135
00136
00137 def serialize_numpy(self, buff, numpy):
00138 """
00139 serialize message with numpy array types into buffer
00140 :param buff: buffer, ``StringIO``
00141 :param numpy: numpy python module
00142 """
00143 try:
00144 _x = self
00145 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00146 _x = self.header.frame_id
00147 length = len(_x)
00148 if python3 or type(_x) == unicode:
00149 _x = _x.encode('utf-8')
00150 length = len(_x)
00151 buff.write(struct.pack('<I%ss'%length, length, _x))
00152 length = len(self.encoders)
00153 buff.write(_struct_I.pack(length))
00154 for val1 in self.encoders:
00155 _x = val1
00156 buff.write(_struct_2d.pack(_x.travel, _x.speed))
00157 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00158 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00159
00160 def deserialize_numpy(self, str, numpy):
00161 """
00162 unpack serialized message in str into this message instance using numpy for array types
00163 :param str: byte array of serialized message, ``str``
00164 :param numpy: numpy python module
00165 """
00166 try:
00167 if self.header is None:
00168 self.header = std_msgs.msg.Header()
00169 if self.encoders is None:
00170 self.encoders = None
00171 end = 0
00172 _x = self
00173 start = end
00174 end += 12
00175 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00176 start = end
00177 end += 4
00178 (length,) = _struct_I.unpack(str[start:end])
00179 start = end
00180 end += length
00181 if python3:
00182 self.header.frame_id = str[start:end].decode('utf-8')
00183 else:
00184 self.header.frame_id = str[start:end]
00185 start = end
00186 end += 4
00187 (length,) = _struct_I.unpack(str[start:end])
00188 self.encoders = []
00189 for i in range(0, length):
00190 val1 = clearpath_base.msg.Encoder()
00191 _x = val1
00192 start = end
00193 end += 16
00194 (_x.travel, _x.speed,) = _struct_2d.unpack(str[start:end])
00195 self.encoders.append(val1)
00196 return self
00197 except struct.error as e:
00198 raise genpy.DeserializationError(e)
00199
00200 _struct_I = genpy.struct_I
00201 _struct_2d = struct.Struct("<2d")
00202 _struct_3I = struct.Struct("<3I")