_Odometer.py
Go to the documentation of this file.
00001 """autogenerated by genpy from pr2_mechanism_controllers/Odometer.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 Odometer(genpy.Message):
00009   _md5sum = "1f1d53743f4592ee455aa3eaf9019457"
00010   _type = "pr2_mechanism_controllers/Odometer"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """float64 distance #total distance traveled (meters)
00013 float64 angle #total angle traveled (radians)
00014 """
00015   __slots__ = ['distance','angle']
00016   _slot_types = ['float64','float64']
00017 
00018   def __init__(self, *args, **kwds):
00019     """
00020     Constructor. Any message fields that are implicitly/explicitly
00021     set to None will be assigned a default value. The recommend
00022     use is keyword arguments as this is more robust to future message
00023     changes.  You cannot mix in-order arguments and keyword arguments.
00024 
00025     The available fields are:
00026        distance,angle
00027 
00028     :param args: complete set of field values, in .msg order
00029     :param kwds: use keyword arguments corresponding to message field names
00030     to set specific fields.
00031     """
00032     if args or kwds:
00033       super(Odometer, self).__init__(*args, **kwds)
00034       #message fields cannot be None, assign default values for those that are
00035       if self.distance is None:
00036         self.distance = 0.
00037       if self.angle is None:
00038         self.angle = 0.
00039     else:
00040       self.distance = 0.
00041       self.angle = 0.
00042 
00043   def _get_types(self):
00044     """
00045     internal API method
00046     """
00047     return self._slot_types
00048 
00049   def serialize(self, buff):
00050     """
00051     serialize message into buffer
00052     :param buff: buffer, ``StringIO``
00053     """
00054     try:
00055       _x = self
00056       buff.write(_struct_2d.pack(_x.distance, _x.angle))
00057     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00058     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
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, ``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 as e:
00073       raise genpy.DeserializationError(e) #most likely buffer underfill
00074 
00075 
00076   def serialize_numpy(self, buff, numpy):
00077     """
00078     serialize message with numpy array types into buffer
00079     :param buff: buffer, ``StringIO``
00080     :param numpy: numpy python module
00081     """
00082     try:
00083       _x = self
00084       buff.write(_struct_2d.pack(_x.distance, _x.angle))
00085     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00086     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00087 
00088   def deserialize_numpy(self, str, numpy):
00089     """
00090     unpack serialized message in str into this message instance using numpy for array types
00091     :param str: byte array of serialized message, ``str``
00092     :param numpy: numpy python module
00093     """
00094     try:
00095       end = 0
00096       _x = self
00097       start = end
00098       end += 16
00099       (_x.distance, _x.angle,) = _struct_2d.unpack(str[start:end])
00100       return self
00101     except struct.error as e:
00102       raise genpy.DeserializationError(e) #most likely buffer underfill
00103 
00104 _struct_I = genpy.struct_I
00105 _struct_2d = struct.Struct("<2d")


pr2_mechanism_controllers
Author(s): Sachin Chita, John Hsu, Melonee Wise
autogenerated on Thu Apr 24 2014 15:44:51