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


ping
Author(s): Benjamin Pitzer
autogenerated on Sat Sep 27 2014 11:53:31