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