i am currently struggling with a safety mod i am trying to insert in a robot program. Before the program starts, it should do a Loop where it checks if the robot is at a specific position.
The loop is very simple as i am just trying to compare 2 variables, e.g.
(simplified)
Loop
If get_actual_tcp_pos() =/= specified Pos
-> Message: Move robot manually
Else … go on with program
But it is impossible to compare these variables because they will never be same (speaking of the never meeting decimal spaces).
IS there an option to round the position or pose (like 0.23675 = 0.2) so that the robot doesnt have to be in the exact position, but just near the value? (floor() didnt work out really…)
There isn’t anything I can think of, you could try multiplying by 10 or 100 then using floor. It would require a bit more logic on your end but you wouldn’t lose the digits by just using floor.
I have ran into this in the past and did just that, multiplied, floor(), then divided to continue using the value for other logic in my program. It may not be the best solution but right now it’s all that comes to mind.
Hello @robin.schurr
I’ve had a similar problem in the past. What if instead you check if the robot is within a small distance from “specified Pos” using pose_dist(get_actual_tcp_pos(),specified Pos)? Does that work for your application?
p = get_actual_joint_positions()
if (
(p[0] < d2r(182) and p[0] > d2r(178)) and
(p[1] < d2r(-88) and p[1] > d2r(-92)) and
(p[2] < d2r(-88) and p[2] > d2r(-92)) and
(p[3] < d2r(2) and p[3] > d2r(-2)) and
(p[4] < d2r(92) and p[4] > d2r(88)) and
(p[5] < d2r(2) and p[5] > d2r(-2))
):
popup(“Robot is in correct position:.”)
else:
popup(“Robot is NOT in correct position.”)
Do keep in mind that a safety feature in the task program is NOT considered safety rated per ISO 10218-1: 2011, section 5.4.2 which basically states:
Safety-related parts of control systems shall be designed so they comply with PL=d with structure category 3. That means you need dual redundancy with monitoring.
Of course, you can still include it, but it would be considered an extra.