Skip to content

Commit d37f211

Browse files
committed
Add torque_command statement only on supported software versions
1 parent 5b55989 commit d37f211

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

resources/external_control.urscript

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,17 @@ thread torqueThread():
270270
textmsg("ExternalControl: Starting torque thread")
271271
while control_mode == MODE_TORQUE:
272272
torque = cmd_torque
273+
{% if ROBOT_SOFTWARE_VERSION >= v5.23.0 %}
274+
{% if ROBOT_SOFTWARE_VERSION < v6.0.0 %}
273275
torque_command(torque, friction_comp=friction_compensation_enabled)
276+
{% elif ROBOT_SOFTWARE_VERSION >= v10.10.0 %}
277+
torque_command(torque, friction_comp=friction_compensation_enabled)
278+
{% else %}
279+
popup("Torque control is only supported from software 10.10.0 and upwards.", error=True, blocking=True)
280+
{% endif %}
281+
{% else %}
282+
popup("Torque control is only supported from software 5.23.0 and upwards.", error=True, blocking=True)
283+
{% endif %}
274284
end
275285
textmsg("ExternalControl: torque thread ended")
276286
stopj(STOPJ_ACCELERATION)
@@ -680,7 +690,17 @@ thread PDControlThread():
680690
local q_err = cmd_servo_q - get_actual_joint_positions()
681691
local tau = pd_controller_gains.kp * q_err - pd_controller_gains.kd * get_actual_joint_speeds()
682692
tau = clamp_array(tau, max_joint_torques)
693+
{% if ROBOT_SOFTWARE_VERSION >= v5.23.0 %}
694+
{% if ROBOT_SOFTWARE_VERSION < v6.0.0 %}
695+
torque_command(tau, friction_comp=friction_compensation_enabled)
696+
{% elif ROBOT_SOFTWARE_VERSION >= v10.10.0 %}
683697
torque_command(tau, friction_comp=friction_compensation_enabled)
698+
{% else %}
699+
popup("Torque control is only supported from software 10.10.0 and upwards.", error=True, blocking=True)
700+
{% endif %}
701+
{% else %}
702+
popup("Torque control is only supported from software 5.23.0 and upwards.", error=True, blocking=True)
703+
{% endif %}
684704
end
685705
textmsg("PD Control thread ended")
686706
stopj(STOPJ_ACCELERATION)

src/ur/ur_driver.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@ void UrDriver::init(const UrDriverConfiguration& config)
154154
max_torques_ss << control::getMaxTorquesFromRobotType(robot_type);
155155
data[MAX_JOINT_TORQUE_REPLACE] = max_torques_ss.str();
156156

157+
data["ROBOT_SOFTWARE_VERSION"] = getVersion();
158+
157159
script_reader_.reset(new control::ScriptReader());
158160
std::string prog = script_reader_->readScriptFile(config.script_file, data);
159161

0 commit comments

Comments
 (0)