I have an R-30iB robot that is picking from a stack of parts on a rack. I move to the position of the last part I picked and then use a sensor to find the distance to the next part. I then add that distance to the current position and save it into a PR. My problem is with some racks, the very last part is just out of the robots reach. So the robot will just fault out. I would like to be able to test that PR before I move.
Right now my program is mostly all in TP. I would guess there is a Karel function that would address this, but I have limited experience with Karel. So I wouldn't even know where to look.
Thanks for any advice you can give!
Can I check if a position is valid?
-
Shaggy -
February 14, 2013 at 6:19 PM -
Thread is marked as Resolved.
-
-
No need for Karel here. You can perform this in TPe too. If you know the maximum distance you can reach then use that as a test.
As an example..
If your PR is #10, and your looking to see if a position is reachable in X.... which max is is 2000 in this example.IF PR[10,1]> 2000 , JMP LBL[800]
. then do
. something here because
.we are greater than 2000mm
. thats reachable
JMP LBL[999]
LBL[800]
. do alternate something
. to prevent
. fault.LBL[999]
ENDIf testing for Y then use PR[10,2] and for Z it would be PRO[10,3]
Hope this helps.
-Eric -
Thanks for the reply Eric.
We have tried doing something very similar, but there are other adjustments that are made when entering the rack. So the max distance could be 2000 for this rack but may only be 1975 for another rack because of a different base Y and Z.
-
If your racks are all the same for this certain part, then you already know the distance from the first part to the last one out of the rack. Take that total and use it to validate if your picking the last piece.
--Eric