Skip to content

Commit 3a6d34e

Browse files
urrskurfeex
authored andcommitted
Enable force mode compatibility with various move types
The joint positions used for checks and interpolations needs to be without force mode modifies.
1 parent cf30c14 commit 3a6d34e

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

resources/external_control.urscript

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ JOINT_IGNORE_SPEED = 20.0
6868
global violation_popup_counter = 0
6969
global cmd_servo_state = SERVO_UNINITIALIZED
7070
global cmd_servo_qd = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
71-
global cmd_servo_q = get_actual_joint_positions()
72-
global cmd_servo_q_last = get_actual_joint_positions()
71+
global cmd_servo_q = get_joint_positions()
72+
global cmd_servo_q_last = cmd_servo_q
7373
global cmd_twist = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7474
global extrapolate_count = 0
7575
global extrapolate_max_count = 0
@@ -158,7 +158,7 @@ end
158158
thread servoThread():
159159
textmsg("ExternalControl: Starting servo thread")
160160
state = SERVO_IDLE
161-
local q_last = get_target_joint_positions()
161+
local q_last = get_joint_positions()
162162
while control_mode == MODE_SERVOJ:
163163
enter_critical
164164
q = cmd_servo_q
@@ -221,13 +221,13 @@ def cubicSplineRun(end_q, end_qd, time, is_last_point=False, is_first_point=Fals
221221
local str = str_cat(end_q, str_cat(end_qd, time))
222222
textmsg("Cubic spline arg: ", str)
223223

224-
local start_q = get_target_joint_positions()
224+
local start_q = get_joint_positions()
225225
# Zero time means infinite velocity to reach the target and is therefore impossible
226226
if time <= 0.0:
227227
if is_first_point and time == 0.0:
228228
# If users specify the current joint position with time 0 that may be fine, in that case just
229229
# ignore that point
230-
local distance = norm(end_q - get_target_joint_positions())
230+
local distance = norm(end_q - start_q)
231231
if distance < 0.01:
232232
local splineTimerTraveled = 0.0
233233
# USED_IN_TEST_SPLINE_INTERPOLATION write_output_float_register(1, splineTimerTraveled)
@@ -263,13 +263,13 @@ def quinticSplineRun(end_q, end_qd, end_qdd, time, is_last_point=False, is_first
263263
local str = str_cat(end_q, str_cat(end_qd, str_cat(end_qdd, time)))
264264
textmsg("Quintic spline arg: ", str)
265265

266-
local start_q = get_target_joint_positions()
266+
local start_q = get_joint_positions()
267267
# Zero time means infinite velocity to reach the target and is therefore impossible
268268
if time <= 0.0:
269269
if is_first_point and time == 0.0:
270270
# If users specify the current joint position with time 0 that may be fine, in that case just
271271
# ignore that point
272-
local distance = norm(end_q - get_target_joint_positions())
272+
local distance = norm(end_q - start_q)
273273
if distance < 0.01:
274274
return False
275275
end
@@ -553,7 +553,7 @@ end
553553
thread servoThreadP():
554554
textmsg("Starting pose servo thread")
555555
state = SERVO_IDLE
556-
local q_last = get_target_joint_positions()
556+
local q_last = get_joint_positions()
557557
while control_mode == MODE_POSE:
558558
enter_critical
559559
q = cmd_servo_q

0 commit comments

Comments
 (0)