Skip to content

Commit 3fa1b1c

Browse files
committed
Skip examples that require torque control on older PolyScope
1 parent c36655a commit 3fa1b1c

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

examples/pd_controller_example.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,17 @@ int main(int argc, char* argv[])
185185
return 1;
186186
}
187187

188+
{
189+
auto robot_version = g_my_robot->getUrDriver()->getVersion();
190+
if (robot_version < urcl::VersionInformation::fromString("5.23.0") ||
191+
(robot_version.major > 5 && robot_version < urcl::VersionInformation::fromString("10.10.0")))
192+
{
193+
URCL_LOG_ERROR("This example requires a robot with at least version 5.23.0 / 10.10.0. Your robot has version %s.",
194+
robot_version.toString().c_str());
195+
return 0;
196+
}
197+
}
198+
188199
auto instruction_executor = std::make_shared<urcl::InstructionExecutor>(g_my_robot->getUrDriver());
189200

190201
URCL_LOG_INFO("Move the robot to initial position");

examples/script_command_interface.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,13 @@ void sendScriptCommands()
7878
g_my_robot->getUrDriver()->setPDControllerGains({ 500.0, 500.0, 300.0, 124.0, 124.0, 124.0 },
7979
{ 44.72, 44.72, 34.64, 22.27, 22.27, 22.27 });
8080
});
81-
run_cmd("Setting max joint torques",
82-
[]() { g_my_robot->getUrDriver()->setMaxJointTorques({ 27.0, 27.0, 14.0, 4.5, 4.5, 4.5 }); });
81+
auto robot_version = g_my_robot->getUrDriver()->getVersion();
82+
if (robot_version > urcl::VersionInformation::fromString("10.10.0") ||
83+
(robot_version.major == 5 && robot_version.minor >= 23))
84+
{
85+
run_cmd("Setting max joint torques",
86+
[]() { g_my_robot->getUrDriver()->setMaxJointTorques({ 27.0, 27.0, 14.0, 4.5, 4.5, 4.5 }); });
87+
}
8388
}
8489
URCL_LOG_INFO("Script command thread finished.");
8590
}

0 commit comments

Comments
 (0)