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