@@ -565,36 +565,42 @@ thread trajectoryThread():
565565 blend_radius = 0.0
566566 is_last_point = True
567567 end
568+
569+ second_block = [raw_point[7], raw_point[8], raw_point[9], raw_point[10], raw_point[11], raw_point[12]] / MULT_jointstate
570+ velocity = raw_point[13] / MULT_jointstate
571+ acceleration = raw_point[14] / MULT_jointstate
572+ has_qnear = raw_point[15] / MULT_jointstate
573+
568574 # MoveJ point
569575 if raw_point[INDEX_POINT_TYPE] == MOTION_TYPE_MOVEJ:
570- acceleration = raw_point[13] / MULT_jointstate
571- velocity = raw_point[7] / MULT_jointstate
576+ textmsg("Moving to joint position: ", q)
572577 movej(q, a = acceleration, v = velocity, t = tmptime, r = blend_radius)
573578
574579 # reset old acceleration
575580 spline_qdd = [0, 0, 0, 0, 0, 0]
576581 spline_qd = [0, 0, 0, 0, 0, 0]
577582 elif raw_point[INDEX_POINT_TYPE] == MOTION_TYPE_MOVEJ_POSE:
578- acceleration = raw_point[13] / MULT_jointstate
579- velocity = raw_point[7] / MULT_jointstate
580- movej(p[q[0], q[1], q[2], q[3], q[4], q[5]], a = acceleration, v = velocity, t = tmptime, r = blend_radius)
583+ target_pose = p[q[0], q[1], q[2], q[3], q[4], q[5]]
584+ textmsg("Moving to pose: ", target_pose)
585+ target_q = get_inverse_kin(target_pose, get_target_joint_positions())
586+ if has_qnear:
587+ target_q = get_inverse_kin(target_pose, second_block)
588+ end
589+ movej(target_q, a = acceleration, v = velocity, t = tmptime, r = blend_radius)
590+
581591
582592 # reset old acceleration
583593 spline_qdd = [0, 0, 0, 0, 0, 0]
584594 spline_qd = [0, 0, 0, 0, 0, 0]
585595
586596 # Movel point
587597 elif raw_point[INDEX_POINT_TYPE] == MOTION_TYPE_MOVEL:
588- acceleration = raw_point[13] / MULT_jointstate
589- velocity = raw_point[7] / MULT_jointstate
590598 movel(p[q[0], q[1], q[2], q[3], q[4], q[5]], a = acceleration, v = velocity, t = tmptime, r = blend_radius)
591599
592600 # reset old acceleration
593601 spline_qdd = [0, 0, 0, 0, 0, 0]
594602 spline_qd = [0, 0, 0, 0, 0, 0]
595603 elif raw_point[INDEX_POINT_TYPE] == MOTION_TYPE_MOVEL_JOINT:
596- acceleration = raw_point[13] / MULT_jointstate
597- velocity = raw_point[7] / MULT_jointstate
598604 movel(q, a = acceleration, v = velocity, t = tmptime, r = blend_radius)
599605
600606 # reset old acceleration
@@ -603,16 +609,12 @@ thread trajectoryThread():
603609
604610 # MoveP point
605611 elif raw_point[INDEX_POINT_TYPE] == MOTION_TYPE_MOVEP:
606- acceleration = raw_point[13] / MULT_jointstate
607- velocity = raw_point[7] / MULT_jointstate
608612 movep(p[q[0], q[1], q[2], q[3], q[4], q[5]], a = acceleration, v = velocity, r = blend_radius)
609613
610614 # reset old acceleration
611615 spline_qdd = [0, 0, 0, 0, 0, 0]
612616 spline_qd = [0, 0, 0, 0, 0, 0]
613617 elif raw_point[INDEX_POINT_TYPE] == MOTION_TYPE_MOVEP_JOINT:
614- acceleration = raw_point[13] / MULT_jointstate
615- velocity = raw_point[7] / MULT_jointstate
616618 movep(q, a = acceleration, v = velocity, r = blend_radius)
617619
618620 # reset old acceleration
@@ -623,7 +625,7 @@ thread trajectoryThread():
623625 raw_point[INDEX_POINT_TYPE] == MOTION_TYPE_MOVEC_JOINT or
624626 raw_point[INDEX_POINT_TYPE] == MOTION_TYPE_MOVEC_POSE_JOINT or
625627 raw_point[INDEX_POINT_TYPE] == MOTION_TYPE_MOVEC_JOINT_POSE:
626- local v = [raw_point[7], raw_point[8], raw_point[9], raw_point[10], raw_point[11], raw_point[12]] / MULT_jointstate
628+ local v = second_block
627629 if raw_point[INDEX_POINT_TYPE] == MOTION_TYPE_MOVEC:
628630 via = p[v[0], v[1], v[2], v[3], v[4], v[5]]
629631 target = p[q[0], q[1], q[2], q[3], q[4], q[5]]
@@ -638,8 +640,6 @@ thread trajectoryThread():
638640 target = q
639641 end
640642
641- velocity = raw_point[13] / MULT_jointstate
642- acceleration = raw_point[14] / MULT_jointstate
643643 mode = raw_point[15] / MULT_jointstate
644644 movec(via, target, acceleration, velocity, blend_radius, mode)
645645
@@ -673,20 +673,28 @@ thread trajectoryThread():
673673
674674 # OptimoveJ point
675675 elif raw_point[INDEX_POINT_TYPE] == MOTION_TYPE_OPTIMOVEJ or raw_point[INDEX_POINT_TYPE] == MOTION_TYPE_OPTIMOVEJ_POSE:
676- acceleration = raw_point[13] / MULT_jointstate
677- velocity = raw_point[7] / MULT_jointstate
678676 {% if ROBOT_SOFTWARE_VERSION >= v5.21.0 %}
679677 {% if ROBOT_SOFTWARE_VERSION < v6.0.0 %}
680678 if raw_point[INDEX_POINT_TYPE] == MOTION_TYPE_OPTIMOVEJ:
681679 optimovej(q, a = acceleration, v = velocity, r = blend_radius)
682680 else:
683- optimovej(p[q[0], q[1], q[2], q[3], q[4], q[5]], a = acceleration, v = velocity, r = blend_radius)
681+ 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+ else:
684+ target_q = get_inverse_kin(p[q[0], q[1], q[2], q[3], q[4], q[5]], get_target_joint_positions())
685+ end
686+ optimovej(target_q, a = acceleration, v = velocity, r = blend_radius)
684687 end
685688 {% elif ROBOT_SOFTWARE_VERSION >= v10.8.0 %}
686689 if raw_point[INDEX_POINT_TYPE] == MOTION_TYPE_OPTIMOVEJ:
687690 optimovej(q, a = acceleration, v = velocity, r = blend_radius)
688691 else:
689- optimovej(p[q[0], q[1], q[2], q[3], q[4], q[5]], a = acceleration, v = velocity, r = blend_radius)
692+ if has_qnear:
693+ target_q = get_inverse_kin(p[q[0], q[1], q[2], q[3], q[4], q[5]], second_block)
694+ else:
695+ target_q = get_inverse_kin(p[q[0], q[1], q[2], q[3], q[4], q[5]], get_target_joint_positions())
696+ end
697+ optimovej(target_q, a = acceleration, v = velocity, r = blend_radius)
690698 end
691699 {% else %}
692700 popup("Optimovej is only supported from software 10.8.0 and upwards.", error=True, blocking=False)
@@ -709,8 +717,6 @@ thread trajectoryThread():
709717
710718 # OptimoveL point
711719 elif raw_point[INDEX_POINT_TYPE] == MOTION_TYPE_OPTIMOVEL or raw_point[INDEX_POINT_TYPE] == MOTION_TYPE_OPTIMOVEL_JOINT:
712- acceleration = raw_point[13] / MULT_jointstate
713- velocity = raw_point[7] / MULT_jointstate
714720
715721 {% if ROBOT_SOFTWARE_VERSION >= v5.21.0 %}
716722 {% if ROBOT_SOFTWARE_VERSION < v6.0.0 %}
0 commit comments