Author Topic: Auto Load Files From External Storage  (Read 1818 times)

0 Members and 1 Guest are viewing this topic.

Offline fazza85

  • Jr. Member
  • **
  • Thank You
  • -Given: 4
  • -Receive: 2
  • Posts: 51
Auto Load Files From External Storage
« on: May 03, 2017, 01:20:16 PM »
Hello all,

I have previous experience machining using KUKA robots. Loading files from a USB stick on to the robot was straightforward - highlight multiple files from usb stick then copy and paste.

The memory of the robot allowed a reasonable amount of lines of code before the files had to be deleted and new ones copied on on.

We now have a customer asking for a Kawasaki BX200L for machining. We have completed a few trials and have come to the conclusion that the maximum number of lines of code the robot can store at once is approximately 60,000. This isn't a great deal when machining, and means that we have to stop the robot, delete the old file and copy a new one in every few minutes.

Is there a way to have the robot automatically delete old files then load new ones from a USB stick or over a network? So for example:

Load 2 files on to the robot.
When program 1 has finished and it has moved on to program 2, automatically delete 1 and load number 3 on, then when it moves on to 3 delete 2 and load 4 on etc.

Would really appreciate any advice as to whether or not this is possible!

Cheers

Offline kwakisaki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 32
  • -Receive: 107
  • Posts: 724
Re: Auto Load Files From External Storage
« Reply #1 on: May 03, 2017, 07:04:17 PM »
You could use a PC Program to monitor for which program is in use and handle the delete/load....that would be my direction to take.
- TASK or WHICHTASK should be used to monitor the status of the stepper (motion program in use).
- You can use DELETE directly in the motion program or a derivative of this MC DELETE in a PC Program.
- NLOAD command will automatically load files from the USB (E Controller) or PCMCIA (C/D Controller) into the Robot Memory.....reals, locations, programs etc.

Have a read of those........I know the NLOAD command works as I have used it before.
Hope this helps.............

Offline Kawaguy

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 10
  • Posts: 43
Re: Auto Load Files From External Storage
« Reply #2 on: May 04, 2017, 07:33:10 AM »
Please take a look at this short example:

Code: [Select]
.PROGRAM main
   FOR pgnumber = 1 to maxpg
      wait existreal("pgexist"+$encode(/k3,pgnumber))
      twait 0.5
      scall "machining"+ $encode(/k3,pgnumber)
   END
.END
.PROGRAM pc
  while true
     chkpg = pgnumber-1
     if chkpg>0
       if existpgm("machining"+$encode(/k3,chkpg))
          call delprog(chkpg)
       end
     end
     chkpg = pgnumber+1
     if chkpg>0 and chkpg<=maxpg then
       if not existpgm("machining"+$encode(/k3,chkpg))
          sload 2 = "file"+ $encode(/k3,chkpg)+".as", ret
          if ret<0 then ; when loading with error, do something else
             twait 5 ; 
          end
       end
     end
  end
.END
.program delprog(.nr)
; unfortunalty can't delete a program defined by a string (as far as I know)
  case .nr of
    value 1
      delete machining001
    value 2
      delete machining002
    value 3
      delete machining003
    value 4
      delete machining004
....
....
  end
.end

Your file file001.as should contaiin the pgexistxxx = 1 at the last line. To make sure the program will be executed when loading has finished.

.program machining001()
   pgexist001 = 1 
... machinecode...
.end
.joints
.... your joints 
.end
.reals
... your reals
   pgexists001 = 1
.end


Offline kwakisaki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 32
  • -Receive: 107
  • Posts: 724
Re: Auto Load Files From External Storage
« Reply #3 on: May 04, 2017, 08:35:57 AM »
Nice example....... :top:

Offline griphand

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 27
Re: Auto Load Files From External Storage
« Reply #4 on: September 10, 2018, 06:02:57 AM »
Hello,

Nice idea. But, where can I place the file to load? Where is the 'external storage'?

Thank you.


Offline kwakisaki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 32
  • -Receive: 107
  • Posts: 724
Re: Auto Load Files From External Storage
« Reply #5 on: September 11, 2018, 07:14:05 AM »
'External Storage' is memory external to the Controller.
- E Controller has USB connections for external use such as file/data saves or screen dumps.
- C/D Controller only have PCMCIA Slot for external use for file/data saves only.

By use of NLOAD/SLOAD commands, data can then be loaded from external storage to controller via program instructions.

Offline griphand

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 27
Re: Auto Load Files From External Storage
« Reply #6 on: September 14, 2018, 01:52:50 PM »
Hello,

It does not work.

We have an F controller.
I wrote a little test program like this:
  NLOAD 1=lt1.as, result
  PRINT "file loaded, result is: ", result

I put 'lt1.as' file on PC (connected on ethernet) and on USB drive too. The file is not loaded, neither. The 'result' variable was some negative number and an error message appeared.

Is there any software switch have to alter to enable this functionality (NLOAD, SLOAD instructions)?

Thank you!



Offline kwakisaki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 32
  • -Receive: 107
  • Posts: 724
