1 """autogenerated by genpy from network_monitor_udp/LinktestGoal.msg. Do not edit."""
2 import sys
3 python3 = True if sys.hexversion > 0x03000000 else False
4 import genpy
5 import struct
6
7
9 _md5sum = "a319f2787ce16837363051a27c7fd49f"
10 _type = "network_monitor_udp/LinktestGoal"
11 _has_header = False
12 _full_text = """# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======
13 # Goal definition
14 float32 DEFAULT_UPDATE_INTERVAL=0.15 # sec
15 float32 DEFAULT_BW=5000000.0 # bps
16 char DEFAULT_BWTYPE=99 # default bw type: constant
17 char BW_CONSTANT=99 # 'c'
18 char BW_ADAPTIVE=97 # 'a'
19 float32 LIM1=-0.3 # adaptive alg constants
20 float32 LIM2=0.3
21 float32 C1=-0.05
22 float32 C2=0.2
23 float32 DEFAULT_LATENCY_THRESHOLD=0.01 # sec
24 float32 DEFAULT_PKTLOSS_THRESHOLD=0.5 # %
25 int32 DEFAULT_PKTSIZE=1500 # bytes
26
27 float32 duration # sec
28 float32 update_interval # sec
29 float32 bw # bps
30 char bw_type # BW_CONSTANT | BW_ADAPTIVE
31 float32 latency_threshold # sec
32 float32 pktloss_threshold # %
33 uint8 tos
34 int32 pktsize # bytes
35 bool ros_returnpath # default: false == UDP
36 bool roundtrip # default: false == oneway
37 float32 max_return_time # sec
38 string rostopic_prefix
39 string sink_ip
40 int32 sink_port
41 float32[] latencybins
42
43 """
44
45 DEFAULT_UPDATE_INTERVAL = 0.15
46 DEFAULT_BW = 5000000.0
47 DEFAULT_BWTYPE = 99
48 BW_CONSTANT = 99
49 BW_ADAPTIVE = 97
50 LIM1 = -0.3
51 LIM2 = 0.3
52 C1 = -0.05
53 C2 = 0.2
54 DEFAULT_LATENCY_THRESHOLD = 0.01
55 DEFAULT_PKTLOSS_THRESHOLD = 0.5
56 DEFAULT_PKTSIZE = 1500
57
58 __slots__ = ['duration','update_interval','bw','bw_type','latency_threshold','pktloss_threshold','tos','pktsize','ros_returnpath','roundtrip','max_return_time','rostopic_prefix','sink_ip','sink_port','latencybins']
59 _slot_types = ['float32','float32','float32','char','float32','float32','uint8','int32','bool','bool','float32','string','string','int32','float32[]']
60
62 """
63 Constructor. Any message fields that are implicitly/explicitly
64 set to None will be assigned a default value. The recommend
65 use is keyword arguments as this is more robust to future message
66 changes. You cannot mix in-order arguments and keyword arguments.
67
68 The available fields are:
69 duration,update_interval,bw,bw_type,latency_threshold,pktloss_threshold,tos,pktsize,ros_returnpath,roundtrip,max_return_time,rostopic_prefix,sink_ip,sink_port,latencybins
70
71 :param args: complete set of field values, in .msg order
72 :param kwds: use keyword arguments corresponding to message field names
73 to set specific fields.
74 """
75 if args or kwds:
76 super(LinktestGoal, self).__init__(*args, **kwds)
77
78 if self.duration is None:
79 self.duration = 0.
80 if self.update_interval is None:
81 self.update_interval = 0.
82 if self.bw is None:
83 self.bw = 0.
84 if self.bw_type is None:
85 self.bw_type = 0
86 if self.latency_threshold is None:
87 self.latency_threshold = 0.
88 if self.pktloss_threshold is None:
89 self.pktloss_threshold = 0.
90 if self.tos is None:
91 self.tos = 0
92 if self.pktsize is None:
93 self.pktsize = 0
94 if self.ros_returnpath is None:
95 self.ros_returnpath = False
96 if self.roundtrip is None:
97 self.roundtrip = False
98 if self.max_return_time is None:
99 self.max_return_time = 0.
100 if self.rostopic_prefix is None:
101 self.rostopic_prefix = ''
102 if self.sink_ip is None:
103 self.sink_ip = ''
104 if self.sink_port is None:
105 self.sink_port = 0
106 if self.latencybins is None:
107 self.latencybins = []
108 else:
109 self.duration = 0.
110 self.update_interval = 0.
111 self.bw = 0.
112 self.bw_type = 0
113 self.latency_threshold = 0.
114 self.pktloss_threshold = 0.
115 self.tos = 0
116 self.pktsize = 0
117 self.ros_returnpath = False
118 self.roundtrip = False
119 self.max_return_time = 0.
120 self.rostopic_prefix = ''
121 self.sink_ip = ''
122 self.sink_port = 0
123 self.latencybins = []
124
126 """
127 internal API method
128 """
129 return self._slot_types
130
132 """
133 serialize message into buffer
134 :param buff: buffer, ``StringIO``
135 """
136 try:
137 _x = self
138 buff.write(_struct_3fB2fBi2Bf.pack(_x.duration, _x.update_interval, _x.bw, _x.bw_type, _x.latency_threshold, _x.pktloss_threshold, _x.tos, _x.pktsize, _x.ros_returnpath, _x.roundtrip, _x.max_return_time))
139 _x = self.rostopic_prefix
140 length = len(_x)
141 if python3 or type(_x) == unicode:
142 _x = _x.encode('utf-8')
143 length = len(_x)
144 buff.write(struct.pack('<I%ss'%length, length, _x))
145 _x = self.sink_ip
146 length = len(_x)
147 if python3 or type(_x) == unicode:
148 _x = _x.encode('utf-8')
149 length = len(_x)
150 buff.write(struct.pack('<I%ss'%length, length, _x))
151 buff.write(_struct_i.pack(self.sink_port))
152 length = len(self.latencybins)
153 buff.write(_struct_I.pack(length))
154 pattern = '<%sf'%length
155 buff.write(struct.pack(pattern, *self.latencybins))
156 except struct.error as se: self._check_types(se)
157 except TypeError as te: self._check_types(te)
158
160 """
161 unpack serialized message in str into this message instance
162 :param str: byte array of serialized message, ``str``
163 """
164 try:
165 end = 0
166 _x = self
167 start = end
168 end += 32
169 (_x.duration, _x.update_interval, _x.bw, _x.bw_type, _x.latency_threshold, _x.pktloss_threshold, _x.tos, _x.pktsize, _x.ros_returnpath, _x.roundtrip, _x.max_return_time,) = _struct_3fB2fBi2Bf.unpack(str[start:end])
170 self.ros_returnpath = bool(self.ros_returnpath)
171 self.roundtrip = bool(self.roundtrip)
172 start = end
173 end += 4
174 (length,) = _struct_I.unpack(str[start:end])
175 start = end
176 end += length
177 if python3:
178 self.rostopic_prefix = str[start:end].decode('utf-8')
179 else:
180 self.rostopic_prefix = str[start:end]
181 start = end
182 end += 4
183 (length,) = _struct_I.unpack(str[start:end])
184 start = end
185 end += length
186 if python3:
187 self.sink_ip = str[start:end].decode('utf-8')
188 else:
189 self.sink_ip = str[start:end]
190 start = end
191 end += 4
192 (self.sink_port,) = _struct_i.unpack(str[start:end])
193 start = end
194 end += 4
195 (length,) = _struct_I.unpack(str[start:end])
196 pattern = '<%sf'%length
197 start = end
198 end += struct.calcsize(pattern)
199 self.latencybins = struct.unpack(pattern, str[start:end])
200 return self
201 except struct.error as e:
202 raise genpy.DeserializationError(e)
203
204
206 """
207 serialize message with numpy array types into buffer
208 :param buff: buffer, ``StringIO``
209 :param numpy: numpy python module
210 """
211 try:
212 _x = self
213 buff.write(_struct_3fB2fBi2Bf.pack(_x.duration, _x.update_interval, _x.bw, _x.bw_type, _x.latency_threshold, _x.pktloss_threshold, _x.tos, _x.pktsize, _x.ros_returnpath, _x.roundtrip, _x.max_return_time))
214 _x = self.rostopic_prefix
215 length = len(_x)
216 if python3 or type(_x) == unicode:
217 _x = _x.encode('utf-8')
218 length = len(_x)
219 buff.write(struct.pack('<I%ss'%length, length, _x))
220 _x = self.sink_ip
221 length = len(_x)
222 if python3 or type(_x) == unicode:
223 _x = _x.encode('utf-8')
224 length = len(_x)
225 buff.write(struct.pack('<I%ss'%length, length, _x))
226 buff.write(_struct_i.pack(self.sink_port))
227 length = len(self.latencybins)
228 buff.write(_struct_I.pack(length))
229 pattern = '<%sf'%length
230 buff.write(self.latencybins.tostring())
231 except struct.error as se: self._check_types(se)
232 except TypeError as te: self._check_types(te)
233
235 """
236 unpack serialized message in str into this message instance using numpy for array types
237 :param str: byte array of serialized message, ``str``
238 :param numpy: numpy python module
239 """
240 try:
241 end = 0
242 _x = self
243 start = end
244 end += 32
245 (_x.duration, _x.update_interval, _x.bw, _x.bw_type, _x.latency_threshold, _x.pktloss_threshold, _x.tos, _x.pktsize, _x.ros_returnpath, _x.roundtrip, _x.max_return_time,) = _struct_3fB2fBi2Bf.unpack(str[start:end])
246 self.ros_returnpath = bool(self.ros_returnpath)
247 self.roundtrip = bool(self.roundtrip)
248 start = end
249 end += 4
250 (length,) = _struct_I.unpack(str[start:end])
251 start = end
252 end += length
253 if python3:
254 self.rostopic_prefix = str[start:end].decode('utf-8')
255 else:
256 self.rostopic_prefix = str[start:end]
257 start = end
258 end += 4
259 (length,) = _struct_I.unpack(str[start:end])
260 start = end
261 end += length
262 if python3:
263 self.sink_ip = str[start:end].decode('utf-8')
264 else:
265 self.sink_ip = str[start:end]
266 start = end
267 end += 4
268 (self.sink_port,) = _struct_i.unpack(str[start:end])
269 start = end
270 end += 4
271 (length,) = _struct_I.unpack(str[start:end])
272 pattern = '<%sf'%length
273 start = end
274 end += struct.calcsize(pattern)
275 self.latencybins = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
276 return self
277 except struct.error as e:
278 raise genpy.DeserializationError(e)
279
280 _struct_I = genpy.struct_I
281 _struct_3fB2fBi2Bf = struct.Struct("<3fB2fBi2Bf")
282 _struct_i = struct.Struct("<i")
283