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