Okay, working offline for now because I don't have a Robot Studio license, and my CRB-1100 won't be delivered until roughly Halloween. I have the basic flow of everything down, modules organized, and most (non-IO) data declared.
Started playing around with my homing routine this morning, and writing it from scratch just for practice, since it's been a couple years since I did this. Anyway... I came up with a different approach than I would normally use, and I want to know if this method would actually be useful in any scenario.
So tell me... cool idea? Stupid idea? Would you use it, and if so, where?
EDIT: Since I'm offline with no license, I may have some poor syntax and/or arguments. Please feel free to point them out haha!
VAR robtarget CPos;
VAR jointtarget CJoint;
VAR bool NearFunnel;
VAR bool NearRegrip;
VAR bool NearSingularity;
CPos:=CRobT(\Tool:=tool0\WObj:=wobj0);
CJoint:=CJointT();
NearFunnel:=CPos.trans.z<100 AND cpos.trans.x>100;
NearRegrip:=CPos.trans.x=50 AND CPos.trans.y=50;
NearSingularity:=abs(CJoint.robax.rax_5)<5;
IF NearFunnel THEN
!Do this thing
ELSEIF NearRegrip THEN
!Do that thing
ELSEIF NearSingularity THEN
!Do the other thing
ENDIF
Display More
What led me to this was trying to clean up the IF-THEN portion to make it more legible. I thought if I could set up some boolean values for each condition, then I wouldn't have to have so much in each IF STATEMENT. I think it's clean and very readable, if not very efficient. And I don't think this is the right use case for it either. But I'm open to ideas or criticism for later reference!