Skip to content

Commit 5a79f9e

Browse files
committed
fix: add firmware fallback for plain script payload command
1 parent 2cfc96c commit 5a79f9e

1 file changed

Lines changed: 18 additions & 5 deletions

File tree

src/ur/ur_driver.cpp

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -324,13 +324,26 @@ bool UrDriver::setTargetPayload(const float mass, const vector3d_t& cog, const v
324324
{
325325
URCL_LOG_WARN("Script command interface is not running. Falling back to sending plain script code. On e-Series "
326326
"robots this will only work, if the robot is in remote_control mode.");
327+
327328
std::stringstream cmd;
328329
cmd.imbue(std::locale::classic()); // Make sure, decimal divider is actually '.'
329-
cmd << "sec setup():" << std::endl
330-
<< " set_target_payload(" << mass << ", [" << cog[0] << ", " << cog[1] << ", " << cog[2] << "] , ["
331-
<< inertia[0] << ", " << inertia[1] << ", " << inertia[2] << ", " << inertia[3] << ", " << inertia[4] << ", "
332-
<< inertia[5] << "] , " << transition_time << ")" << std::endl
333-
<< "end";
330+
331+
if ((getVersion().major > 5) || (getVersion().major == 5 && getVersion().minor >= 10))
332+
{
333+
cmd << "sec setup():" << std::endl
334+
<< " set_target_payload(" << mass << ", [" << cog[0] << ", " << cog[1] << ", " << cog[2] << "] , ["
335+
<< inertia[0] << ", " << inertia[1] << ", " << inertia[2] << ", " << inertia[3] << ", " << inertia[4] << ", "
336+
<< inertia[5] << "] , " << transition_time << ")" << std::endl
337+
<< "end";
338+
}
339+
else
340+
{
341+
cmd << "sec setup():" << std::endl
342+
<< " set_payload(" << mass << ", [" << cog[0] << ", " << cog[1] << ", " << cog[2] << "])" << std::endl
343+
<< " textmsg(\"PolyScope < 5.10.0. Inertia and transition_time ignored.\")" << std::endl
344+
<< "end";
345+
}
346+
334347
return sendScript(cmd.str());
335348
}
336349
}

0 commit comments

Comments
 (0)