# need help making an IF/THEN statement

• I'm looking for help in creating an IF/THEN statement that involves the current location of a real variable...

Currently what I use in a simple example:

1. "Move To Pounce Position"

2. Block Step (Go to above general pick position). This is generally a meter or so above actual pick position.

3. DECOMPOSE mp2[1] = master_pick2[1]

4. POINT final_pick2 = TRANS(mp2[1]+x2,mp2[2]+y2,mp2[3],mp2[4]+r2,mp2[5],mp2[6])

5. LAPPRO final_pick2, -100

6. LMOVE final_pick2

What I want to do is determine the current value of mp2[4] based off of the master_pick position and adjust the J6 axis if it's within a certain range. The purpose is to decide if the robot needs to go to is "above general pick position" or go straight to its LAPPRO position if J6 does not need to move at all or that much. I will have dozens of different pick positions stored in a pick program, so I'd like to have the flexibility to make the decision to skip the block move if it isn't necessary.

So in one form or another, this is what I'm trying to accomplish, I just don't know how to write it.

1. "Move To Pounce Position"

2. DECOMPOSE mp2[1] = master_pick2[1]

3. POINT final_pick2 = TRANS(mp2[1]+x2,mp2[2]+y2,mp2[3],mp2[4]+r2,mp2[5],mp2[6])

4. "IF mp2[4]+r2 is < 130.00 OR mp2[4]+r2 is > 190.000 THEN; GO TO GENERAL ABOVE PICK POSITION

5. Block Step (Go to above general pick position). This is generally a meter or so above actual pick position.

6. END

7. LAPPRO final_pick2, -100

8. LMOVE final_pick2

Simply put (I think), I want the robot to go straight to its LAPPRO move if the orientation of J6 does not change from its pounce position to the final pick position. If J6 needs to move in excess of a certain amount of degrees, I want the program to execute the block step.

Any suggestions?

Thanks!

• Seems a little confusing to me with what you have written without knowing the application a little better and asking a couple of questions.

- Can you describe it without compromising any IP and whether the Robot is floor/wall/ceiling mounted?

- Is your TCP correctly configured in the standard manner?

- What is the purpose of using a negative value for your approach height offset?

From what I can read, your final pick position is being calculated with an X,Y,O offset.

You could create a joint angle approach based on this value with a Z value applied for the approach.

Without totally understanding your application, below is just an example of what I think could be used or I may be misunderstanding slightly.

.app.hgt = 100

POINT final_pick2 = master_pick2[1]+TRANS(x2,y2,0,r2,0,0)

POINT #final_pick_app = final_pick2+TRANS(0,0,-app.hgt)

JMOVE #pounce

LMOVE #final_pick_app

LMOVE final_pick2

p.s the above is just an example, not necessarily a solution that maybe worth exploring - with caution.

• If i understand correctly ...

IF mp2[4]+r2 is < 130.00 OR mp2[4]+r2 is > 190.000 THEN

GO TO GENERAL ABOVE PICK POSITION

ELSE

LAPPRO final_pick2, -100

END

• Kwakisaki:

The way I have the programs set up at this time, everything working properly and with no issues. It currently goes to:

Pounce

General Position

LAPPRO "above final_pick"

LMOVE "final_pick"

Since "final_pick" can be different based off of which part I'm running (J6 could be anywhere between 0` and 180` give or take), my goal is to take a specific value of "final_pick" (mp2[4]+r2) and determine based off of that value if I need to utilize the "general position" or go straight to the LAPPRO.

Alexandru wrote out what I was thinking, I'd just have to test it to see if it was that simple.

Thanks for everyone's input!

• The way I have the programs set up at this time, everything working properly and with no issues.

Ah, ok............

(J6 could be anywhere between 0` and 180`

Are you referring to actual JT6 angle or the O element?

• The O element. Visually, not actually, I want to determine the orientation of the tooling as if the suction cups are square and overhead with the part it's picking up. Right now, the blank is coming down the conveyor parallel with the conveyor. If I have a blank come down perpendicular to the conveyor or anywhere in between, I want to adjust my general position or skip it in general depending on how the part comes down the conveyor (cycle time purposes). I use mp2[4]+r2 (r2 = rotation from camera offset) to apply the actual offset of the pick so I'd figure I can use that to determine my needs.

Most of the program is "model" dependent that relies on one general program to do numerous jobs. I can't have a dedicated job for each one either.

• Personally, I would try and make my general position to match the orientation of the next pick, this way the approach would not include any orientation change and negate the requirement of any evaluation.

Depends just when the values for the new pick are generated, if they are being generated after moving to the general position, then I can see a need for the evaluation.

Seems like you're on top of it though........