Re: [Emc-users] Counting and saving to file
On 09/15/2012 06:17 AM, andy pugh wrote: > That is what CSV is, "comma separated variables". The special > character is a comma. > It is also a really bad choice, as a large proportion of the world use > the comma as a decimals separator. I used to think it meant "comma separated values", and I think that makes sense, except that somebody already thought of the usefulness of the comma in data. I just imported something like this file: fname:lname:stuff:number erastmus b.:dragging:techie:29 budd:tugly:makeup artist:22 into Libre Office Calc and the import feature allows a radio button choice of comma, semi-colon, and a few others, but allows you to choose practically ANY character you want to be the separator. It wants to have text surrounded by either single or double quote characters. I did a copy of the file with the colon replaced by the underscore character, and it imported fine also. While you could use Libre Office to import the CSV file, and write it out to an XLS file, I suspect that is not necessary. While I don't have a copy of Excel here to try it out, I suspect it allows semi-colon as a separator, and perhaps any other character. We have imported CSV files at work in the past. Someone wrote an app that takes data from our tester and writes it out as a CSV. We have an Excel spreadsheet that takes that data, and puts it into a nice, formatted data sheet we can send to customers. This probably comes under the heading of Just Works (tm). 8-) -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://ad.doubleclick.net/clk;258768047;13503038;j? http://info.appdynamics.com/FreeJavaPerformanceDownload.html ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] Counting and saving to file
2012/9/15 Przemek Klosowski : > On Sat, Sep 15, 2012, Viesturs Lācis wrote >> What is the syntax to put current date in the file name. In Your >> example the file name is xyz. > > import datetime > open("xyz."+datetime.date.today().isoformat(),"a") > >> And how can I specify the folder, in which the file is saved? > > directory="/tmp/" > open(directory+"xyz."+datetime.date.today().isoformat(),"a") Thanks for the suggestions! I expect to start some work on this by the end of the next week, so I will post more questions as they will arise. -- Viesturs If you can't fix it, you don't own it. http://www.ifixit.com/Manifesto -- How fast is your code? 3 out of 4 devs don\\\'t know how their code performs in production. Find out how slow your code is with AppDynamics Lite. http://ad.doubleclick.net/clk;262219672;13503038;z? http://info.appdynamics.com/FreeJavaPerformanceDownload.html ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] Counting and saving to file
On Sat, Sep 15, 2012, Viesturs Lācis wrote > What is the syntax to put current date in the file name. In Your > example the file name is xyz. import datetime open("xyz."+datetime.date.today().isoformat(),"a") > And how can I specify the folder, in which the file is saved? directory="/tmp/" open(directory+"xyz."+datetime.date.today().isoformat(),"a") Having said that, Stephen's suggestion about databases is cool if you are willing to invest in learning them. A lot of issues such as 'will the data be saved', 'what happens if we restart after power loss', 'which file is the latest one', are handled by the database: you write EVERY data point, the database makes sure it finds its way to disk, and you then use the database to sift good/relevant records out. If you don't feel like running full MySQL system, you could run sqlite: import sqlite3 conn=sqlite3.connect("example.db") c=conn.cursor() c.execute('create table planks (date text, length real)') c.execute('insert into planks values (\''+datetime.date.today().isoformat()+'\',12.44)') conn.commit() c.close() and the data is there: $ sqlite3 -line example.db 'select * from planks' date = 2012-09-15 length = 12.44 length = 12.44 -- How fast is your code? 3 out of 4 devs don\\\'t know how their code performs in production. Find out how slow your code is with AppDynamics Lite. http://ad.doubleclick.net/clk;262219672;13503038;z? http://info.appdynamics.com/FreeJavaPerformanceDownload.html ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] Counting and saving to file
This might be a little obtuse, but consider putting a small UPS on the computer and the monitor. Set the software that monitors the UPS to shut down the computer after a reasonable time automatically. The operator would have enough time, if they are around, to get to the computer and save the file, then shut down the rest of the operation gracefully. I use several UPS in my home, just for that reason, (and I hate to loose stuff because of a quick power glitch too!). Where I live, in the toolies outside Nashville, we have power spikes and outages regularly. A fact of living on the other end of long distribution lines. So I put UPSes on EVERYTHING electronic that I care about saving. A problem in our transformer put 220V over 110V lines intermittently (actually it was a poor ground at the transformer, and the power company fixed it but didn't admit it, so we just had to pay for our burned out equipment - I was there when the linemen got that 'oh stuff' look on their face, and took a short piece of grounding strap and climbed up by the transformer ... after that no more problems.). Anyway the UPSes I had saved the gear it was on, but others were toast. Even one UPS died. I opened it up and the transformer primary was burned out, and half the MOV's inside were black. Batteries were still good, but discharged. I kept them as spares for other UPSes and purchased a new UPS for that spot. ( I like refurbups.com and the APCC brand). We still lost half the light bulbs in the house, and about $400 of misc electronics to this power issue. But nothing behind the UPSes was lost. One UPS died (additional cost). Also, figure you replace batteries about every 3 years if you don't monitor the UPS, and every 4 if you do (just because you can tell when the battery is getting weak - monitor with computer software that 'just runs'.) -- How fast is your code? 3 out of 4 devs don\\\'t know how their code performs in production. Find out how slow your code is with AppDynamics Lite. http://ad.doubleclick.net/clk;262219672;13503038;z? http://info.appdynamics.com/FreeJavaPerformanceDownload.html ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] Counting and saving to file
> > > We agreed that saving to a file will be done, when operator > explicitly presses "save" button. So they are taking a risk that > powerfailure will cause a loss of unsaved data. I just cannot figure > out, how to create a reminder for operator to save data in case he/she > is trying to close application with some unsaved numbers. > Cogoman's suggestion is the best here. Do a file open, append line of data, file close with each reading. THis is a trivial activity for the computer. Then to satisfy the customer, have the save button copy the contents of this "Shift" file to a final file. That way, if there is a power failure (and the operator has not hit the save button for 4 hours) and the customer calls you, you can tell them to look for this "shift file" to get the data they thought long gone. DUring a machine startup and or shut down, you can have the contents of the file saved to the daily file then purge the "shift" file. Brian -- How fast is your code? 3 out of 4 devs don\\\'t know how their code performs in production. Find out how slow your code is with AppDynamics Lite. http://ad.doubleclick.net/clk;262219672;13503038;z? http://info.appdynamics.com/FreeJavaPerformanceDownload.html ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] Counting and saving to file
On 15 September 2012 08:26, Viesturs Lācis wrote: > Yes, saving to csv would be nice, but I think that I have a solution - > put in the rows some special characters, like semicolon, and then use > "text to columns" function in spreadsheet. That is what CSV is, "comma separated variables". The special character is a comma. It is also a really bad choice, as a large proportion of the world use the comma as a decimals separator. > What I am concerned about is the coding of the file - most likely they will > import the file in excel on windows. Just write("x,y,z") and it's CSV. -- atp If you can't fix it, you don't own it. http://www.ifixit.com/Manifesto -- How fast is your code? 3 out of 4 devs don\\\'t know how their code performs in production. Find out how slow your code is with AppDynamics Lite. http://ad.doubleclick.net/clk;262219672;13503038;z? http://info.appdynamics.com/FreeJavaPerformanceDownload.html ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] Counting and saving to file
2012/9/14 Przemek Klosowski : > On Fri, Sep 14, 2012 at 2:45 PM, Viesturs Lācis > wrote: > >>> Maybe check if the file exists, and if it does, open in append mode; >>> otherwise open it normally for writing. >> >> Yes, that would be nice. >> Can You share some source, where I can see, how does it look, when coded? > > As it turns out, opening the file in append mode creates it if it > doesn't exist, so you can just do > > x=open("xyz","a") > x.write("abc") Thank You! What is the syntax to put current date in the file name. In Your example the file name is xyz. And how can I specify the folder, in which the file is saved? 2012/9/15 cogoman : > On 09/14/2012 03:53 PM, Stephen Dubovsky wrote: >> Python can make database calls. Just write the lengths to a database. >> Use database tools to do all the analysis like histogramming, etc. >> Thats what they are very good at. > Or, if the end user is handy with a spreadsheet, you could write it out > to a .CSV file, and include the date and time so they could tell if data > came before or after the power failure. Of course for safety sake, you > could close the file after each board is stored. Yesterday I saw a video, where they demonstrated, how such a machine is working. Each new piece of wood plank is created every 2 or 3 seconds. We agreed that saving to a file will be done, when operator explicitly presses "save" button. So they are taking a risk that powerfailure will cause a loss of unsaved data. I just cannot figure out, how to create a reminder for operator to save data in case he/she is trying to close application with some unsaved numbers. Yes, saving to csv would be nice, but I think that I have a solution - put in the rows some special characters, like semicolon, and then use "text to columns" function in spreadsheet. What I am concerned about is the coding of the file - most likely they will import the file in excel on windows. -- Viesturs If you can't fix it, you don't own it. http://www.ifixit.com/Manifesto -- How fast is your code? 3 out of 4 devs don\\\'t know how their code performs in production. Find out how slow your code is with AppDynamics Lite. http://ad.doubleclick.net/clk;262219672;13503038;z? http://info.appdynamics.com/FreeJavaPerformanceDownload.html ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] Counting and saving to file
On 09/14/2012 03:53 PM, Stephen Dubovsky wrote: > Python can make database calls. Just write the lengths to a database. > Use database tools to do all the analysis like histogramming, etc. > Thats what they are very good at. Or, if the end user is handy with a spreadsheet, you could write it out to a .CSV file, and include the date and time so they could tell if data came before or after the power failure. Of course for safety sake, you could close the file after each board is stored. -- Got visibility? Most devs has no idea what their production app looks like. Find out how fast your code is with AppDynamics Lite. http://ad.doubleclick.net/clk;262219671;13503038;y? http://info.appdynamics.com/FreeJavaPerformanceDownload.html ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] Counting and saving to file
Python can make database calls. Just write the lengths to a database. Use database tools to do all the analysis like histogramming, etc. Thats what they are very good at. -- Got visibility? Most devs has no idea what their production app looks like. Find out how fast your code is with AppDynamics Lite. http://ad.doubleclick.net/clk;262219671;13503038;y? http://info.appdynamics.com/FreeJavaPerformanceDownload.html ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] Counting and saving to file
On Fri, Sep 14, 2012 at 2:45 PM, Viesturs Lācis wrote: >> Maybe check if the file exists, and if it does, open in append mode; >> otherwise open it normally for writing. > > Yes, that would be nice. > Can You share some source, where I can see, how does it look, when coded? As it turns out, opening the file in append mode creates it if it doesn't exist, so you can just do x=open("xyz","a") x.write("abc") if you needed to do some more housekeeping if the file didn't exist, you could do the explicit test: import os if os.path.isfile("xyz"): print "file exists" -- Got visibility? Most devs has no idea what their production app looks like. Find out how fast your code is with AppDynamics Lite. http://ad.doubleclick.net/clk;262219671;13503038;y? http://info.appdynamics.com/FreeJavaPerformanceDownload.html ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] Counting and saving to file
2012/9/14 Przemek Klosowski : > On Fri, Sep 14, 2012 at 2:26 AM, Viesturs Lācis > wrote: >> >> But if it saves automatically, I do not want to overwrite previous >> files, especially if there have been several times LinuxCNC has been >> started in one day - for example, in the morning, then on lunch break > > Maybe check if the file exists, and if it does, open in append mode; > otherwise open it normally for writing. Yes, that would be nice. Can You share some source, where I can see, how does it look, when coded? -- Viesturs If you can't fix it, you don't own it. http://www.ifixit.com/Manifesto -- Got visibility? Most devs has no idea what their production app looks like. Find out how fast your code is with AppDynamics Lite. http://ad.doubleclick.net/clk;262219671;13503038;y? http://info.appdynamics.com/FreeJavaPerformanceDownload.html ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] Counting and saving to file
On Fri, Sep 14, 2012 at 2:26 AM, Viesturs Lācis wrote: > > But if it saves automatically, I do not want to overwrite previous > files, especially if there have been several times LinuxCNC has been > started in one day - for example, in the morning, then on lunch break Maybe check if the file exists, and if it does, open in append mode; otherwise open it normally for writing. -- Got visibility? Most devs has no idea what their production app looks like. Find out how fast your code is with AppDynamics Lite. http://ad.doubleclick.net/clk;262219671;13503038;y? http://info.appdynamics.com/FreeJavaPerformanceDownload.html ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] Counting and saving to file
Seems like the data collection would work with a python dictionary. For example you set up a dictionary entry for how many ranges they want then each time a board falls inside of a range set by the operator you increment the integer for that dictionary entry. http://www.tutorialspoint.com/python/python_dictionary.htm http://www.tutorialspoint.com/python/python_basic_operators.htm A simple example. create a dictionary dict = {'range1':0, 'range2':0, 'range3':0} the operator enters the low and high values for each range update the dictionary if measure >= range1_low and measure < range1_high: dict['range1'] += 1; elseif measure >= range2_low and measure < range2_high: dict['range2'] += 1; ... At some triggered point you could append the data to the file using the file I/O and clear the dictionary counter once a successful file write occurred. Also look at the simple example for the winder to see how to make a gladevcp panel and run it with HAL. http://gnipsel.com/linuxcnc/index.html John On 9/14/2012 1:26 AM, Viesturs Lācis wrote: > > Ok, I will try to share some more details: > 1) there are wood planks with some defects somewhere in the middle, > that defect needs to be removed by sawing that particular section out; > that by definition means that the operation will create at least 2 > usable pieces; > 2) I have no influence on the hardware design of the machine, my task > is to set up controls - the length of the piece needs to be displayed > and number of produced parts have to be counted; > 3) and they want not only total number of all parts, but they want to > know, how many parts were 800-950 mm long, how many parts were > 950-1100 mm long etc. (those numbers are just for example, endpoints > of those ranges will be set by operator). > > The measurement of the length will be done by an encoder, attached to > a wheel, which will be turned as material moves under it. Material > will be moved manually (do not yet know, how exactly) by operator. I > already figured out, how to reset encoder position to start measuring > new part, so that is not my concern at the moment. > > What I do not know and where I would appreciate some advice/hints is - > how to save those counted numbers to a file. I have yet to figure, > what is better: > 1) request operator to press "save" button in vcp panel; > 2) update file automatically as soon as any of the counted numbers > have incremented - this is better in terms of "power-failure caused > loss of data" situation; > > But if it saves automatically, I do not want to overwrite previous > files, especially if there have been several times LinuxCNC has been > started in one day - for example, in the morning, then on lunch break > system was shut down and then turned on again later. Or even worse - > some powerfailure or whatever caused unexpected shutdown and then > restarting LinuxCNC and saving to the same file is good as long as it > adds the new data below the existing ones, not overwrite them. OTOH I > think it is mandatory that all the data, counted in one session should > be updated in the same line, not add another line as soon as new part > is done. I was looking at that tutorial, shared by John Thornton, but > I did not yet get it, how exactly does that "writing to a file" > happen. Today I will visit the client (those guys will produce the > machine, I do not have access to enduser), so I will try to find out > more, how all of this is supposed to be set up. > > > John, thank You for the links! > -- Got visibility? Most devs has no idea what their production app looks like. Find out how fast your code is with AppDynamics Lite. http://ad.doubleclick.net/clk;262219671;13503038;y? http://info.appdynamics.com/FreeJavaPerformanceDownload.html ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] Counting and saving to file
2012/9/14 James Isaac : > >> Date: Thu, 13 Sep 2012 10:46:28 +0300 >> > What I do not understand, how to implement is: > >> Client wants to define some ranges of the lengths and they want > machine to count, >> how many parts fall in particular range and then > save these data to a file. > > > I apologize if I have misunderstood your problem, > or if you have already incorporated these engineering techniques, > but here is my "change your environment" solution : Ok, I will try to share some more details: 1) there are wood planks with some defects somewhere in the middle, that defect needs to be removed by sawing that particular section out; that by definition means that the operation will create at least 2 usable pieces; 2) I have no influence on the hardware design of the machine, my task is to set up controls - the length of the piece needs to be displayed and number of produced parts have to be counted; 3) and they want not only total number of all parts, but they want to know, how many parts were 800-950 mm long, how many parts were 950-1100 mm long etc. (those numbers are just for example, endpoints of those ranges will be set by operator). The measurement of the length will be done by an encoder, attached to a wheel, which will be turned as material moves under it. Material will be moved manually (do not yet know, how exactly) by operator. I already figured out, how to reset encoder position to start measuring new part, so that is not my concern at the moment. What I do not know and where I would appreciate some advice/hints is - how to save those counted numbers to a file. I have yet to figure, what is better: 1) request operator to press "save" button in vcp panel; 2) update file automatically as soon as any of the counted numbers have incremented - this is better in terms of "power-failure caused loss of data" situation; But if it saves automatically, I do not want to overwrite previous files, especially if there have been several times LinuxCNC has been started in one day - for example, in the morning, then on lunch break system was shut down and then turned on again later. Or even worse - some powerfailure or whatever caused unexpected shutdown and then restarting LinuxCNC and saving to the same file is good as long as it adds the new data below the existing ones, not overwrite them. OTOH I think it is mandatory that all the data, counted in one session should be updated in the same line, not add another line as soon as new part is done. I was looking at that tutorial, shared by John Thornton, but I did not yet get it, how exactly does that "writing to a file" happen. Today I will visit the client (those guys will produce the machine, I do not have access to enduser), so I will try to find out more, how all of this is supposed to be set up. John, thank You for the links! -- Viesturs If you can't fix it, you don't own it. http://www.ifixit.com/Manifesto -- Got visibility? Most devs has no idea what their production app looks like. Find out how fast your code is with AppDynamics Lite. http://ad.doubleclick.net/clk;262219671;13503038;y? http://info.appdynamics.com/FreeJavaPerformanceDownload.html ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] Counting and saving to file
> Date: Thu, 13 Sep 2012 10:46:28 +0300 > What I do not understand, how to implement is: > Client wants to define some ranges of the lengths and they want machine to count, > how many parts fall in particular range and then save these data to a file. I apologize if I have misunderstood your problem, or if you have already incorporated these engineering techniques, but here is my "change your environment" solution : 1. Place the object to be detected into a "V block on the bed of the DRO machine, to position the object in a standard and known location, 2. Use a highly modified version of "smartprobe.ngc", from the Example folder of EMC2 /LinuxCNC, to write a file of the points of the object, 3. Scan the file, (using "AWK" or "SED"), to identify the beginning and the end of the object, (looking for the transitions from Height = Bed -> Height = Object, and reverse), 4. Calculate the length from the identified end points, Bin the parts into the various lengths, and recalculate statistics on the various Bins. Drawback: I use SED, I do not use AWK. I find it awkward, compared to C. You have to know the height differences you are searching for, before writing your scanning program. I suspect "smartprobe.ngc" is dog slow, based on the number of points to scan. Each new object must have the length program verified, and modified. Maybe that is job security, these days. Improvements: A mod version of "smartprobe.ngc" would need to know the location of the object. Put the object and the V block on a 30 or 45 degree angle, and you might only have to probe for one surface, (depending on your object), and with the X-Y-Z surfaces on this same angle, with support, you might not have to math out any trig distances, again, object dependant). Thank you for putting the problem up on the forum. I had a long day. J'aime mon solution. James Isaac. -- Got visibility? Most devs has no idea what their production app looks like. Find out how fast your code is with AppDynamics Lite. http://ad.doubleclick.net/clk;262219671;13503038;y? http://info.appdynamics.com/FreeJavaPerformanceDownload.html ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] Counting and saving to file
this thread covers that too http://linuxcnc.org/index.php/english/component/kunena/?func=view&catid=48&id=23317&limit=6&start=24#23708 John On 9/13/2012 1:12 PM, Viesturs Lācis wrote: > 2012/9/13 andy pugh : >> On 13 September 2012 19:58, Viesturs Lācis wrote: >> #! /bin/bash loadrt -I -f thingycounter.hal >>> What do those -l and -f options mean? >> Nothing. That was completely wrong. >> >> With "halrun" however, the options mean to keep the HAL sesssion live, >> and to run a file. >> http://linuxcnc.org/docs/html/man/man1/halcmd.1.html >> > Ok, but how is this system supposed to be closed? > -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] Counting and saving to file
Your in luck I also have a custom GUI tutorial for LinuxCNC. http://gnipsel.com/linuxcnc/index.html You can also use halrun and a GladeVCP panel to run simple GUI's that only need hal components. http://linuxcnc.org/index.php/english/component/kunena/?func=view&catid=48&id=23317&limit=6&start=24#23708 John On 9/13/2012 11:38 AM, Viesturs Lācis wrote: > 2012/9/13 John Thornton : >> This is a pretty good tutorial on file I/O in python >> >> http://en.wikibooks.org/wiki/Non-Programmer%27s_Tutorial_for_Python_3/File_IO >> >> Have you seen my tutorials on gladevcp and building a gui from scratch? >> > Thank You for the link! I think that I even understood some fraction of it :)) > SInce I am a total noob in programming and especially in python, I > have to think about this and will try to find some more reading, > because now I have no idea, where should I put that code that will > save some data to a file, I also have no idea, how to tell it to > insert a value of particular HAL pins there and I also have no idea, > how to tell it to save a file with current date in the filename, but > do not overwrite, if such a file exists, but simply add "2", "3" etc > to the end of file name. > > Yes, I have seen Your tutorials, I liked them, IMHO they are really good. > You shared them little while ago in a thread in which I asked > something about vcp panels for my current project. > I think that the question, how to make my built-from-scratch gladevcp > panel to be the single and standalone GUI (not part of Axis or Touchy > or whatever) was not answered there, so I ended up with pyvcp panel in > Axis as I was really short on time and did not want to spend it on > learning Glade. This time I will have more time, so I would like to > try out building very simple GladeVCP panel, I just have no idea, how > exactly am I supposed to make it the only GUI for LinuxCNC. I am sure > that it has to do with DISPLAY = line in INI file, but I do not know > the details. > -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] Counting and saving to file
2012/9/13 andy pugh : > On 13 September 2012 19:58, Viesturs Lācis wrote: > >>> #! /bin/bash >>> loadrt -I -f thingycounter.hal >> >> What do those -l and -f options mean? > > Nothing. That was completely wrong. > > With "halrun" however, the options mean to keep the HAL sesssion live, > and to run a file. > http://linuxcnc.org/docs/html/man/man1/halcmd.1.html > Ok, but how is this system supposed to be closed? -- Viesturs If you can't fix it, you don't own it. http://www.ifixit.com/Manifesto -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] Counting and saving to file
On 13 September 2012 19:58, Viesturs Lācis wrote: >> #! /bin/bash >> loadrt -I -f thingycounter.hal > > What do those -l and -f options mean? Nothing. That was completely wrong. With "halrun" however, the options mean to keep the HAL sesssion live, and to run a file. http://linuxcnc.org/docs/html/man/man1/halcmd.1.html -- atp If you can't fix it, you don't own it. http://www.ifixit.com/Manifesto -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] Counting and saving to file
2012/9/13 andy pugh : > On 13 September 2012 18:38, Viesturs Lācis wrote: > >> I think that the question, how to make my built-from-scratch gladevcp >> panel to be the single and standalone GUI (not part of Axis or Touchy >> or whatever) was not answered there, > > You can load only HAL with halrun, then the HAL file can load the GUI. Yes, You are correct that this case would require only HAL with "encoder" component to display the position of material and with some glade panel and classicladder or some custom HAL component to determine, in which range of length does current position fall into. Endpoints of ranges are determined by operator in vcp panel > The only missing part is an executable file that can be used to start > the system, something like > > #! /bin/bash > loadrt -I -f thingycounter.hal What do those -l and -f options mean? -- Viesturs If you can't fix it, you don't own it. http://www.ifixit.com/Manifesto -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] Counting and saving to file
On 13 September 2012 18:38, Viesturs Lācis wrote: > I think that the question, how to make my built-from-scratch gladevcp > panel to be the single and standalone GUI (not part of Axis or Touchy > or whatever) was not answered there, You can load only HAL with halrun, then the HAL file can load the GUI. The only missing part is an executable file that can be used to start the system, something like #! /bin/bash loadrt -I -f thingycounter.hal -- atp If you can't fix it, you don't own it. http://www.ifixit.com/Manifesto -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] Counting and saving to file
2012/9/13 John Thornton : > This is a pretty good tutorial on file I/O in python > > http://en.wikibooks.org/wiki/Non-Programmer%27s_Tutorial_for_Python_3/File_IO > > Have you seen my tutorials on gladevcp and building a gui from scratch? > Thank You for the link! I think that I even understood some fraction of it :)) SInce I am a total noob in programming and especially in python, I have to think about this and will try to find some more reading, because now I have no idea, where should I put that code that will save some data to a file, I also have no idea, how to tell it to insert a value of particular HAL pins there and I also have no idea, how to tell it to save a file with current date in the filename, but do not overwrite, if such a file exists, but simply add "2", "3" etc to the end of file name. Yes, I have seen Your tutorials, I liked them, IMHO they are really good. You shared them little while ago in a thread in which I asked something about vcp panels for my current project. I think that the question, how to make my built-from-scratch gladevcp panel to be the single and standalone GUI (not part of Axis or Touchy or whatever) was not answered there, so I ended up with pyvcp panel in Axis as I was really short on time and did not want to spend it on learning Glade. This time I will have more time, so I would like to try out building very simple GladeVCP panel, I just have no idea, how exactly am I supposed to make it the only GUI for LinuxCNC. I am sure that it has to do with DISPLAY = line in INI file, but I do not know the details. -- Viesturs If you can't fix it, you don't own it. http://www.ifixit.com/Manifesto -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] Counting and saving to file
This is a pretty good tutorial on file I/O in python http://en.wikibooks.org/wiki/Non-Programmer%27s_Tutorial_for_Python_3/File_IO Have you seen my tutorials on gladevcp and building a gui from scratch? John On 9/13/2012 2:46 AM, Viesturs Lācis wrote: > Hello! > > I am asked, if I can make a DRO machine that simply measures the > length of parts and displays the length of the part on the screen. > I find that to be easy task. > > What I do not understand, how to implement is: > Client wants to define some ranges of the lengths and they want > machine to count, how many parts fall in particular range and then > save these data to a file. > > I think that use of ClassicLadder will handle counting number of parts > in particular range, and export the counted number to HAL pin to be > displayed in VCP. > But how can I write those data to a file? > -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] Counting and saving to file
On 13 September 2012 09:46, Viesturs Lācis wrote: > I think that use of ClassicLadder will handle counting number of parts > in particular range, and export the counted number to HAL pin to be > displayed in VCP. > But how can I write those data to a file? I think that a GladeVCP panel might be most suitable, and file access should be easy from there. -- atp If you can't fix it, you don't own it. http://www.ifixit.com/Manifesto -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
[Emc-users] Counting and saving to file
Hello! I am asked, if I can make a DRO machine that simply measures the length of parts and displays the length of the part on the screen. I find that to be easy task. What I do not understand, how to implement is: Client wants to define some ranges of the lengths and they want machine to count, how many parts fall in particular range and then save these data to a file. I think that use of ClassicLadder will handle counting number of parts in particular range, and export the counted number to HAL pin to be displayed in VCP. But how can I write those data to a file? -- Viesturs If you can't fix it, you don't own it. http://www.ifixit.com/Manifesto -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users