00001 """autogenerated by genpy from ethercat_trigger_controllers/SetMultiWaveformRequest.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 ethercat_trigger_controllers.msg
00008
00009 class SetMultiWaveformRequest(genpy.Message):
00010 _md5sum = "bfedad8205348a9bcc90e6ae4b778d86"
00011 _type = "ethercat_trigger_controllers/SetMultiWaveformRequest"
00012 _has_header = False
00013 _full_text = """MultiWaveform waveform
00014
00015 ================================================================================
00016 MSG: ethercat_trigger_controllers/MultiWaveform
00017 # Transitions will occur at k * period + zero_offset + transitions[j].time, where j and
00018 # k are integers.
00019
00020 float64 period # Period of the waveform in seconds.
00021 float64 zero_offset # Time corresponding to a time of 0 in times[] in seconds
00022 MultiWaveformTransition[] transitions # Transitions in the waveform. Transition times should be in increasing order, and be between 0 (inclusive) and period (exclusive)
00023
00024 ================================================================================
00025 MSG: ethercat_trigger_controllers/MultiWaveformTransition
00026 # Used to specify a transition in the SetMultiWaveform service.
00027
00028 float64 time # Transition time after start of period.
00029 uint32 value # Value of the digital output after the transition time.
00030 string topic # Topic to publish the transition timestamp to, or empty string if the transition should not be published.
00031
00032 """
00033 __slots__ = ['waveform']
00034 _slot_types = ['ethercat_trigger_controllers/MultiWaveform']
00035
00036 def __init__(self, *args, **kwds):
00037 """
00038 Constructor. Any message fields that are implicitly/explicitly
00039 set to None will be assigned a default value. The recommend
00040 use is keyword arguments as this is more robust to future message
00041 changes. You cannot mix in-order arguments and keyword arguments.
00042
00043 The available fields are:
00044 waveform
00045
00046 :param args: complete set of field values, in .msg order
00047 :param kwds: use keyword arguments corresponding to message field names
00048 to set specific fields.
00049 """
00050 if args or kwds:
00051 super(SetMultiWaveformRequest, self).__init__(*args, **kwds)
00052
00053 if self.waveform is None:
00054 self.waveform = ethercat_trigger_controllers.msg.MultiWaveform()
00055 else:
00056 self.waveform = ethercat_trigger_controllers.msg.MultiWaveform()
00057
00058 def _get_types(self):
00059 """
00060 internal API method
00061 """
00062 return self._slot_types
00063
00064 def serialize(self, buff):
00065 """
00066 serialize message into buffer
00067 :param buff: buffer, ``StringIO``
00068 """
00069 try:
00070 _x = self
00071 buff.write(_struct_2d.pack(_x.waveform.period, _x.waveform.zero_offset))
00072 length = len(self.waveform.transitions)
00073 buff.write(_struct_I.pack(length))
00074 for val1 in self.waveform.transitions:
00075 _x = val1
00076 buff.write(_struct_dI.pack(_x.time, _x.value))
00077 _x = val1.topic
00078 length = len(_x)
00079 if python3 or type(_x) == unicode:
00080 _x = _x.encode('utf-8')
00081 length = len(_x)
00082 buff.write(struct.pack('<I%ss'%length, length, _x))
00083 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00084 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00085
00086 def deserialize(self, str):
00087 """
00088 unpack serialized message in str into this message instance
00089 :param str: byte array of serialized message, ``str``
00090 """
00091 try:
00092 if self.waveform is None:
00093 self.waveform = ethercat_trigger_controllers.msg.MultiWaveform()
00094 end = 0
00095 _x = self
00096 start = end
00097 end += 16
00098 (_x.waveform.period, _x.waveform.zero_offset,) = _struct_2d.unpack(str[start:end])
00099 start = end
00100 end += 4
00101 (length,) = _struct_I.unpack(str[start:end])
00102 self.waveform.transitions = []
00103 for i in range(0, length):
00104 val1 = ethercat_trigger_controllers.msg.MultiWaveformTransition()
00105 _x = val1
00106 start = end
00107 end += 12
00108 (_x.time, _x.value,) = _struct_dI.unpack(str[start:end])
00109 start = end
00110 end += 4
00111 (length,) = _struct_I.unpack(str[start:end])
00112 start = end
00113 end += length
00114 if python3:
00115 val1.topic = str[start:end].decode('utf-8')
00116 else:
00117 val1.topic = str[start:end]
00118 self.waveform.transitions.append(val1)
00119 return self
00120 except struct.error as e:
00121 raise genpy.DeserializationError(e)
00122
00123
00124 def serialize_numpy(self, buff, numpy):
00125 """
00126 serialize message with numpy array types into buffer
00127 :param buff: buffer, ``StringIO``
00128 :param numpy: numpy python module
00129 """
00130 try:
00131 _x = self
00132 buff.write(_struct_2d.pack(_x.waveform.period, _x.waveform.zero_offset))
00133 length = len(self.waveform.transitions)
00134 buff.write(_struct_I.pack(length))
00135 for val1 in self.waveform.transitions:
00136 _x = val1
00137 buff.write(_struct_dI.pack(_x.time, _x.value))
00138 _x = val1.topic
00139 length = len(_x)
00140 if python3 or type(_x) == unicode:
00141 _x = _x.encode('utf-8')
00142 length = len(_x)
00143 buff.write(struct.pack('<I%ss'%length, length, _x))
00144 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00145 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00146
00147 def deserialize_numpy(self, str, numpy):
00148 """
00149 unpack serialized message in str into this message instance using numpy for array types
00150 :param str: byte array of serialized message, ``str``
00151 :param numpy: numpy python module
00152 """
00153 try:
00154 if self.waveform is None:
00155 self.waveform = ethercat_trigger_controllers.msg.MultiWaveform()
00156 end = 0
00157 _x = self
00158 start = end
00159 end += 16
00160 (_x.waveform.period, _x.waveform.zero_offset,) = _struct_2d.unpack(str[start:end])
00161 start = end
00162 end += 4
00163 (length,) = _struct_I.unpack(str[start:end])
00164 self.waveform.transitions = []
00165 for i in range(0, length):
00166 val1 = ethercat_trigger_controllers.msg.MultiWaveformTransition()
00167 _x = val1
00168 start = end
00169 end += 12
00170 (_x.time, _x.value,) = _struct_dI.unpack(str[start:end])
00171 start = end
00172 end += 4
00173 (length,) = _struct_I.unpack(str[start:end])
00174 start = end
00175 end += length
00176 if python3:
00177 val1.topic = str[start:end].decode('utf-8')
00178 else:
00179 val1.topic = str[start:end]
00180 self.waveform.transitions.append(val1)
00181 return self
00182 except struct.error as e:
00183 raise genpy.DeserializationError(e)
00184
00185 _struct_I = genpy.struct_I
00186 _struct_2d = struct.Struct("<2d")
00187 _struct_dI = struct.Struct("<dI")
00188 """autogenerated by genpy from ethercat_trigger_controllers/SetMultiWaveformResponse.msg. Do not edit."""
00189 import sys
00190 python3 = True if sys.hexversion > 0x03000000 else False
00191 import genpy
00192 import struct
00193
00194
00195 class SetMultiWaveformResponse(genpy.Message):
00196 _md5sum = "2ec6f3eff0161f4257b808b12bc830c2"
00197 _type = "ethercat_trigger_controllers/SetMultiWaveformResponse"
00198 _has_header = False
00199 _full_text = """bool success
00200 string status_message
00201
00202
00203 """
00204 __slots__ = ['success','status_message']
00205 _slot_types = ['bool','string']
00206
00207 def __init__(self, *args, **kwds):
00208 """
00209 Constructor. Any message fields that are implicitly/explicitly
00210 set to None will be assigned a default value. The recommend
00211 use is keyword arguments as this is more robust to future message
00212 changes. You cannot mix in-order arguments and keyword arguments.
00213
00214 The available fields are:
00215 success,status_message
00216
00217 :param args: complete set of field values, in .msg order
00218 :param kwds: use keyword arguments corresponding to message field names
00219 to set specific fields.
00220 """
00221 if args or kwds:
00222 super(SetMultiWaveformResponse, self).__init__(*args, **kwds)
00223
00224 if self.success is None:
00225 self.success = False
00226 if self.status_message is None:
00227 self.status_message = ''
00228 else:
00229 self.success = False
00230 self.status_message = ''
00231
00232 def _get_types(self):
00233 """
00234 internal API method
00235 """
00236 return self._slot_types
00237
00238 def serialize(self, buff):
00239 """
00240 serialize message into buffer
00241 :param buff: buffer, ``StringIO``
00242 """
00243 try:
00244 buff.write(_struct_B.pack(self.success))
00245 _x = self.status_message
00246 length = len(_x)
00247 if python3 or type(_x) == unicode:
00248 _x = _x.encode('utf-8')
00249 length = len(_x)
00250 buff.write(struct.pack('<I%ss'%length, length, _x))
00251 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00252 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00253
00254 def deserialize(self, str):
00255 """
00256 unpack serialized message in str into this message instance
00257 :param str: byte array of serialized message, ``str``
00258 """
00259 try:
00260 end = 0
00261 start = end
00262 end += 1
00263 (self.success,) = _struct_B.unpack(str[start:end])
00264 self.success = bool(self.success)
00265 start = end
00266 end += 4
00267 (length,) = _struct_I.unpack(str[start:end])
00268 start = end
00269 end += length
00270 if python3:
00271 self.status_message = str[start:end].decode('utf-8')
00272 else:
00273 self.status_message = str[start:end]
00274 return self
00275 except struct.error as e:
00276 raise genpy.DeserializationError(e)
00277
00278
00279 def serialize_numpy(self, buff, numpy):
00280 """
00281 serialize message with numpy array types into buffer
00282 :param buff: buffer, ``StringIO``
00283 :param numpy: numpy python module
00284 """
00285 try:
00286 buff.write(_struct_B.pack(self.success))
00287 _x = self.status_message
00288 length = len(_x)
00289 if python3 or type(_x) == unicode:
00290 _x = _x.encode('utf-8')
00291 length = len(_x)
00292 buff.write(struct.pack('<I%ss'%length, length, _x))
00293 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00294 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00295
00296 def deserialize_numpy(self, str, numpy):
00297 """
00298 unpack serialized message in str into this message instance using numpy for array types
00299 :param str: byte array of serialized message, ``str``
00300 :param numpy: numpy python module
00301 """
00302 try:
00303 end = 0
00304 start = end
00305 end += 1
00306 (self.success,) = _struct_B.unpack(str[start:end])
00307 self.success = bool(self.success)
00308 start = end
00309 end += 4
00310 (length,) = _struct_I.unpack(str[start:end])
00311 start = end
00312 end += length
00313 if python3:
00314 self.status_message = str[start:end].decode('utf-8')
00315 else:
00316 self.status_message = str[start:end]
00317 return self
00318 except struct.error as e:
00319 raise genpy.DeserializationError(e)
00320
00321 _struct_I = genpy.struct_I
00322 _struct_B = struct.Struct("<B")
00323 class SetMultiWaveform(object):
00324 _type = 'ethercat_trigger_controllers/SetMultiWaveform'
00325 _md5sum = 'cbb7e900a71a9a437da9999c8d39fff4'
00326 _request_class = SetMultiWaveformRequest
00327 _response_class = SetMultiWaveformResponse