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