00001 """autogenerated by genpy from ethercat_hardware/MotorTemperature.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 genpy
00008
00009 class MotorTemperature(genpy.Message):
00010 _md5sum = "d8c7239cd096d6f25b75bff6b63f2162"
00011 _type = "ethercat_hardware/MotorTemperature"
00012 _has_header = False
00013 _full_text = """# Sample of motor heating information
00014 time stamp
00015 float64 winding_temperature
00016 float64 housing_temperature
00017 float64 ambient_temperature
00018 float64 heating_power
00019 """
00020 __slots__ = ['stamp','winding_temperature','housing_temperature','ambient_temperature','heating_power']
00021 _slot_types = ['time','float64','float64','float64','float64']
00022
00023 def __init__(self, *args, **kwds):
00024 """
00025 Constructor. Any message fields that are implicitly/explicitly
00026 set to None will be assigned a default value. The recommend
00027 use is keyword arguments as this is more robust to future message
00028 changes. You cannot mix in-order arguments and keyword arguments.
00029
00030 The available fields are:
00031 stamp,winding_temperature,housing_temperature,ambient_temperature,heating_power
00032
00033 :param args: complete set of field values, in .msg order
00034 :param kwds: use keyword arguments corresponding to message field names
00035 to set specific fields.
00036 """
00037 if args or kwds:
00038 super(MotorTemperature, self).__init__(*args, **kwds)
00039
00040 if self.stamp is None:
00041 self.stamp = genpy.Time()
00042 if self.winding_temperature is None:
00043 self.winding_temperature = 0.
00044 if self.housing_temperature is None:
00045 self.housing_temperature = 0.
00046 if self.ambient_temperature is None:
00047 self.ambient_temperature = 0.
00048 if self.heating_power is None:
00049 self.heating_power = 0.
00050 else:
00051 self.stamp = genpy.Time()
00052 self.winding_temperature = 0.
00053 self.housing_temperature = 0.
00054 self.ambient_temperature = 0.
00055 self.heating_power = 0.
00056
00057 def _get_types(self):
00058 """
00059 internal API method
00060 """
00061 return self._slot_types
00062
00063 def serialize(self, buff):
00064 """
00065 serialize message into buffer
00066 :param buff: buffer, ``StringIO``
00067 """
00068 try:
00069 _x = self
00070 buff.write(_struct_2I4d.pack(_x.stamp.secs, _x.stamp.nsecs, _x.winding_temperature, _x.housing_temperature, _x.ambient_temperature, _x.heating_power))
00071 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00072 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00073
00074 def deserialize(self, str):
00075 """
00076 unpack serialized message in str into this message instance
00077 :param str: byte array of serialized message, ``str``
00078 """
00079 try:
00080 if self.stamp is None:
00081 self.stamp = genpy.Time()
00082 end = 0
00083 _x = self
00084 start = end
00085 end += 40
00086 (_x.stamp.secs, _x.stamp.nsecs, _x.winding_temperature, _x.housing_temperature, _x.ambient_temperature, _x.heating_power,) = _struct_2I4d.unpack(str[start:end])
00087 self.stamp.canon()
00088 return self
00089 except struct.error as e:
00090 raise genpy.DeserializationError(e)
00091
00092
00093 def serialize_numpy(self, buff, numpy):
00094 """
00095 serialize message with numpy array types into buffer
00096 :param buff: buffer, ``StringIO``
00097 :param numpy: numpy python module
00098 """
00099 try:
00100 _x = self
00101 buff.write(_struct_2I4d.pack(_x.stamp.secs, _x.stamp.nsecs, _x.winding_temperature, _x.housing_temperature, _x.ambient_temperature, _x.heating_power))
00102 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00103 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00104
00105 def deserialize_numpy(self, str, numpy):
00106 """
00107 unpack serialized message in str into this message instance using numpy for array types
00108 :param str: byte array of serialized message, ``str``
00109 :param numpy: numpy python module
00110 """
00111 try:
00112 if self.stamp is None:
00113 self.stamp = genpy.Time()
00114 end = 0
00115 _x = self
00116 start = end
00117 end += 40
00118 (_x.stamp.secs, _x.stamp.nsecs, _x.winding_temperature, _x.housing_temperature, _x.ambient_temperature, _x.heating_power,) = _struct_2I4d.unpack(str[start:end])
00119 self.stamp.canon()
00120 return self
00121 except struct.error as e:
00122 raise genpy.DeserializationError(e)
00123
00124 _struct_I = genpy.struct_I
00125 _struct_2I4d = struct.Struct("<2I4d")