RobotStudio event

How to stop quickly based off analog signal (StopMove/Trap?)

Our robot has an analog distance sensor that it uses to measure the distance to the surface of a rubber sheet, then moves down to pick it up. When it goes to place the sheet on another stack, I use the same analog sensor to see when I've "hit" the stack and the sheet gets closer to the sensor.

I'm currently using a while loop to constantly check the sensor and move down in 5mm increments if I haven't touched the stack yet. It works but I'm using v50 and z0 so it's very slow. Any faster and I hit the stack too hard and trigger Supervision alarm. I've tried using "fine" for my zone or adding in waittime but the motion is very jerky and I assume bad for the robot over time. 

What's a better solution for what I'm trying to do? I'm not familiar with Traps. How would I integrate analog signal as a trigger for the trap routine? All I see online are examples with digital inputs. 

Best Answer

  • lemster68
    lemster68 ✭✭✭
    Answer ✓
    I was thinking that this would be so much easier with a SearchL instruction.  And I just re-read your earlier posts- that signal is coming from the PLC, not directly to the robot.  So if you can manage in your PLC code to look for the value you desired to signal that you are "there", then simply turn on a DI which would satisfy the search criteria.  You could then just forget about the ISignalAI.
    By the way, you are doing pretty good here working this stuff out.
    Lee Justice

