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