Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion resources/external_control.urscript
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ SERVO_UNINITIALIZED = -1
SERVO_IDLE = 0
SERVO_RUNNING = 1

MODE_STOPPED = -2
MODE_STOPPED = -3
MODE_PAUSED = -2
MODE_UNINITIALIZED = -1
MODE_IDLE = 0
MODE_SERVOJ = 1
Expand Down Expand Up @@ -73,6 +74,7 @@ global cmd_servo_q_last = get_actual_joint_positions()
global cmd_twist = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
global extrapolate_count = 0
global extrapolate_max_count = 0
global max_consecutive_extrapolate_count = 50
global control_mode = MODE_UNINITIALIZED
global trajectory_points_left = 0
global spline_qdd = [0, 0, 0, 0, 0, 0]
Expand Down Expand Up @@ -570,6 +572,12 @@ thread servoThreadP():
if extrapolate_count > extrapolate_max_count:
extrapolate_max_count = extrapolate_count
end

if extrapolate_count > max_consecutive_extrapolate_count:
textmsg("Exceeded max consecutive extrapolation count, stopping the arm")
stopj(STOPJ_ACCELERATION)
control_mode = MODE_PAUSED
end

q = extrapolate()
if targetWithinLimits(q_last, q, steptime):
Expand Down