Skip to content

Commit 55c1ca4

Browse files
committed
Refactor script code
1 parent fadbd9a commit 55c1ca4

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

resources/external_control.urscript

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -678,23 +678,25 @@ thread trajectoryThread():
678678
if raw_point[INDEX_POINT_TYPE] == MOTION_TYPE_OPTIMOVEJ:
679679
optimovej(q, a = acceleration, v = velocity, r = blend_radius)
680680
else:
681+
target_pose = p[q[0], q[1], q[2], q[3], q[4], q[5]]
681682
if has_qnear:
682-
target_q = get_inverse_kin(p[q[0], q[1], q[2], q[3], q[4], q[5]], second_block)
683+
local target_q = get_inverse_kin(target_pose, second_block)
684+
optimovej(target_q, a = acceleration, v = velocity, r = blend_radius)
683685
else:
684-
target_q = get_inverse_kin(p[q[0], q[1], q[2], q[3], q[4], q[5]], get_target_joint_positions())
686+
optimovej(target_pose, a = acceleration, v = velocity, r = blend_radius)
685687
end
686-
optimovej(target_q, a = acceleration, v = velocity, r = blend_radius)
687688
end
688689
{% elif ROBOT_SOFTWARE_VERSION >= v10.8.0 %}
689690
if raw_point[INDEX_POINT_TYPE] == MOTION_TYPE_OPTIMOVEJ:
690691
optimovej(q, a = acceleration, v = velocity, r = blend_radius)
691692
else:
693+
target_pose = p[q[0], q[1], q[2], q[3], q[4], q[5]]
692694
if has_qnear:
693-
target_q = get_inverse_kin(p[q[0], q[1], q[2], q[3], q[4], q[5]], second_block)
695+
local target_q = get_inverse_kin(target_pose, second_block)
696+
optimovej(target_q, a = acceleration, v = velocity, r = blend_radius)
694697
else:
695-
target_q = get_inverse_kin(p[q[0], q[1], q[2], q[3], q[4], q[5]], get_target_joint_positions())
698+
optimovej(target_pose, a = acceleration, v = velocity, r = blend_radius)
696699
end
697-
optimovej(target_q, a = acceleration, v = velocity, r = blend_radius)
698700
end
699701
{% else %}
700702
popup("Optimovej is only supported from software 10.8.0 and upwards.", error=True, blocking=False)

0 commit comments

Comments
 (0)