$search
00001 """autogenerated by genmsg_py from Pong.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 import roslib.rostime 00006 00007 class Pong(roslib.message.Message): 00008 _md5sum = "cae5104cf50168b02c919fb7acc6c70e" 00009 _type = "ping/Pong" 00010 _has_header = False #flag to mark the presence of a Header object 00011 _full_text = """time stamp 00012 uint32 hash 00013 """ 00014 __slots__ = ['stamp','hash'] 00015 _slot_types = ['time','uint32'] 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 stamp,hash 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(Pong, self).__init__(*args, **kwds) 00033 #message fields cannot be None, assign default values for those that are 00034 if self.stamp is None: 00035 self.stamp = roslib.rostime.Time() 00036 if self.hash is None: 00037 self.hash = 0 00038 else: 00039 self.stamp = roslib.rostime.Time() 00040 self.hash = 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_3I.pack(_x.stamp.secs, _x.stamp.nsecs, _x.hash)) 00057 except struct.error as se: self._check_types(se) 00058 except TypeError as 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 if self.stamp is None: 00068 self.stamp = roslib.rostime.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 roslib.message.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 00084 @type buff: StringIO 00085 @param numpy: numpy python module 00086 @type numpy module 00087 """ 00088 try: 00089 _x = self 00090 buff.write(_struct_3I.pack(_x.stamp.secs, _x.stamp.nsecs, _x.hash)) 00091 except struct.error as se: self._check_types(se) 00092 except TypeError as te: self._check_types(te) 00093 00094 def deserialize_numpy(self, str, numpy): 00095 """ 00096 unpack serialized message in str into this message instance using numpy for array types 00097 @param str: byte array of serialized message 00098 @type str: str 00099 @param numpy: numpy python module 00100 @type numpy: module 00101 """ 00102 try: 00103 if self.stamp is None: 00104 self.stamp = roslib.rostime.Time() 00105 end = 0 00106 _x = self 00107 start = end 00108 end += 12 00109 (_x.stamp.secs, _x.stamp.nsecs, _x.hash,) = _struct_3I.unpack(str[start:end]) 00110 self.stamp.canon() 00111 return self 00112 except struct.error as e: 00113 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00114 00115 _struct_I = roslib.message.struct_I 00116 _struct_3I = struct.Struct("<3I")