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