1 from __future__
import print_function
10 (plen, ptype) = struct.unpack_from(
"!IB", buf)
12 return RobotStateRT_V15.unpack(buf)
14 return RobotStateRT_V18.unpack(buf)
16 return RobotStateRT_V30.unpack(buf)
18 print(
"RobotStateRT has wrong length: " + str(plen))
25 'q_target',
'qd_target',
'qdd_target',
'i_target',
'm_target',
26 'q_actual',
'qd_actual',
'i_actual',
'tool_acc_values',
28 'tcp_force',
'tool_vector',
'tcp_speed',
29 'digital_input_bits',
'motor_temperatures',
'controller_timer',
35 message_size = struct.unpack_from(
"!i", buf, offset)[0]
37 if message_size != len(buf):
38 print((
"MessageSize: ", message_size,
"; BufferSize: ", len(buf)))
39 raise Exception(
"Could not unpack RobotStateRT packet: length field is incorrect")
43 rs.time = struct.unpack_from(
"!d",buf, offset)[0]
47 all_values = list(struct.unpack_from(
"!dddddd",buf, offset))
49 rs.q_target = copy.deepcopy(all_values)
52 all_values = list(struct.unpack_from(
"!dddddd",buf, offset))
54 rs.qd_target = copy.deepcopy(all_values)
57 all_values = list(struct.unpack_from(
"!dddddd",buf, offset))
59 rs.qdd_target = copy.deepcopy(all_values)
62 all_values = list(struct.unpack_from(
"!dddddd",buf, offset))
64 rs.i_target = copy.deepcopy(all_values)
67 all_values = list(struct.unpack_from(
"!dddddd",buf, offset))
69 rs.m_target = copy.deepcopy(all_values)
72 all_values = list(struct.unpack_from(
"!dddddd",buf, offset))
74 rs.q_actual = copy.deepcopy(all_values)
77 all_values = list(struct.unpack_from(
"!dddddd",buf, offset))
79 rs.qd_actual = copy.deepcopy(all_values)
82 all_values = list(struct.unpack_from(
"!dddddd",buf, offset))
84 rs.i_actual = copy.deepcopy(all_values)
89 all_values = list(struct.unpack_from(
"!ddd",buf, offset))
91 rs.tool_acc_values = copy.deepcopy(all_values)
98 all_values = list(struct.unpack_from(
"!dddddd",buf, offset))
100 rs.tcp_force = copy.deepcopy(all_values)
103 all_values = list(struct.unpack_from(
"!dddddd",buf, offset))
105 rs.tool_vector = copy.deepcopy(all_values)
108 all_values = list(struct.unpack_from(
"!dddddd",buf, offset))
110 rs.tcp_speed = copy.deepcopy(all_values)
113 rs.digital_input_bits = struct.unpack_from(
"!d",buf, offset)[0]
117 all_values = list(struct.unpack_from(
"!dddddd",buf, offset))
119 rs.motor_temperatures = copy.deepcopy(all_values)
122 rs.controller_timer = struct.unpack_from(
"!d",buf, offset)[0]
126 rs.test_value = struct.unpack_from(
"!d",buf, offset)[0]
135 'q_target',
'qd_target',
'qdd_target',
'i_target',
'm_target',
136 'q_actual',
'qd_actual',
'i_actual',
'tool_acc_values',
138 'tcp_force',
'tool_vector',
'tcp_speed',
139 'digital_input_bits',
'motor_temperatures',
'controller_timer',
141 'robot_mode',
'joint_modes']
146 message_size = struct.unpack_from(
"!i", buf, offset)[0]
148 if message_size != len(buf):
149 print((
"MessageSize: ", message_size,
"; BufferSize: ", len(buf)))
150 raise Exception(
"Could not unpack RobotStateRT packet: length field is incorrect")
154 rs.time = struct.unpack_from(
"!d",buf, offset)[0]
158 all_values = list(struct.unpack_from(
"!dddddd",buf, offset))
160 rs.q_target = copy.deepcopy(all_values)
163 all_values = list(struct.unpack_from(
"!dddddd",buf, offset))
165 rs.qd_target = copy.deepcopy(all_values)
168 all_values = list(struct.unpack_from(
"!dddddd",buf, offset))
170 rs.qdd_target = copy.deepcopy(all_values)
173 all_values = list(struct.unpack_from(
"!dddddd",buf, offset))
175 rs.i_target = copy.deepcopy(all_values)
178 all_values = list(struct.unpack_from(
"!dddddd",buf, offset))
180 rs.m_target = copy.deepcopy(all_values)
183 all_values = list(struct.unpack_from(
"!dddddd",buf, offset))
185 rs.q_actual = copy.deepcopy(all_values)
188 all_values = list(struct.unpack_from(
"!dddddd",buf, offset))
190 rs.qd_actual = copy.deepcopy(all_values)
193 all_values = list(struct.unpack_from(
"!dddddd",buf, offset))
195 rs.i_actual = copy.deepcopy(all_values)
198 all_values = list(struct.unpack_from(
"!ddd",buf, offset))
200 rs.tool_acc_values = copy.deepcopy(all_values)
207 all_values = list(struct.unpack_from(
"!dddddd",buf, offset))
209 rs.tcp_force = copy.deepcopy(all_values)
212 all_values = list(struct.unpack_from(
"!dddddd",buf, offset))
214 rs.tool_vector = copy.deepcopy(all_values)
217 all_values = list(struct.unpack_from(
"!dddddd",buf, offset))
219 rs.tcp_speed = copy.deepcopy(all_values)
222 rs.digital_input_bits = struct.unpack_from(
"!d",buf, offset)[0]
226 all_values = list(struct.unpack_from(
"!dddddd",buf, offset))
228 rs.motor_temperatures = copy.deepcopy(all_values)
231 rs.controller_timer = struct.unpack_from(
"!d",buf, offset)[0]
235 rs.test_value = struct.unpack_from(
"!d",buf, offset)[0]
239 rs.robot_mode = struct.unpack_from(
"!d",buf, offset)[0]
243 all_values = list(struct.unpack_from(
"!dddddd",buf, offset))
245 rs.joint_modes = copy.deepcopy(all_values)
252 'q_target',
'qd_target',
'qdd_target',
'i_target',
'm_target',
253 'q_actual',
'qd_actual',
'i_actual',
'i_control',
254 'tool_vector_actual',
'tcp_speed_actual',
'tcp_force',
255 'tool_vector_target',
'tcp_speed_target',
256 'digital_input_bits',
'motor_temperatures',
'controller_timer',
258 'robot_mode',
'joint_modes',
'safety_mode',
262 'speed_scaling',
'linear_momentum_norm',
264 'v_main',
'v_robot',
'i_robot',
'v_actual']
269 message_size = struct.unpack_from(
"!i", buf, offset)[0]
271 if message_size != len(buf):
272 print((
"MessageSize: ", message_size,
"; BufferSize: ", len(buf)))
273 raise Exception(
"Could not unpack RobotStateRT packet: length field is incorrect")
277 rs.time = struct.unpack_from(
"!d",buf, offset)[0]
281 all_values = list(struct.unpack_from(
"!dddddd",buf, offset))
283 rs.q_target = copy.deepcopy(all_values)
286 all_values = list(struct.unpack_from(
"!dddddd",buf, offset))
288 rs.qd_target = copy.deepcopy(all_values)
291 all_values = list(struct.unpack_from(
"!dddddd",buf, offset))
293 rs.qdd_target = copy.deepcopy(all_values)
296 all_values = list(struct.unpack_from(
"!dddddd",buf, offset))
298 rs.i_target = copy.deepcopy(all_values)
301 all_values = list(struct.unpack_from(
"!dddddd",buf, offset))
303 rs.m_target = copy.deepcopy(all_values)
306 all_values = list(struct.unpack_from(
"!dddddd",buf, offset))
308 rs.q_actual = copy.deepcopy(all_values)
311 all_values = list(struct.unpack_from(
"!dddddd",buf, offset))
313 rs.qd_actual = copy.deepcopy(all_values)
316 all_values = list(struct.unpack_from(
"!dddddd",buf, offset))
318 rs.i_actual = copy.deepcopy(all_values)
321 all_values = list(struct.unpack_from(
"!dddddd",buf, offset))
323 rs.i_control = copy.deepcopy(all_values)
326 all_values = list(struct.unpack_from(
"!dddddd",buf, offset))
328 rs.tool_vector_actual = copy.deepcopy(all_values)
331 all_values = list(struct.unpack_from(
"!dddddd",buf, offset))
333 rs.tcp_speed_actual = copy.deepcopy(all_values)
336 all_values = list(struct.unpack_from(
"!dddddd",buf, offset))
338 rs.tcp_force = copy.deepcopy(all_values)
341 all_values = list(struct.unpack_from(
"!dddddd",buf, offset))
343 rs.tool_vector_target = copy.deepcopy(all_values)
346 all_values = list(struct.unpack_from(
"!dddddd",buf, offset))
348 rs.tcp_speed_target = copy.deepcopy(all_values)
351 rs.digital_input_bits = struct.unpack_from(
"!d",buf, offset)[0]
355 all_values = list(struct.unpack_from(
"!dddddd",buf, offset))
357 rs.motor_temperatures = copy.deepcopy(all_values)
360 rs.controller_timer = struct.unpack_from(
"!d",buf, offset)[0]
364 rs.test_value = struct.unpack_from(
"!d",buf, offset)[0]
368 rs.robot_mode = struct.unpack_from(
"!d",buf, offset)[0]
372 all_values = list(struct.unpack_from(
"!dddddd",buf, offset))
374 rs.joint_modes = copy.deepcopy(all_values)
377 rs.safety_mode = struct.unpack_from(
"!d",buf, offset)[0]
384 all_values = list(struct.unpack_from(
"!ddd",buf, offset))
386 rs.tool_acc_values = copy.deepcopy(all_values)
392 rs.speed_scaling = struct.unpack_from(
"!d",buf, offset)[0]
396 rs.linear_momentum_norm = struct.unpack_from(
"!d",buf, offset)[0]
403 rs.v_main = struct.unpack_from(
"!d",buf, offset)[0]
407 rs.v_robot = struct.unpack_from(
"!d",buf, offset)[0]
411 rs.i_robot = struct.unpack_from(
"!d",buf, offset)[0]
415 all_values = list(struct.unpack_from(
"!dddddd",buf, offset))
417 rs.v_actual = copy.deepcopy(all_values)