RobotStudio event

Stop --> Reset/Start using interrupt and trap

Options
Hi, I'm programming a robot to serve 6 flavours of espresso but I need help with a stop-reset/start function.
What I want is:
- Stop = the robot stops where it is, even if it's on its way to a position.
- Start or Reset
- Start = if I press Start without a Reset, I just want the robot to keep doing what it was doing when the stopbutton was pressed. But if Reset has been pressed then i want it to start at the top of the program - ready for a new order.
- Reset = What the robot does depends on what it was doing, for example if it was holding a cup of espresso when Stop --> Reset was ressed I want it to put down the cup and move to home position.

I have an idea but im not sure if it would work (di1=stop di2=start di3=reset)

VAR intnum intno1;
...
CONNECT intno1 WITH Stop;
ISignalDI di1,1,intno1;

TRAP Stop ()
StopMove;
WaitUntil (di2+di3=1);
IF DI2,1 THEN
    StartMove;
ELSEIF DI3,1 THEN
    Clearpath
    ... (what ever I want it to do when i reset)
    PPToMain
ENDIF
ENDTRAP


Would something like this work? Is there a better way? Please help.

Thanks in advance.

Comments

  • soup
    soup ✭✭✭
    Options
    It would work but using a trap routine but it adds additional hassle you shouldn't need.

    Stop  = system input "Stop"
    Start = system input "Start"
    Reset = system input "StartAtMain"

    At the top of main,

    IF (sensor to know if it already has a cup) THEN
        Move to finish delivery of that cup and go to home position;
    ELSE
        Move to home position an get ready for a selection;
    ENDIF

    WaitUntil Selection > 0;
    IF Selection = 1 THEN
        Move to get and deliver Flavor 1;
    ELSEIF Selection = 2
        Move to get and deliver Flavor 2;
    ELSEIF...
    ENDIF
  • MattM
    Options
    Yeah that makes sense. Didn't think of system inputs, it sure makes it simpler. Thanks for the help!
  • dario8711
    Options
    Hello. I'm working on a very similar problem. I use a trap routine to stop movement when a collision fault occurs.
    There is a digital output always set on in the process, i cant reset the DO in the interrupt, tried different ways using cross connection and system outputs associated to states and dont get it.
    The example below, thanks.

    MODULE ...
    VAR intnum supmov;
    VAR intnum supstop;

    PROC ...( )
         CONNECT supmov WITH supervision;
         CONNECT supstop WITH reset_output;
         ISignalDO, MotSupTrigg, 1, supmov;
         ISignalDO, stop_program, 1, supstop;    ! Use a "stop_program" system output with Motors On state attached to a virtual DO
         Loop
         .....
    ENDPROC
    TRAP supervision
        RESET DO_PROCESS
       RETURN

    TRAP reset output
        RESET DO_PROCESS
    RETURN
    ENDTRAP