RobotStudio event

z height recovery

So newbie question I have a program that currently takes my robot to a specified a position. I would like it to not go to that z position if it is already above it ie if the robot is at 750 and the z position is 707 I don't want it to come down to that height however if it is below the 707 I want it to move straight up to that height. After doing some research this is what I have come up with however I am getting an error that says expected = <>; but found then. It is referring to the bolded sections of my code. I don't have a very good grasp on what I am currently writing so any help would be great. Below is my program as written. Everything works if I take out the bolded line it just always goes to the specified z height. 



PROC Zpos()
        VAR robtarget NextPos;
        
        IF WeldToolOn=1 THEN GOTO WeldtoolZpos;
        ENDIF 
        
        !Cliptool zpos         
       
        NextPos:=CRobT();
        IF NextPos.z>707.z THEN GOTO EndZPos;
       ENDIF
        
        NextPos.trans.z:=707;
        IF ClipToolOn=1 THEN
        MoveL NextPos,V300,fine,ClipTool\WObj:=Table;
        ELSEIF NoToolOn=1 THEN
        MoveL NextPos,V300,fine,ToolMount\WObj:=Table;
        ENDIF
        GOTO EndZPos;
        
        !Weldtool zpos
        WeldtoolZpos:
        NextPos:=CRobT();
        IF NextPos.z>510.trans.z THEN GOTO EndZPos;
        ENDIF
        NextPos.trans.z:=510;
        MoveL NextPos,V300,fine,WeldTool2\WObj:=Table;
        
        !END
        EndZPos:

    ENDPROC
 

Comments

  • Do this:
    IF NextPos.trans.z>707 THEN GOTO EndZPos;
    You need the .trans.z and the 707.z is just 707
    Lee Justice
  • That worked beautifully thanks Lee!!  

    Quick somewhat unrelated question though. If I am doing a fine termination is there a way to decelerate instead of an abrupt stop? The problem we are having is that we need a fine termination so that the sensor on the eoat is in position but the abrupt stops are really shaking the machine bad. 
  • lemster68
    lemster68 ✭✭✭
    The AccSet instruction reduces the acceleration and deceleration.  Shaking is sometimes the result of things not being securely mounted, bolted down.  Other times it is because the robot payload is incorrect or just not set up at all.
    Lee Justice
  • I was just hopping on to tell you I figured it out with the AccSet. This is a clip driver so there is no real payload however I do have the Tool mass set up. I am dialing in the AccSet right now and kind of figuring it out but so far it has smoothed it out quite a bit. Thanks again Lee!!! 
  • lemster68
    lemster68 ✭✭✭
    You are welcome.  I feel that you get more bang for your buck by reducing the second number.
    Lee Justice
  • Quick Follow up question on this same program. I am using this as a recovery to a specified z height. I have one set of moves that uses a different work object. I've noticed that when I run this program it makes the tcp move in both the +z and -X direction I am assuming it is because I am switching between work objects is there any way to use NextPos:=CRobT(); but specify which work object I want to use before hand. Like I said my guess is that I am making NextPos=CRobT but I am still in my other work object when I set the coordinates.
  • lemster68
    lemster68 ✭✭✭
    The Function CRobT has optional arguments which allow you to specify the tool and the workobject, either together or alone.
    Lee Justice
  • I just figured it out I added in the (\WObj:=Table ) before I made this post but I must have miss typed something because it wasn't working and was giving me an error so I figured it wasn't a thing but I retried it and it is working now. Thanks for the quick response!! 
  • lemster68
    lemster68 ✭✭✭
    You are welcome.
    Lee Justice