sampler − sample data from HAL in real time
loadrt sampler depth=depth1[,depth2...] cfg=string1[,string2...]
sampler and halsampler(1) are used together to sample HAL data in real time and store it in a file. sampler is a realtime HAL component that exports HAL pins and creates a FIFO in shared memory. It then begins sampling data from the HAL and storing it to the FIFO. halsampler is a user space program that copies data from the FIFO to stdout, where it can be redirected to a file or piped to some other program.
sets the depth of the realtime->user FIFO that sampler creates to buffer the realtime data. Multiple values of depth (separated by commas) can be specified if you need more than one FIFO (for example if you want to sample data from two different realtime threads).
defines the set of HAL pins that sampler exports and later samples data from. One string must be supplied for each FIFO, separated by commas. sampler exports one pin for each character in string. Legal characters are:
F, f (float pin)
B, b (bit pin)
S, s (s32 pin)
U, u (u32 pin)
One function is created per FIFO, numbered from zero.
Pin for the data that will wind up in column M of FIFO N (and in column M of the output file). The pin type depends on the config string.
sampler.N.curr-depth s32 output
Current number of samples in the FIFO. When this reaches depth new data will begin overwriting old data, and some samples will be lost.
sampler.N.full bit output
TRUE when the FIFO N is full, FALSE when there is room for another sample.
sampler.N.enable bit input
When TRUE, samples are captured and placed in FIFO N, when FALSE, no samples are acquired. Defaults to TRUE.
sampler.N.overruns s32 read/write
The number of times that sampler has tried to write data to the HAL pins but found no room in the FIFO. It increments whenever full is true, and can be reset by the setp command.
sampler.N.sample-num s32 read/write
A number that identifies the sample. It is automatically incremented for each sample, and can be reset using the setp command. The sample number can optionally be printed in the first column of the output from halsampler, using the -t option. (see man 1 halsampler)
halsampler(1) streamer(9) halstreamer(1)
Original version by John Kasunich, as part of the LinuxCNC project. Improvements by several other members of the LinuxCNC development team.
Report bugs to jmkasunich AT users DOT sourceforge DOT net
© 2006 John Kasunich.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.