_MultiWaveform.py
Go to the documentation of this file.
00001 """autogenerated by genpy from ethercat_trigger_controllers/MultiWaveform.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 MultiWaveform(genpy.Message):
00010   _md5sum = "6a8e166563c159e73f391a302e7b37f6"
00011   _type = "ethercat_trigger_controllers/MultiWaveform"
00012   _has_header = False #flag to mark the presence of a Header object
00013   _full_text = """# Transitions will occur at k * period + zero_offset + transitions[j].time, where j and
00014 # k are integers.
00015 
00016 float64 period # Period of the waveform in seconds.
00017 float64 zero_offset # Time corresponding to a time of 0 in times[] in seconds
00018 MultiWaveformTransition[] transitions # Transitions in the waveform. Transition times should be in increasing order, and be between 0 (inclusive) and period (exclusive)
00019 
00020 ================================================================================
00021 MSG: ethercat_trigger_controllers/MultiWaveformTransition
00022 # Used to specify a transition in the SetMultiWaveform service.
00023 
00024 float64 time # Transition time after start of period.
00025 uint32 value # Value of the digital output after the transition time.
00026 string topic # Topic to publish the transition timestamp to, or empty string if the transition should not be published.
00027 
00028 """
00029   __slots__ = ['period','zero_offset','transitions']
00030   _slot_types = ['float64','float64','ethercat_trigger_controllers/MultiWaveformTransition[]']
00031 
00032   def __init__(self, *args, **kwds):
00033     """
00034     Constructor. Any message fields that are implicitly/explicitly
00035     set to None will be assigned a default value. The recommend
00036     use is keyword arguments as this is more robust to future message
00037     changes.  You cannot mix in-order arguments and keyword arguments.
00038 
00039     The available fields are:
00040        period,zero_offset,transitions
00041 
00042     :param args: complete set of field values, in .msg order
00043     :param kwds: use keyword arguments corresponding to message field names
00044     to set specific fields.
00045     """
00046     if args or kwds:
00047       super(MultiWaveform, self).__init__(*args, **kwds)
00048       #message fields cannot be None, assign default values for those that are
00049       if self.period is None:
00050         self.period = 0.
00051       if self.zero_offset is None:
00052         self.zero_offset = 0.
00053       if self.transitions is None:
00054         self.transitions = []
00055     else:
00056       self.period = 0.
00057       self.zero_offset = 0.
00058       self.transitions = []
00059 
00060   def _get_types(self):
00061     """
00062     internal API method
00063     """
00064     return self._slot_types
00065 
00066   def serialize(self, buff):
00067     """
00068     serialize message into buffer
00069     :param buff: buffer, ``StringIO``
00070     """
00071     try:
00072       _x = self
00073       buff.write(_struct_2d.pack(_x.period, _x.zero_offset))
00074       length = len(self.transitions)
00075       buff.write(_struct_I.pack(length))
00076       for val1 in self.transitions:
00077         _x = val1
00078         buff.write(_struct_dI.pack(_x.time, _x.value))
00079         _x = val1.topic
00080         length = len(_x)
00081         if python3 or type(_x) == unicode:
00082           _x = _x.encode('utf-8')
00083           length = len(_x)
00084         buff.write(struct.pack('<I%ss'%length, length, _x))
00085     except struct.error as se: self._check_types(se)
00086     except TypeError as te: self._check_types(te)
00087 
00088   def deserialize(self, str):
00089     """
00090     unpack serialized message in str into this message instance
00091     :param str: byte array of serialized message, ``str``
00092     """
00093     try:
00094       if self.transitions is None:
00095         self.transitions = None
00096       end = 0
00097       _x = self
00098       start = end
00099       end += 16
00100       (_x.period, _x.zero_offset,) = _struct_2d.unpack(str[start:end])
00101       start = end
00102       end += 4
00103       (length,) = _struct_I.unpack(str[start:end])
00104       self.transitions = []
00105       for i in range(0, length):
00106         val1 = ethercat_trigger_controllers.msg.MultiWaveformTransition()
00107         _x = val1
00108         start = end
00109         end += 12
00110         (_x.time, _x.value,) = _struct_dI.unpack(str[start:end])
00111         start = end
00112         end += 4
00113         (length,) = _struct_I.unpack(str[start:end])
00114         start = end
00115         end += length
00116         if python3:
00117           val1.topic = str[start:end].decode('utf-8')
00118         else:
00119           val1.topic = str[start:end]
00120         self.transitions.append(val1)
00121       return self
00122     except struct.error as e:
00123       raise genpy.DeserializationError(e) #most likely buffer underfill
00124 
00125 
00126   def serialize_numpy(self, buff, numpy):
00127     """
00128     serialize message with numpy array types into buffer
00129     :param buff: buffer, ``StringIO``
00130     :param numpy: numpy python module
00131     """
00132     try:
00133       _x = self
00134       buff.write(_struct_2d.pack(_x.period, _x.zero_offset))
00135       length = len(self.transitions)
00136       buff.write(_struct_I.pack(length))
00137       for val1 in self.transitions:
00138         _x = val1
00139         buff.write(_struct_dI.pack(_x.time, _x.value))
00140         _x = val1.topic
00141         length = len(_x)
00142         if python3 or type(_x) == unicode:
00143           _x = _x.encode('utf-8')
00144           length = len(_x)
00145         buff.write(struct.pack('<I%ss'%length, length, _x))
00146     except struct.error as se: self._check_types(se)
00147     except TypeError as te: self._check_types(te)
00148 
00149   def deserialize_numpy(self, str, numpy):
00150     """
00151     unpack serialized message in str into this message instance using numpy for array types
00152     :param str: byte array of serialized message, ``str``
00153     :param numpy: numpy python module
00154     """
00155     try:
00156       if self.transitions is None:
00157         self.transitions = None
00158       end = 0
00159       _x = self
00160       start = end
00161       end += 16
00162       (_x.period, _x.zero_offset,) = _struct_2d.unpack(str[start:end])
00163       start = end
00164       end += 4
00165       (length,) = _struct_I.unpack(str[start:end])
00166       self.transitions = []
00167       for i in range(0, length):
00168         val1 = ethercat_trigger_controllers.msg.MultiWaveformTransition()
00169         _x = val1
00170         start = end
00171         end += 12
00172         (_x.time, _x.value,) = _struct_dI.unpack(str[start:end])
00173         start = end
00174         end += 4
00175         (length,) = _struct_I.unpack(str[start:end])
00176         start = end
00177         end += length
00178         if python3:
00179           val1.topic = str[start:end].decode('utf-8')
00180         else:
00181           val1.topic = str[start:end]
00182         self.transitions.append(val1)
00183       return self
00184     except struct.error as e:
00185       raise genpy.DeserializationError(e) #most likely buffer underfill
00186 
00187 _struct_I = genpy.struct_I
00188 _struct_2d = struct.Struct("<2d")
00189 _struct_dI = struct.Struct("<dI")


ethercat_trigger_controllers
Author(s): Blaise Gassend
autogenerated on Fri Jan 3 2014 11:41:29