Answers

  • You would use the instruction ISignalAI, connected to a Trap routine.  In which, as you suggested already, StopMove, then ClearPath.
    Lee Justice
  • Thank you. So I was reading up on the ISignalAI. My analog input is actually a group input I'm receiving from a PLC. I see that ISignalAI has things like "BETWEEN" or "ABOVE_LOW" but ISignalGI doesn't. It's just a "change in value" which doesn't really help me. My analog value isn't that steady. 
  • You can remap a group to be treated as an analog signal.  I am sure that I have posted some examples here in the forum more than once.
    Lee Justice
  • So I've remapped it as an Analog input and it's reading well. I tried using StopMove then ClearPath but then everything just stops (Testing in RobotStudio) and I need to stop the simulation and start it again. Pushing play on the pendant doesn't do anything. Which trap functions should I be using to stop midway through a MoveL but then restart on the next line of my program? 
  • Then you need to determine where the robot is, and where it should move to next.  There is the instruction StartMove you will need to use.
    Lee Justice
  • I'm still confused on what I'm doing wrong. Here is my Rapid code:

    TRAP trapStackRoutine
            StopMove \Quick;
            ClearPath;
            StorePath;
            PalletCenterPlace:=CRobT(\Tool:=BrunoEOATFinal \WObj:=wobjInfeed_Pallet);
            MoveL PalletCenterPlace,vFast,fine,BrunoEOATFinal\WObj:=wobjInfeed_Pallet;
            RestoPath;
            StartMove;
        ENDTRAP

    If I don't include the "Clearpath", the interrupt works but completes the previous MoveL it was executing before the trap. Which is supposed to happen based off all the manuals I've been looking through. 
    if I include the "Clearpath" then it just stops. What am I missing?
  • I see you are grabbing the robot position, but then moving to where it already is.  What is that about?  Maybe you want to move offset from the current position instead?  What actually needs to happen in the process when the robot?  Turn on or off vacuum, grippers or the like.
    Lee Justice
  • Updating the robtarget and the move aren't really necessary, just trying it out in my test. What I really need to happen is: 
    1. Have a MoveL that starts high above the pallet then moves down to the floor. 
    2. The trap should interrupt this MoveL and stop where it is. 
    3. Robot releases de-energizes suction cups to release the sheet. 
    4. Robot moves up and continues cycle. 
  • OK.  I am not going to code it for you now, but try to explain it.  The end position of your place position moment make a variable robtarget.  Before you start the motion before the interrupt, assign it to the real end position, the floor you called it.  But use the variable robtarget to move to.  In the trap, reassign the current position to the variable.  Tell the robot to go to it.  Don't use storepath.  When the trap finishes, I hope that it will see that it has arrived at the variable robtarget, which has been changed to where the robot now is.  So the the execution ought to continue in the sequence that you desire.
    Lee Justice
  • I've tried implementing what you described and I get event message 41739 - StorePath required. If I update the robtarget in the trap routine, the robot still goes down to the floor during that cycle but the position will be updated on the next run. This is in line with the documentation I've read on ClearPath but every time I use ClearPath, my program just stops. 
  • lemster68
    lemster68 ✭✭✭
    edited December 2021
    OK, use Storepath and then just clear it.  You used startmove?  Told it to go where it already is?  Make sure you assign the "real" position to the variable every time before you start the motion.
    Ex. pMyVariable Target:=pMyRealRobtarget:
    MoveL pMyVAriableRobtarget...
    interrupt occurs
    value reassigned
    go to where it already is
    Startmove
    finish trap

    Post some code if you can
    Lee Justice
  • Also, maybe instead of telling the robot to go where it is, maybe tell it to move offset 25mm in Z and then back.
    Lee Justice
  • PROC main()
            CONNECT trapTopOfStack WITH trapStackRoutine;
            ISignalAI plcDistanceSensor, AIO_BELOW_LOW, 1000, 125, 1, trapTopOfStack;
            PalletPlaceTemp:=PalletPlaceReal;
            
            !Home Position
            MoveL pHome,vFast,fine,BrunoEOATFinal\WObj:=wobjInfeed_Pallet;
            !Line up above pallet
            MoveL pPalletCenter, vFast, fine, BrunoEOATFinal\WObj:=wobjInfeed_Pallet; 
            !Move Down to pallet
            MoveL PalletPlaceReal, vFast, fine, BrunoEOATFinal\WObj:=wobjInfeed_Pallet;
            IDelete trapTopOfStack;
            
        ENDPROC
        
        TRAP trapStackRoutine
            StopMove \Quick;
            StorePath;
            ClearPath;
            PalletPlaceTemp:=CRobT(\Tool:=BrunoEOATFinal \WObj:=wobjInfeed_Pallet);
            MoveL Offs(PalletPlaceTemp,0,0,25),vFast,fine,BrunoEOATFinal\WObj:=wobjInfeed_Pallet;
            StartMove;
        ENDTRAP


    I just have a robot going up and down for my test code. The Trap triggers, temp point is updated and moves up 25mm but then it stops with the PP on the "MoveL PalletPlaceReal...."
  • I just thought of a couple things, 1. Isleep at beginning of trap, 2. You might want to make the interrupt \Single.

    And this is what I was suggesting.

            !Move Down to pallet
            MoveL PalletPlaceTemp, vFast, fine, BrunoEOATFinal\WObj:=wobjInfeed_Pallet;

    Lee Justice
  • Unfortunately that didn't change anything. Still stops after executing the trap routine. 
  • Just looked up the SearchL instruction and it sounds very promising. Going to try implementing now. Thank you very much for the assistance and the kind words. I only took Programming I and Studio I so a lot of this is research and lots of trial and error. 
  • And you are still learning!  Don't ever stop.
    Lee Justice
  • Well that seems to have done the trick. Works well in RobotStudio and I'll implement IRL tomorrow. Thank you again for the help. Posting code for future people that may need it. 

    PROC main()
        
            PalletPlaceTemp:=PalletPlaceReal;
            !Home Position
            MoveL pHome,vFast,fine,BrunoEOATFinal\WObj:=wobjInfeed_Pallet;
            !Line up above pallet
            MoveL pPalletCenter, vFast, fine, BrunoEOATFinal\WObj:=wobjInfeed_Pallet; 
            !Move Down to pallet
            SearchL \Stop, plcTouchingStack, PalletPlaceTemp, PalletPlaceReal, v100, BrunoEOATFinal \WObj:=wobjInfeed_Pallet;
            MoveL Offs(PalletPlaceTemp, 0,0,25), vFast, fine, BrunoEOATFinal\WObj:=wobjInfeed_Pallet;
        ENDPROC
  •  :) 
    Lee Justice
  • Just updating that SearchL works great! I need to go faster than v100 so changed to \SStop and made my trigger earlier because of the deceleration time. Thank you @lemster68