00001 """autogenerated by genpy from art_msgs/ThrottleState.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 std_msgs.msg
00008
00009 class ThrottleState(genpy.Message):
00010 _md5sum = "5b1c64434e6ebe49625631607b188cd5"
00011 _type = "art_msgs/ThrottleState"
00012 _has_header = True
00013 _full_text = """# ART throttle controller state message
00014
00015 # $Id: ThrottleState.msg 644 2010-09-28 03:19:07Z jack.oquin $
00016
00017 Header header
00018
00019 float32 position # fractional position [0, 1]
00020 float32 rpms # engine speed (rev/min)
00021 uint8 estop # emergency stop indicator
00022
00023 # optional extra diagnostic information:
00024 float32 pwm # Pulse Width Modulation value
00025 float32 dstate # PID derivative state
00026 float32 istate # PID integral state
00027
00028 ================================================================================
00029 MSG: std_msgs/Header
00030 # Standard metadata for higher-level stamped data types.
00031 # This is generally used to communicate timestamped data
00032 # in a particular coordinate frame.
00033 #
00034 # sequence ID: consecutively increasing ID
00035 uint32 seq
00036 #Two-integer timestamp that is expressed as:
00037 # * stamp.secs: seconds (stamp_secs) since epoch
00038 # * stamp.nsecs: nanoseconds since stamp_secs
00039 # time-handling sugar is provided by the client library
00040 time stamp
00041 #Frame this data is associated with
00042 # 0: no frame
00043 # 1: global frame
00044 string frame_id
00045
00046 """
00047 __slots__ = ['header','position','rpms','estop','pwm','dstate','istate']
00048 _slot_types = ['std_msgs/Header','float32','float32','uint8','float32','float32','float32']
00049
00050 def __init__(self, *args, **kwds):
00051 """
00052 Constructor. Any message fields that are implicitly/explicitly
00053 set to None will be assigned a default value. The recommend
00054 use is keyword arguments as this is more robust to future message
00055 changes. You cannot mix in-order arguments and keyword arguments.
00056
00057 The available fields are:
00058 header,position,rpms,estop,pwm,dstate,istate
00059
00060 :param args: complete set of field values, in .msg order
00061 :param kwds: use keyword arguments corresponding to message field names
00062 to set specific fields.
00063 """
00064 if args or kwds:
00065 super(ThrottleState, self).__init__(*args, **kwds)
00066
00067 if self.header is None:
00068 self.header = std_msgs.msg.Header()
00069 if self.position is None:
00070 self.position = 0.
00071 if self.rpms is None:
00072 self.rpms = 0.
00073 if self.estop is None:
00074 self.estop = 0
00075 if self.pwm is None:
00076 self.pwm = 0.
00077 if self.dstate is None:
00078 self.dstate = 0.
00079 if self.istate is None:
00080 self.istate = 0.
00081 else:
00082 self.header = std_msgs.msg.Header()
00083 self.position = 0.
00084 self.rpms = 0.
00085 self.estop = 0
00086 self.pwm = 0.
00087 self.dstate = 0.
00088 self.istate = 0.
00089
00090 def _get_types(self):
00091 """
00092 internal API method
00093 """
00094 return self._slot_types
00095
00096 def serialize(self, buff):
00097 """
00098 serialize message into buffer
00099 :param buff: buffer, ``StringIO``
00100 """
00101 try:
00102 _x = self
00103 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00104 _x = self.header.frame_id
00105 length = len(_x)
00106 if python3 or type(_x) == unicode:
00107 _x = _x.encode('utf-8')
00108 length = len(_x)
00109 buff.write(struct.pack('<I%ss'%length, length, _x))
00110 _x = self
00111 buff.write(_struct_2fB3f.pack(_x.position, _x.rpms, _x.estop, _x.pwm, _x.dstate, _x.istate))
00112 except struct.error as se: self._check_types(se)
00113 except TypeError as te: self._check_types(te)
00114
00115 def deserialize(self, str):
00116 """
00117 unpack serialized message in str into this message instance
00118 :param str: byte array of serialized message, ``str``
00119 """
00120 try:
00121 if self.header is None:
00122 self.header = std_msgs.msg.Header()
00123 end = 0
00124 _x = self
00125 start = end
00126 end += 12
00127 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00128 start = end
00129 end += 4
00130 (length,) = _struct_I.unpack(str[start:end])
00131 start = end
00132 end += length
00133 if python3:
00134 self.header.frame_id = str[start:end].decode('utf-8')
00135 else:
00136 self.header.frame_id = str[start:end]
00137 _x = self
00138 start = end
00139 end += 21
00140 (_x.position, _x.rpms, _x.estop, _x.pwm, _x.dstate, _x.istate,) = _struct_2fB3f.unpack(str[start:end])
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 _x = self
00162 buff.write(_struct_2fB3f.pack(_x.position, _x.rpms, _x.estop, _x.pwm, _x.dstate, _x.istate))
00163 except struct.error as se: self._check_types(se)
00164 except TypeError as te: self._check_types(te)
00165
00166 def deserialize_numpy(self, str, numpy):
00167 """
00168 unpack serialized message in str into this message instance using numpy for array types
00169 :param str: byte array of serialized message, ``str``
00170 :param numpy: numpy python module
00171 """
00172 try:
00173 if self.header is None:
00174 self.header = std_msgs.msg.Header()
00175 end = 0
00176 _x = self
00177 start = end
00178 end += 12
00179 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00180 start = end
00181 end += 4
00182 (length,) = _struct_I.unpack(str[start:end])
00183 start = end
00184 end += length
00185 if python3:
00186 self.header.frame_id = str[start:end].decode('utf-8')
00187 else:
00188 self.header.frame_id = str[start:end]
00189 _x = self
00190 start = end
00191 end += 21
00192 (_x.position, _x.rpms, _x.estop, _x.pwm, _x.dstate, _x.istate,) = _struct_2fB3f.unpack(str[start:end])
00193 return self
00194 except struct.error as e:
00195 raise genpy.DeserializationError(e)
00196
00197 _struct_I = genpy.struct_I
00198 _struct_3I = struct.Struct("<3I")
00199 _struct_2fB3f = struct.Struct("<2fB3f")