Logging to a File
Hello all,
So here is what I am wanting to do:
Picture gets taken of Part A (Cycle time logging start)
Part A goes through its cut and is then placed onto a conveyor. The robot goes back home.(Cycle time logging stopped)
! This is the camera start
CamSetRunMode Vision_01;
CamReqImage Vision_01;
! Then at the end of the routine I am running the robot goes home
I would like to be able to save this information to a spreadsheet that I can see what part was cut and the cycle time it took to cut said part. as well as the date and time if possible.
We have about 12 different parts we cut on this one robot.
Thank you so much in advance
0
Best Answer
-
I wrote this for S4C+, it writes to a text file. You could adapt it to write a .csv file which you could open in a spreadsheet.%%%VERSION:1LANGUAGE:ENGLISH%%%MODULE OffsetLog! Data logging module to record trueview offsets! provided to R62 for roof load onto car.!! Boolean bQuiet is switch to turn on or off! TPWrites as desired.!! Boolean bLogData is switch to turn on or off! the data logging altogether.!! Numeric nFreeFlashPer is the percent value! of flash drive free space below which the! program will erase the log file and begin a new! file, so the flash drive will not fill up.! Adjust as desired.!! Created: 10-09-2011!PERS num nFreeFlashPer:=32;PERS bool ComDevIsOpen:=FALSE;PERS bool bQuiet:=FALSE;PERS bool bLogData:=FALSE;PROC rLogOffsets()VAR iodev datalog;VAR string stDate;VAR string stTime;VAR num nFreespace;VAR num nTotalspace;IF bLogData THENstDate:=CDate();stTime:=CTime();nFreespace:=FSSize("HOME:/Offsets.txt"\Free);nTotalspace:=FSSize("HOME:/Offsets.txt"\Total);IF ((nTotalspace-nFreespace)/nTotalspace)*100<nFreeFlashPer THENIF ComDevIsOpen Close datalog;Open "HOME:"\File:="Offsets.txt",datalog\Write;ComDevIsOpen:=TRUE;Write datalog,stDate+", "+stTime+", "+"New offset data log created.";ErrWrite\W,"File removed","Removing Offsets.txt from the HOME directory."\RL2:="To keep flash drive from filling.";ELSEIF ComDevIsOpen Close datalog;Open "HOME:"\File:="Offsets.txt",datalog\Append;ComDevIsOpen:=TRUE;Write datalog,stDate + ", " + stTime + ", " + ActiveStylString + ", " + " nXoffset is: "\Num:=nXoffset\NoNewLine;Write datalog,", nYoffset is: "\Num:=nYoffset;Close datalog;ComDevIsOpen:=FALSE;IF bQuiet THEN! Do nothing, only silence TPWritesELSETPWrite "The file containing the offset data is in the HOME directory.";TPWrite "Use the File Manager to retrieve a copyof Offsets.txt.";ENDIFENDIFENDIFRETURN;ERRORTEST ERRNOCASE ERR_FILEACC:IF ComDevIsOpen Close datalog;Open "HOME:"\File:="Offsets.txt",datalog\Write;Write datalog,stDate+", "+stTime+", "+"New offset data log created.";Close datalog;RETRY;DEFAULT:Stop;! An unanticipated error has occurred! see sytem variable ERRNO for cause.ENDTESTENDPROCENDMODULELee Justice6
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 316 IRC5
- 61 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 799 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings