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