@@ -8,6 +8,8 @@ textmsg("ExternalControl: steptime=", steptime)
88MULT_jointstate = {{JOINT_STATE_REPLACE}}
99MULT_time = {{TIME_REPLACE}}
1010
11+ DEBUG = False
12+
1113STOPJ_ACCELERATION = 4.0
1214
1315#Constants
@@ -35,6 +37,8 @@ MOTION_TYPE_MOVEJ = 0
3537MOTION_TYPE_MOVEL = 1
3638MOTION_TYPE_MOVEP = 2
3739MOTION_TYPE_MOVEC = 3
40+ MOTION_TYPE_OPTIMOVEJ = 4
41+ MOTION_TYPE_OPTIMOVEL = 5
3842MOTION_TYPE_SPLINE = 51
3943TRAJECTORY_DATA_DIMENSION = 3 * 6 + 1
4044
@@ -551,6 +555,63 @@ thread trajectoryThread():
551555 clear_remaining_trajectory_points()
552556 trajectory_result = TRAJECTORY_RESULT_FAILURE
553557 end
558+
559+ # OptimoveJ point
560+ elif raw_point[INDEX_POINT_TYPE] == MOTION_TYPE_OPTIMOVEJ:
561+ acceleration = raw_point[13] / MULT_jointstate
562+ velocity = raw_point[7] / MULT_jointstate
563+ {% if ROBOT_SOFTWARE_VERSION >= v5.21.0 %}
564+ {% if ROBOT_SOFTWARE_VERSION < v6.0.0 %}
565+ optimovej(q, a = acceleration, v = velocity, r = blend_radius)
566+ {% elif ROBOT_SOFTWARE_VERSION >= v10.8.0 %}
567+ optimovej(q, a = acceleration, v = velocity, r = blend_radius)
568+ {% else %}
569+ popup("Optimovej is only supported from software 10.8.0 and upwards.", error=True, blocking=False)
570+ {% endif %}
571+ {% else %}
572+ popup("Optimovej is only supported from software 5.21.0 and upwards.", error=True, blocking=False)
573+ {% endif %}
574+
575+ if DEBUG:
576+ textmsg(str_cat("optimovej(", str_cat(
577+ str_cat("q=", q), str_cat(
578+ str_cat(", a=", acceleration), str_cat(
579+ str_cat(", v=", velocity), str_cat(
580+ str_cat(", r=", blend_radius), ")"))))))
581+ end
582+
583+ # reset old acceleration
584+ spline_qdd = [0, 0, 0, 0, 0, 0]
585+ spline_qd = [0, 0, 0, 0, 0, 0]
586+
587+ # OptimoveL point
588+ elif raw_point[INDEX_POINT_TYPE] == MOTION_TYPE_OPTIMOVEL:
589+ acceleration = raw_point[13] / MULT_jointstate
590+ velocity = raw_point[7] / MULT_jointstate
591+
592+ {% if ROBOT_SOFTWARE_VERSION >= v5.21.0 %}
593+ {% if ROBOT_SOFTWARE_VERSION < v6.0.0 %}
594+ optimovel(p[q[0], q[1], q[2], q[3], q[4], q[5]], a = acceleration, v = velocity, r = blend_radius)
595+ {% elif ROBOT_SOFTWARE_VERSION >= v10.8.0 %}
596+ optimovel(p[q[0], q[1], q[2], q[3], q[4], q[5]], a = acceleration, v = velocity, r = blend_radius)
597+ {% else %}
598+ popup("Optimovel is only supported from software 10.8.0 and upwards.", error=True, blocking=False)
599+ {% endif %}
600+ {% else %}
601+ popup("Optimovel is only supported from software 5.21.0 and upwards.", error=True, blocking=False)
602+ {% endif %}
603+
604+ if DEBUG:
605+ textmsg(str_cat("optimovel(", str_cat(
606+ str_cat("q=", p[q[0], q[1], q[2], q[3], q[4], q[5]]), str_cat(
607+ str_cat(", a=", acceleration), str_cat(
608+ str_cat(", v=", velocity), str_cat(
609+ str_cat(", r=", blend_radius), ")"))))))
610+ end
611+
612+ # reset old acceleration
613+ spline_qdd = [0, 0, 0, 0, 0, 0]
614+ spline_qd = [0, 0, 0, 0, 0, 0]
554615 end
555616 else:
556617 textmsg("Receiving trajectory point failed!")
@@ -815,4 +876,4 @@ socket_close("reverse_socket")
815876socket_close("trajectory_socket")
816877socket_close("script_command_socket")
817878
818- # NODE_CONTROL_LOOP_ENDS
879+ # NODE_CONTROL_LOOP_ENDS
0 commit comments