00001 """autogenerated by genmsg_py from Encoder.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005
00006 class Encoder(roslib.message.Message):
00007 _md5sum = "620a74fe7e8deb0e96bf85b534453633"
00008 _type = "clearpath_base/Encoder"
00009 _has_header = False
00010 _full_text = """float64 travel
00011 float64 speed
00012
00013 """
00014 __slots__ = ['travel','speed']
00015 _slot_types = ['float64','float64']
00016
00017 def __init__(self, *args, **kwds):
00018 """
00019 Constructor. Any message fields that are implicitly/explicitly
00020 set to None will be assigned a default value. The recommend
00021 use is keyword arguments as this is more robust to future message
00022 changes. You cannot mix in-order arguments and keyword arguments.
00023
00024 The available fields are:
00025 travel,speed
00026
00027 @param args: complete set of field values, in .msg order
00028 @param kwds: use keyword arguments corresponding to message field names
00029 to set specific fields.
00030 """
00031 if args or kwds:
00032 super(Encoder, self).__init__(*args, **kwds)
00033
00034 if self.travel is None:
00035 self.travel = 0.
00036 if self.speed is None:
00037 self.speed = 0.
00038 else:
00039 self.travel = 0.
00040 self.speed = 0.
00041
00042 def _get_types(self):
00043 """
00044 internal API method
00045 """
00046 return self._slot_types
00047
00048 def serialize(self, buff):
00049 """
00050 serialize message into buffer
00051 @param buff: buffer
00052 @type buff: StringIO
00053 """
00054 try:
00055 _x = self
00056 buff.write(_struct_2d.pack(_x.travel, _x.speed))
00057 except struct.error, se: self._check_types(se)
00058 except TypeError, te: self._check_types(te)
00059
00060 def deserialize(self, str):
00061 """
00062 unpack serialized message in str into this message instance
00063 @param str: byte array of serialized message
00064 @type str: str
00065 """
00066 try:
00067 end = 0
00068 _x = self
00069 start = end
00070 end += 16
00071 (_x.travel, _x.speed,) = _struct_2d.unpack(str[start:end])
00072 return self
00073 except struct.error, e:
00074 raise roslib.message.DeserializationError(e)
00075
00076
00077 def serialize_numpy(self, buff, numpy):
00078 """
00079 serialize message with numpy array types into buffer
00080 @param buff: buffer
00081 @type buff: StringIO
00082 @param numpy: numpy python module
00083 @type numpy module
00084 """
00085 try:
00086 _x = self
00087 buff.write(_struct_2d.pack(_x.travel, _x.speed))
00088 except struct.error, se: self._check_types(se)
00089 except TypeError, te: self._check_types(te)
00090
00091 def deserialize_numpy(self, str, numpy):
00092 """
00093 unpack serialized message in str into this message instance using numpy for array types
00094 @param str: byte array of serialized message
00095 @type str: str
00096 @param numpy: numpy python module
00097 @type numpy: module
00098 """
00099 try:
00100 end = 0
00101 _x = self
00102 start = end
00103 end += 16
00104 (_x.travel, _x.speed,) = _struct_2d.unpack(str[start:end])
00105 return self
00106 except struct.error, e:
00107 raise roslib.message.DeserializationError(e)
00108
00109 _struct_I = roslib.message.struct_I
00110 _struct_2d = struct.Struct("<2d")