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