Re: Auto Load Files From External Storage
« Reply #7 on: September 14, 2018, 06:29:46 PM »
Quote
'External Storage' is memory external to the Controller.
- E Controller has USB connections for external use such as file/data saves or screen dumps.
- C/D Controller only have PCMCIA Slot for external use for file/data saves only.

No mention of PC via Ethernet.................

Try and provide specific errors also, just saying 'the file is not loaded' could be down to many problems:
1. File to load in is incorrect.
2. Data on the file to load in is not correct.
3. Command to load in is not structured/formatted correctly.

Read the NLOAD and SLOAD commands in the AS Manual - I suspect you're written code is incorrectly formatted.
« Last Edit: September 14, 2018, 06:40:36 PM by kwakisaki »

Offline griphand

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 27
Re: Auto Load Files From External Storage
« Reply #8 on: September 20, 2018, 09:20:17 AM »
Hello,

So, I put one program on the USB drive and one program on the PC. The program named as lt1.as both.
On the USB:
Code: [Select]
.PROGRAM lt1() #0
  PRINT "hello USB"
.END
On the PC:
Code: [Select]
.PROGRAM lt1() #0
  PRINT "hello PC"
.END

I wrote a little test to load the program:
Code: [Select]
.PROGRAM ltest()
  NLOAD 1= lt1,result
  PRINT "Program loaded, result is: ", result
.END


In monitor I type: 'load lt1', : the program loaded from the PC. I type: 'usb_load lt1', the program loaded from the USB drive without error.

Executing ltest: 'execute ltest' (motor power and run is on), the motors turns on, the program executed but the file is not loaded. The result variable  is -12016.


Offline kwakisaki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 32
  • -Receive: 107
  • Posts: 724
Re: Auto Load Files From External Storage
« Reply #9 on: September 20, 2018, 06:47:27 PM »
With the USB inserted into the Controller.
Execute your program as a PC Program, this will allow you to run it independently as a standalone program without cycling the robot.
PCEXECUTE 1: ltest

Try altering your program to:
.PROGRAM ltest()
NLOAD ltl,result
PRINT "Program loaded, result is: ", result
.END

Offline griphand

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 27
Re: Auto Load Files From External Storage
« Reply #10 on: September 24, 2018, 12:25:38 PM »
Hello,

I tried it. The result is the same -- program not loaded.

From teach pendant:
  $ usb_load lt1
  Loading... (lt1.as)
  Program lt1()
  File load completed (0 errors)

  $ pcexecute ltest
  $ Program loaded, result is: -12016
  PC program completed. No=1001

The program was not loaded of course.

Btw: I saw somewhere can save screenshot of the teach pendant. I can't find it how now.

Thank you.


Offline Alexandru

  • Full Member
  • ***
  • Thank You
  • -Given: 3
  • -Receive: 8
  • Posts: 140
Re: Auto Load Files From External Storage
« Reply #11 on: September 24, 2018, 05:13:07 PM »
You can save the screenshot from the teach pendat by pressing A+R. You need to have a usb plug in, in order to save the picture.

Offline kwakisaki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 32
  • -Receive: 107
  • Posts: 724
Re: Auto Load Files From External Storage
« Reply #12 on: September 27, 2018, 09:44:14 PM »
Hmmmmm, just noticed you are using F Controller.....with this having multiple USB, it is possible the specific USB port may require addressing in the code, but I cannot see any information for this in AS Manual.
I shall try myself when I get the opportunity and see if this is the case.

Offline Nzhuhu

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 2
  • Posts: 51
Re: Auto Load Files From External Storage
« Reply #13 on: October 07, 2018, 01:16:43 PM »
Dear Kwakisaki and everyone,

I know and im sorry that i did not keep my promise which is put the robot project to sleep....but i could not get it off my head with 1 problem and that is External Storage.

When we all saying External Storage meaning any kind of storage you can have with your robot like Personal Computer, USB, Floppy Disk ( for my vintage robot UX 150 ) or even PLC ? I do not clearly understand, are we meaning when we excute the Coding ( which make our robot moving according to our plan our draw or even our GCode ), the robot's controller will extracting or reading the Step or Line ( cnc ) DIRECTLY from our Storage which does not have to copy the Code to Controller's CMOS RAM ( Flash RAM ) which is very limited only 10mb max for new version and 1mb max for my vintage ?

If my theory above is correct then our first need is USB owner and Floppy Disk Owner ( me ) need to make sure our external storage is Formated as our Robot Required ! ( i need abit explain here from expert because my UX150 required me to but Floppy Disk in and excute Format from Controller ).

And somehow both my guess above are correct then we need to tell the Robot that the CODE is PC program.....

What about PLC ? Can it help ?

Anyway, all the best to everyone.

Trung

Offline griphand

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 27
Re: Auto Load Files From External Storage
« Reply #14 on: October 08, 2018, 01:39:35 PM »
Hello,

Yes I have an F controller. And I have AS Language Reference Manual for the E controller only. Is this matter?

I tried "NLOAD lt1,result" in a motion program (without the "1=" pre) and the controller waits forever for something.

I see the handling of the USB drive is very lazy. I removed the USB drive and deleted some files and replugged it. The 'usb_fdir' command shows the deleted files in the list too. I made a screenshot with A+R, then the new 'usb_fdir' command shows the correct list.

Thank you