00001 """autogenerated by genmsg_py from Header.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005 import roslib.rostime
00006
00007 class Header(roslib.message.Message):
00008 _md5sum = "2176decaecbce78abc3b96ef049fabed"
00009 _type = "std_msgs/Header"
00010 _has_header = False
00011 _full_text = """# Standard metadata for higher-level stamped data types.
00012 # This is generally used to communicate timestamped data
00013 # in a particular coordinate frame.
00014 #
00015 # sequence ID: consecutively increasing ID
00016 uint32 seq
00017 #Two-integer timestamp that is expressed as:
00018 # * stamp.secs: seconds (stamp_secs) since epoch
00019 # * stamp.nsecs: nanoseconds since stamp_secs
00020 # time-handling sugar is provided by the client library
00021 time stamp
00022 #Frame this data is associated with
00023 # 0: no frame
00024 # 1: global frame
00025 string frame_id
00026
00027 """
00028 __slots__ = ['seq','stamp','frame_id']
00029 _slot_types = ['uint32','time','string']
00030
00031 def __init__(self, *args, **kwds):
00032 """
00033 Constructor. Any message fields that are implicitly/explicitly
00034 set to None will be assigned a default value. The recommend
00035 use is keyword arguments as this is more robust to future message
00036 changes. You cannot mix in-order arguments and keyword arguments.
00037
00038 The available fields are:
00039 seq,stamp,frame_id
00040
00041 @param args: complete set of field values, in .msg order
00042 @param kwds: use keyword arguments corresponding to message field names
00043 to set specific fields.
00044 """
00045 if args or kwds:
00046 super(Header, self).__init__(*args, **kwds)
00047
00048 if self.seq is None:
00049 self.seq = 0
00050 if self.stamp is None:
00051 self.stamp = roslib.rostime.Time()
00052 if self.frame_id is None:
00053 self.frame_id = ''
00054 else:
00055 self.seq = 0
00056 self.stamp = roslib.rostime.Time()
00057 self.frame_id = ''
00058
00059 def _get_types(self):
00060 """
00061 internal API method
00062 """
00063 return self._slot_types
00064
00065 def serialize(self, buff):
00066 """
00067 serialize message into buffer
00068 @param buff: buffer
00069 @type buff: StringIO
00070 """
00071 try:
00072 _x = self
00073 buff.write(_struct_3I.pack(_x.seq, _x.stamp.secs, _x.stamp.nsecs))
00074 _x = self.frame_id
00075 length = len(_x)
00076 buff.write(struct.pack('<I%ss'%length, length, _x))
00077 except struct.error, se: self._check_types(se)
00078 except TypeError, te: self._check_types(te)
00079
00080 def deserialize(self, str):
00081 """
00082 unpack serialized message in str into this message instance
00083 @param str: byte array of serialized message
00084 @type str: str
00085 """
00086 try:
00087 if self.stamp is None:
00088 self.stamp = roslib.rostime.Time()
00089 end = 0
00090 _x = self
00091 start = end
00092 end += 12
00093 (_x.seq, _x.stamp.secs, _x.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00094 start = end
00095 end += 4
00096 (length,) = _struct_I.unpack(str[start:end])
00097 start = end
00098 end += length
00099 self.frame_id = str[start:end]
00100 self.stamp.canon()
00101 return self
00102 except struct.error, e:
00103 raise roslib.message.DeserializationError(e)
00104
00105
00106 def serialize_numpy(self, buff, numpy):
00107 """
00108 serialize message with numpy array types into buffer
00109 @param buff: buffer
00110 @type buff: StringIO
00111 @param numpy: numpy python module
00112 @type numpy module
00113 """
00114 try:
00115 _x = self
00116 buff.write(_struct_3I.pack(_x.seq, _x.stamp.secs, _x.stamp.nsecs))
00117 _x = self.frame_id
00118 length = len(_x)
00119 buff.write(struct.pack('<I%ss'%length, length, _x))
00120 except struct.error, se: self._check_types(se)
00121 except TypeError, te: self._check_types(te)
00122
00123 def deserialize_numpy(self, str, numpy):
00124 """
00125 unpack serialized message in str into this message instance using numpy for array types
00126 @param str: byte array of serialized message
00127 @type str: str
00128 @param numpy: numpy python module
00129 @type numpy: module
00130 """
00131 try:
00132 if self.stamp is None:
00133 self.stamp = roslib.rostime.Time()
00134 end = 0
00135 _x = self
00136 start = end
00137 end += 12
00138 (_x.seq, _x.stamp.secs, _x.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00139 start = end
00140 end += 4
00141 (length,) = _struct_I.unpack(str[start:end])
00142 start = end
00143 end += length
00144 self.frame_id = str[start:end]
00145 self.stamp.canon()
00146 return self
00147 except struct.error, e:
00148 raise roslib.message.DeserializationError(e)
00149
00150 _struct_I = roslib.message.struct_I
00151 _struct_3I = struct.Struct("<3I")