00001 """autogenerated by genpy from mtrace_tools/MotorResistance.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 mtrace_tools.msg
00008 import std_msgs.msg
00009
00010 class MotorResistance(genpy.Message):
00011 _md5sum = "eea54d3a2c32e33d77dae58766e45800"
00012 _type = "mtrace_tools/MotorResistance"
00013 _has_header = True
00014 _full_text = """Header header
00015 MotorResistanceSample[] samples
00016 ================================================================================
00017 MSG: std_msgs/Header
00018 # Standard metadata for higher-level stamped data types.
00019 # This is generally used to communicate timestamped data
00020 # in a particular coordinate frame.
00021 #
00022 # sequence ID: consecutively increasing ID
00023 uint32 seq
00024 #Two-integer timestamp that is expressed as:
00025 # * stamp.secs: seconds (stamp_secs) since epoch
00026 # * stamp.nsecs: nanoseconds since stamp_secs
00027 # time-handling sugar is provided by the client library
00028 time stamp
00029 #Frame this data is associated with
00030 # 0: no frame
00031 # 1: global frame
00032 string frame_id
00033
00034 ================================================================================
00035 MSG: mtrace_tools/MotorResistanceSample
00036 float64 current
00037 float64 voltage
00038 float64 velocity
00039 float64 position
00040 bool positive_direction
00041
00042 """
00043 __slots__ = ['header','samples']
00044 _slot_types = ['std_msgs/Header','mtrace_tools/MotorResistanceSample[]']
00045
00046 def __init__(self, *args, **kwds):
00047 """
00048 Constructor. Any message fields that are implicitly/explicitly
00049 set to None will be assigned a default value. The recommend
00050 use is keyword arguments as this is more robust to future message
00051 changes. You cannot mix in-order arguments and keyword arguments.
00052
00053 The available fields are:
00054 header,samples
00055
00056 :param args: complete set of field values, in .msg order
00057 :param kwds: use keyword arguments corresponding to message field names
00058 to set specific fields.
00059 """
00060 if args or kwds:
00061 super(MotorResistance, self).__init__(*args, **kwds)
00062
00063 if self.header is None:
00064 self.header = std_msgs.msg.Header()
00065 if self.samples is None:
00066 self.samples = []
00067 else:
00068 self.header = std_msgs.msg.Header()
00069 self.samples = []
00070
00071 def _get_types(self):
00072 """
00073 internal API method
00074 """
00075 return self._slot_types
00076
00077 def serialize(self, buff):
00078 """
00079 serialize message into buffer
00080 :param buff: buffer, ``StringIO``
00081 """
00082 try:
00083 _x = self
00084 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00085 _x = self.header.frame_id
00086 length = len(_x)
00087 if python3 or type(_x) == unicode:
00088 _x = _x.encode('utf-8')
00089 length = len(_x)
00090 buff.write(struct.pack('<I%ss'%length, length, _x))
00091 length = len(self.samples)
00092 buff.write(_struct_I.pack(length))
00093 for val1 in self.samples:
00094 _x = val1
00095 buff.write(_struct_4dB.pack(_x.current, _x.voltage, _x.velocity, _x.position, _x.positive_direction))
00096 except struct.error as se: self._check_types(se)
00097 except TypeError as te: self._check_types(te)
00098
00099 def deserialize(self, str):
00100 """
00101 unpack serialized message in str into this message instance
00102 :param str: byte array of serialized message, ``str``
00103 """
00104 try:
00105 if self.header is None:
00106 self.header = std_msgs.msg.Header()
00107 if self.samples is None:
00108 self.samples = None
00109 end = 0
00110 _x = self
00111 start = end
00112 end += 12
00113 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00114 start = end
00115 end += 4
00116 (length,) = _struct_I.unpack(str[start:end])
00117 start = end
00118 end += length
00119 if python3:
00120 self.header.frame_id = str[start:end].decode('utf-8')
00121 else:
00122 self.header.frame_id = str[start:end]
00123 start = end
00124 end += 4
00125 (length,) = _struct_I.unpack(str[start:end])
00126 self.samples = []
00127 for i in range(0, length):
00128 val1 = mtrace_tools.msg.MotorResistanceSample()
00129 _x = val1
00130 start = end
00131 end += 33
00132 (_x.current, _x.voltage, _x.velocity, _x.position, _x.positive_direction,) = _struct_4dB.unpack(str[start:end])
00133 val1.positive_direction = bool(val1.positive_direction)
00134 self.samples.append(val1)
00135 return self
00136 except struct.error as e:
00137 raise genpy.DeserializationError(e)
00138
00139
00140 def serialize_numpy(self, buff, numpy):
00141 """
00142 serialize message with numpy array types into buffer
00143 :param buff: buffer, ``StringIO``
00144 :param numpy: numpy python module
00145 """
00146 try:
00147 _x = self
00148 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00149 _x = self.header.frame_id
00150 length = len(_x)
00151 if python3 or type(_x) == unicode:
00152 _x = _x.encode('utf-8')
00153 length = len(_x)
00154 buff.write(struct.pack('<I%ss'%length, length, _x))
00155 length = len(self.samples)
00156 buff.write(_struct_I.pack(length))
00157 for val1 in self.samples:
00158 _x = val1
00159 buff.write(_struct_4dB.pack(_x.current, _x.voltage, _x.velocity, _x.position, _x.positive_direction))
00160 except struct.error as se: self._check_types(se)
00161 except TypeError as te: self._check_types(te)
00162
00163 def deserialize_numpy(self, str, numpy):
00164 """
00165 unpack serialized message in str into this message instance using numpy for array types
00166 :param str: byte array of serialized message, ``str``
00167 :param numpy: numpy python module
00168 """
00169 try:
00170 if self.header is None:
00171 self.header = std_msgs.msg.Header()
00172 if self.samples is None:
00173 self.samples = None
00174 end = 0
00175 _x = self
00176 start = end
00177 end += 12
00178 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00179 start = end
00180 end += 4
00181 (length,) = _struct_I.unpack(str[start:end])
00182 start = end
00183 end += length
00184 if python3:
00185 self.header.frame_id = str[start:end].decode('utf-8')
00186 else:
00187 self.header.frame_id = str[start:end]
00188 start = end
00189 end += 4
00190 (length,) = _struct_I.unpack(str[start:end])
00191 self.samples = []
00192 for i in range(0, length):
00193 val1 = mtrace_tools.msg.MotorResistanceSample()
00194 _x = val1
00195 start = end
00196 end += 33
00197 (_x.current, _x.voltage, _x.velocity, _x.position, _x.positive_direction,) = _struct_4dB.unpack(str[start:end])
00198 val1.positive_direction = bool(val1.positive_direction)
00199 self.samples.append(val1)
00200 return self
00201 except struct.error as e:
00202 raise genpy.DeserializationError(e)
00203
00204 _struct_I = genpy.struct_I
00205 _struct_4dB = struct.Struct("<4dB")
00206 _struct_3I = struct.Struct("<3I")