RobotStudio event

Get current robot location

How do I verify the robot's current location? I am trying to use this but it just falls through.

  FUNC bool CheckLocation(
    num DistanceMM,
    robtarget Location,
   
obtarget Loc2
   
obtarget Loc3
   
obtarget Loc4
   
obtarget Loc5
   
obtarget Loc6
   
obtarget Loc7
   
obtarget Loc8)

    VAR robtarget CurRobT2;
    VAR num nDistance:=0;

    !
    ! get the current location
    CurRobT2:=CRobT();
    !
    ! check  location distance and axis configuration
    IF RobtToRobtDist(Location,CurRobT2)<DistanceMM AND RobtToRobtConf(Location,CurRobT2Approx) THEN
      RETURN TRUE;
    ENDIF
    !
    IF Present(Loc2) THEN
      ! check alternate location 2 
      IF RobtToRobtDist(Loc2,CurRobT2)<DistanceMM AND RobtToRobtConf(Loc2,CurRobT2Approx) THEN
        RETURN TRUE;
      ENDIF
    ENDIF
    !
    IF Present(Loc3) THEN
      ! check alternate location 3 
      IF RobtToRobtDist(Loc3,CurRobT2)<DistanceMM AND RobtToRobtConf(Loc3,CurRobT2Approx) THEN
        RETURN TRUE;
      ENDIF
    ENDIF

.....

and so on...

The pointer passes by the IF Present(Loc) command even though its in the top of the function. Any help is appreciated.

Thanks

Comments

  • Be aware of that the robot needs to stand still when you read the position with CRobT
    Per Svensson
    Robotics and Vision Specialist
    Consat Engineering
  • Can you use ABB worldzone option for that?. You can use worldzone to activate a digital output when ever robot reaches predefined space.

  • Moved to RobotWare forum.

    Henrik Berlin
    ABB
  • THis function requires a passed in distance and a passed in robottarget.

     

    The function then appears to back check the current position verus the passed in robotarget to see if the robot is within whatever distnace you passed in. If it is within the distance then it will return a TRUE statement if it is not then it will return a false. That is just an assumption since you didnt post all of the code.

     

    Seeing the calling routine that calls this function would also help as well.