Handling large files

More
29 Jun 2019 20:31 #138193 by Lezard
Replied by Lezard on topic Handling large files

halsampler creates the file but it remains empty.


Did you set the enable pin?


I think it is enabled by default, I checked it with HAL monitor (?) and I could see that the pin and associated signal received the expected value. I'm a bit confused by the halsampler doc : it seems that there is no function to activate, just loadusr halsampler ?

Please Log in or Create an account to join the conversation.

More
29 Jun 2019 20:54 #138196 by Grotius
Replied by Grotius on topic Handling large files
I made a short code example for your mars surface log file...
You could integrate this code in a component. Yourhal_line will be your input character text string in this case, could be
a complete g_code line.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

char linebuffer[200] = "firstline";
int i;


//int main(int argc, char *argv[]){

FILE *file_write=fopen("log.txt", "w");
file_write=fopen("log.txt", "w");  

//Yourhal_line = linebuffer;
fprintf(file_write,"\n%d\t%s ", i, linebuffer);
i++;

fclose(file_write);	

//}

Output :


Good luck !!
Attachments:
The following user(s) said Thank You: chimeno

Please Log in or Create an account to join the conversation.

More
29 Jun 2019 21:06 #138197 by lorenzn
Replied by lorenzn on topic Handling large files
Yes I see you're right it is enabled by default. When I used it, I setp enable 0 in my .hal file, then enabled with halcmd when I was ready to sample the data and write to the file.
loadrt sampler depth=10000 cfg=b
addf sampler.0 servo-thread
setp sampler.0.enable 0

net 1-is-homed sampler.0.pin.0

Then run
$ halcmd setp sampler.0.enable 1
$ halsampler -t out

Please Log in or Create an account to join the conversation.

More
29 Jun 2019 21:50 #138200 by Lezard
Replied by Lezard on topic Handling large files
Hi @Grotius,

Thank you very much for your code sample.
I'm really a noob on this so will need some time to figure out what it does/how to use it, but I'm sure it will come handy at some point.
The following user(s) said Thank You: Grotius

Please Log in or Create an account to join the conversation.

More
29 Jun 2019 22:07 - 29 Jun 2019 22:19 #138202 by Grotius
Replied by Grotius on topic Handling large files
I'm really a noob on this so will need some time to figure out what it does/how to use it, but I'm sure it will come handy at some point.

\n%d\t%s is i think a abracadabra line for you, it's not so hard :
\n = newline
%d = decimal
\t = tab
%s = character

If you copy a component. You can edit it to my sample, name : log.comp.
Then in terminal : (sudo) halcompile --compile log.comp or halcompile --install log.comp (different option)
Copy the output file (so or ko, depends on kernel) to your rtlib, and you are on the run !!

I just showed you linux power ! And within a few line's of coding it could be yours too !

so will need some time to figure out what it does
Take your time to investegate. If you have question's about it. Feel free to ask.
And remember. The linux power is so huge, that window's is in the position to go down...
Imagine a window's update... and your mac adres is different the next day... you have a problem or not?
Last edit: 29 Jun 2019 22:19 by Grotius.
The following user(s) said Thank You: chimeno

Please Log in or Create an account to join the conversation.

More
29 Jun 2019 22:19 - 29 Jun 2019 22:21 #138204 by rodw
Replied by rodw on topic Handling large files
Something like this ( I might not have got it all as its spread through a couple of hal files)
#sampler x,y,z,torch volts,thcad-volts,velocity
loadrt sampler depth=10000 cfg=ffffff
addf sampler.0                servo-thread 
net THCAD-volts-in  <= sampler.0.pin.4 <= thcad10.thcad-volts
net curvolt <= sampler.0.pin.3 <= thcad10.torch-volts
net ArcOK   <= sampler.0.enable <= hm2_7i76e.0.7i76.0.0.input-10
net sample0 sampler.0.pin.0 <= axis.x.pos-cmd
net sample1 sampler.0.pin.1 <= axis.y.pos-cmd

I used an enable pin so it was only collecting data when it was doing something useful (In this case, actually when the plasma torch was cutting something!)

I opened and parsed the file in google sheets for analysis

From memory, you just need to open another terminal window and type halsampler from the command line and it prints on screen. MIght have need the rip-environment set (I was using RIP)
Last edit: 29 Jun 2019 22:21 by rodw.
The following user(s) said Thank You: Grotius

Please Log in or Create an account to join the conversation.

More
29 Jun 2019 22:25 #138207 by Grotius
Replied by Grotius on topic Handling large files
Rod,

Did you look in the source code of sampler? B)
Haha.

I shut down for now. Reading plasma document's tomorrow.
The following user(s) said Thank You: rodw

Please Log in or Create an account to join the conversation.

More
30 Jun 2019 18:47 #138246 by Lezard
Replied by Lezard on topic Handling large files
Thank you all for sharing your experience and knowledge, I think this is also a big aspect of Linux' power !

I'll be away for a few days, will look into this when I come back, but I must say that the more I go, the better I feel about choosing LinuxCNC for the control of my machine.
The following user(s) said Thank You: rodw, Grotius

Please Log in or Create an account to join the conversation.

More
01 Jul 2019 18:41 - 01 Jul 2019 18:43 #138326 by Grotius
Replied by Grotius on topic Handling large files
the better I feel about choosing LinuxCNC for the control of my machine.

Hmm. I thought you where already on linux for all of your pc's... Give it a go, you will not regret it on long therm.

One more thing to think about. If your town is on linux (i mean all factories, houses etc) and you are
the provider of that open source solution, you do not have to work anymore. Remember that !
Your employees will keep the systems up to date.
Last edit: 01 Jul 2019 18:43 by Grotius.

Please Log in or Create an account to join the conversation.

Time to create page: 0.113 seconds
Powered by Kunena Forum