RobotStudio event

Abort target motion and continue to the next taget

Hi

I would like the robot to abort a motion as it recieves a collision signal, and continue to the next target.

Example: 

1. Robot is making a downward motion to place an object
2. As it feels a collision it aborts the downward motion
3. Robot drops the object and starts moving upwards to the next target

I checked stopMove and clearPath functions but not sure if thats the right way to do it.

Is there a good way to do this in RAPID?

/pav




Comments

  • Hello Pav,

    One thing you might be looking for is the use of triggers, interrupts and traps.

    You can create a triggdata which you can link to an interrupt. This interrupt should be linked to a trap that you want executed once the interrupt occurs.
    You can move the robot towards the point and when it reaches an X distance from the point, the trigger triggers and activates the interrupt. The code would look somewhat like this:

    TRAP tTrap ! Defined the trap
    ! Do what you want to be done, stop movement and drop object
    ENDTRAP
    PROC Trigger()
    VAR triggdata Trigger;
    VAR intnum interrupt;
    VAR num X;
    VAR robtarget endPoint;
    X := 5; ! amount of millimeters you want the robot to stop near your place point
    CONNECT interrupt WITH tTrap; ! Connecting the interrupt with the trap
    TriggInt Trigger, X, interrupt; ! Trigger occurs when robot passes the virtual sphere with diameter X around endpoint.
    ! You can also define this trigger to trigger when the robot passes a virtual sphere with diameter X around startpoint.
    ! You can do this with the following statement: "TriggInt Trigger, X \Start, interrupt;" Please check ABB documentation
    ! for more info on triggers and uses for these triggers.
    TriggL endPoint, v10, Trigger, fine, tool0 \wobj wobj0;
    ! Replace speed, zone, tool and workobject with the ones you're currently using.
    ENDPROC

    In this code i gave some explanation in the comments.
    The way this code is executed is as follows:

    The function creates the trigger, interrupt and other vars needed (you can use the variables you're using in your code).
    It connects the interruptnumber interrupt with trap tTrap, meaning whenever the interrupt gets activated, the program pointer will jump to tTrap and execute this one.
    Then the trigger Trigger will be linked to the interruptNumber Interrupt. whenever the robot gets within X millimeter around the endpoint, the trigger will occur and activate the interrupt (which will lead the program pointer to enter the trap tTrap).

    The robot gets moved with the TriggL function. This is comparable with the MoveL function (TriggJ and MoveJ, check ABB Documentation for more).
    Whenever the robot moves within X mm around the destination (endPoint), it will trigger Trigger.


    I hope this helps!

    Cheers
  • B_Baan
    B_Baan
    edited December 2014
    Unfortunately i have no permission to edit my own posts, so I will add a little piece here:

    The Diameter described in the comments should be radius* sorry...
  • pavpav
    pavpav
    edited December 2014
    Hello B_Baan and thank u for the reply.

    I am using a smart component(collision sensor) that sends a DI signal to the robot and notifies it when to cancel the motion.
    I managed to get the robot to do what i want by following the example under clearPath in the RAPID manual.
    However, it seems that stopMove \Quick command is slow at restarting because the robot is stuck insided the conveyer for about 1 second before continueing with the upward motion.

    PROC Path_place()

    CONNECT collision_gripper WITH TRAP_collision;
    ISignalDI \Single, DI_collision, 1, collision_gripper;

       MoveJ DW_MOTION,v300,z100,TCP_Gripper\WObj:=wobj0; 
      ENDPROC  

    TRAP TRAP_collision

    StopMove \Quick;
    ClearPath; 
    IDelete collision_gripper; 

        StorePath;       
        MoveJ UW_MOTION,v3000,z100,TCP_Gripper\WObj:=wobj0; 
        RestoPath;
        StartMove;

    ENDTRAP

    I would like the robot to continue to the upward motion quickly after the collision, and not be stuck in the conveyer for 1 sec.
    Can it be done with a trigger?

    Thank you

    /pav
       

    Post edited by pavpav on
  • soup
    soup ✭✭✭


    pavpav said:
    1. Robot is making a downward motion to place an object
    2. As it feels a collision it aborts the downward motion
    3. Robot drops the object and starts moving upwards to the next target

    -- How about the 'place an object' move be a SearchL with the 'collision' being the search found trigger...?
  • Hello Pav,

    I do not know why it is not possible to move out once the robot has dropped the object.

    You could do something like this:

    TRAP tTrap ! Defined the trap
    ! Do what you want to be done, stop movement and drop object
    StopMove;
    DropObject; ! Drop the object, however you wish to do it
    WaitDI(ObjectDropped,1);
    StartMove
    MoveL Offs(CRobT(CurrentTool, CurrentWobj), 0,0,X), v10, fine, CurrentTool \wobj:=CurrentWobj; ! Where X is the required Height to move
    IDelete Interrupt;
    ENDTRAP
    PROC Trigger()
    VAR triggdata Trigger;
    VAR intnum interrupt;
    VAR num X;
    VAR robtarget endPoint;
    X := 5; ! amount of millimeters you want the robot to stop near your place point
    CONNECT interrupt WITH tTrap; ! Connecting the interrupt with the trap
    TriggInt Trigger, X, interrupt; ! Trigger occurs when robot passes the virtual sphere with diameter X around endpoint.
    ! You can also define this trigger to trigger when the robot passes a virtual sphere with diameter X around startpoint.
    ! You can do this with the following statement: "TriggInt Trigger, X \Start, interrupt;" Please check ABB documentation
    ! for more info on triggers and uses for these triggers.
    TriggL endPoint, v10, Trigger, fine, tool0 \wobj wobj0;
    ! Replace speed, zone, tool and workobject with the ones you're currently using.
    ENDPROC

    I do not see why the instructions storepath and restopath should be used, try something similar to this.
  • Hi soup and thanks

    It seems SearchL is working quite well with the stiff stop. Too bad you didnt give me the advice before i started messing with clearPath for a whole day :P

    /pav
  • pavpav
    pavpav
    edited December 2014
    Hello B_Baan

    I will keep your method in mind if i want to drop objects. What im trying to do is to place an object on a surface that can vary in height. So the endpoint is never at the same z coord, thats why i need a collision to trigger the dropping.

    Store and restore path did not need to be used, but i got some error that StorePath is expected even though the robot made its motion without it.

    Regards
    Pav
  • Hello Pav,

    Its strange that the robot generates that error.

    Also, the height that you can setup your trigger with is variable, so that shouldn't be a big issue aswell.

    Anyway, good luck with your project!


    Cheers