00001 """autogenerated by genpy from kingfisher_msgs/Sense.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006
00007
00008 class Sense(genpy.Message):
00009 _md5sum = "b0209acddc7f26d2e3dc1338d6c4df94"
00010 _type = "kingfisher_msgs/Sense"
00011 _has_header = False
00012 _full_text = """# Voltage level of battery, in volts
00013 float32 battery
00014
00015 # Instantaneous current drawn by each motor, in amps.
00016 float32 current_left
00017 float32 current_right
00018
00019 # Temperature of PCB as measured by internal AVR thermometer,
00020 # reported in degrees centigrade.
00021 float32 pcb_temperature
00022 bool fan_on
00023
00024 # Bitfield represents status of hobby R/C override.
00025 uint8 RC_INRANGE=1
00026 uint8 RC_INUSE=2
00027 uint8 rc
00028
00029 # Pulse lengths received from the three R/C channels.
00030 uint16 rc_throttle
00031 uint16 rc_rotation
00032 uint16 rc_enable
00033
00034 """
00035
00036 RC_INRANGE = 1
00037 RC_INUSE = 2
00038
00039 __slots__ = ['battery','current_left','current_right','pcb_temperature','fan_on','rc','rc_throttle','rc_rotation','rc_enable']
00040 _slot_types = ['float32','float32','float32','float32','bool','uint8','uint16','uint16','uint16']
00041
00042 def __init__(self, *args, **kwds):
00043 """
00044 Constructor. Any message fields that are implicitly/explicitly
00045 set to None will be assigned a default value. The recommend
00046 use is keyword arguments as this is more robust to future message
00047 changes. You cannot mix in-order arguments and keyword arguments.
00048
00049 The available fields are:
00050 battery,current_left,current_right,pcb_temperature,fan_on,rc,rc_throttle,rc_rotation,rc_enable
00051
00052 :param args: complete set of field values, in .msg order
00053 :param kwds: use keyword arguments corresponding to message field names
00054 to set specific fields.
00055 """
00056 if args or kwds:
00057 super(Sense, self).__init__(*args, **kwds)
00058
00059 if self.battery is None:
00060 self.battery = 0.
00061 if self.current_left is None:
00062 self.current_left = 0.
00063 if self.current_right is None:
00064 self.current_right = 0.
00065 if self.pcb_temperature is None:
00066 self.pcb_temperature = 0.
00067 if self.fan_on is None:
00068 self.fan_on = False
00069 if self.rc is None:
00070 self.rc = 0
00071 if self.rc_throttle is None:
00072 self.rc_throttle = 0
00073 if self.rc_rotation is None:
00074 self.rc_rotation = 0
00075 if self.rc_enable is None:
00076 self.rc_enable = 0
00077 else:
00078 self.battery = 0.
00079 self.current_left = 0.
00080 self.current_right = 0.
00081 self.pcb_temperature = 0.
00082 self.fan_on = False
00083 self.rc = 0
00084 self.rc_throttle = 0
00085 self.rc_rotation = 0
00086 self.rc_enable = 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, ``StringIO``
00098 """
00099 try:
00100 _x = self
00101 buff.write(_struct_4f2B3H.pack(_x.battery, _x.current_left, _x.current_right, _x.pcb_temperature, _x.fan_on, _x.rc, _x.rc_throttle, _x.rc_rotation, _x.rc_enable))
00102 except struct.error as se: self._check_types(se)
00103 except TypeError as te: self._check_types(te)
00104
00105 def deserialize(self, str):
00106 """
00107 unpack serialized message in str into this message instance
00108 :param str: byte array of serialized message, ``str``
00109 """
00110 try:
00111 end = 0
00112 _x = self
00113 start = end
00114 end += 24
00115 (_x.battery, _x.current_left, _x.current_right, _x.pcb_temperature, _x.fan_on, _x.rc, _x.rc_throttle, _x.rc_rotation, _x.rc_enable,) = _struct_4f2B3H.unpack(str[start:end])
00116 self.fan_on = bool(self.fan_on)
00117 return self
00118 except struct.error as e:
00119 raise genpy.DeserializationError(e)
00120
00121
00122 def serialize_numpy(self, buff, numpy):
00123 """
00124 serialize message with numpy array types into buffer
00125 :param buff: buffer, ``StringIO``
00126 :param numpy: numpy python module
00127 """
00128 try:
00129 _x = self
00130 buff.write(_struct_4f2B3H.pack(_x.battery, _x.current_left, _x.current_right, _x.pcb_temperature, _x.fan_on, _x.rc, _x.rc_throttle, _x.rc_rotation, _x.rc_enable))
00131 except struct.error as se: self._check_types(se)
00132 except TypeError as te: self._check_types(te)
00133
00134 def deserialize_numpy(self, str, numpy):
00135 """
00136 unpack serialized message in str into this message instance using numpy for array types
00137 :param str: byte array of serialized message, ``str``
00138 :param numpy: numpy python module
00139 """
00140 try:
00141 end = 0
00142 _x = self
00143 start = end
00144 end += 24
00145 (_x.battery, _x.current_left, _x.current_right, _x.pcb_temperature, _x.fan_on, _x.rc, _x.rc_throttle, _x.rc_rotation, _x.rc_enable,) = _struct_4f2B3H.unpack(str[start:end])
00146 self.fan_on = bool(self.fan_on)
00147 return self
00148 except struct.error as e:
00149 raise genpy.DeserializationError(e)
00150
00151 _struct_I = genpy.struct_I
00152 _struct_4f2B3H = struct.Struct("<4f2B3H")