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