summaryrefslogtreecommitdiff
path: root/docs/man/man1/halsampler.1
blob: 16aaf62755ce4977e968e8994b313ddf699e047b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
.\" Copyright (c) 2006 John Kasunich
.\"                (jmkasunich AT users DOT sourceforge DOT net)
.\"
.\" This is free documentation; you can redistribute it and/or
.\" modify it under the terms of the GNU General Public License as
.\" published by the Free Software Foundation; either version 2 of
.\" the License, or (at your option) any later version.
.\"
.\" The GNU General Public License's references to "object code"
.\" and "executables" are to be interpreted as the output of any
.\" document formatting or typesetting system, including
.\" intermediate and printed output.
.\"
.\" This manual is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public
.\" License along with this manual; if not, write to the Free
.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
.\" USA.
.\"
.\"
.\"
.TH HALSAMPLER "1"  "2006-11-18" "LinuxCNC Documentation" "HAL User's Manual"
.SH NAME
halsampler \- sample data from HAL in realtime
.SH SYNOPSIS
.B halsampler
.RI [ options ]

.SH DESCRIPTION
.BR sampler (9)
and
.B halsampler
are used together to sample HAL data in real time and store it in a file.
.B 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.
.B 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.

.SH OPTIONS
.TP
.BI "-c " CHAN
instructs 
.B halsampler
to read from FIFO
.IR CHAN .
FIFOs are numbered from zero, and the default value is zero, so
this option is not needed unless multiple FIFOs have been created.
.TP
.BI "-n " COUNT
instructs 
.B halsampler
to read
.I COUNT
samples from the FIFO, then exit.  If
.B -n
is not specified,
.B halsampler
will read continuously until it is killed.
.TP
.B -t
instructs 
.B halsampler
to tag each line by printing the sample number in the first column.
.TP
.B FILENAME
instructs
.B halsampler
to write to \fBFILENAME\fR instead of to stdout.
.SH USAGE
A FIFO must first be created by loading 
.BR sampler (9)
with 
.B halcmd loadrt
or a
.B loadrt
command in a .hal file.  Then
.B halsampler
can be invoked to begin printing data from the FIFO to stdout.
.P
Data is printed one line per sample.  If
.B -t
was specified, the sample number is printed first.  The data follows, in the
order that the pins were defined in the config string.  For example, if the
.B sampler
config string was "ffbs" then a typical line of output (without
.BR -t )
would look like:
.P
123.55 33.4 0 -12
.P
.B halsampler
prints data as fast as possible until the FIFO is empty, then it retries at regular intervals, until it is either killed or has printed
.I COUNT
samples as requested by
.BR -n .
Usually, but not always, data printed by
.B halsampler
will be redirected to a file or piped to some other program.
.P
The FIFO size should be chosen to absorb samples captured during any momentary disruptions in the flow of data, such as disk seeks, terminal scrolling, or the processing limitations of subsequent program in a pipeline.  If the FIFO gets
full and
.B sampler
is forced to overwrite old data,
.B halsampler
will print 'overrun' on a line by itself to mark each gap in the sampled
data.  If
.B -t
was specified, gaps in the sequential sample numbers in the first column
can be used to determine exactly how many samples were lost.
.P
The data format for
.B halsampler
output is the same as for
.BR halstreamer (1)
input, so 'waveforms' captured with
.B halsampler
can be replayed using
.BR halstreamer .
The
.B -t
option should not be used in this case.

.SH "EXIT STATUS"
If a problem is encountered during initialization,
.B halsampler
prints a message to stderr and returns failure.
.P
Upon printing
.I COUNT
samples (if
.B -n
was specified) it will shut down and return success.  If it is terminated
before printing the specified number of samples, it returns failure.  This
means that when
.B -n
is not specified, it will always return failure when terminated.

.SH "SEE ALSO"
.BR sampler (9)
.BR streamer (9)
.BR halstreamer (1)

.SH HISTORY

.SH BUGS

.SH AUTHOR
Original version by John Kasunich, as part of the LinuxCNC
project.  Improvements by several other members of
the LinuxCNC development team.
.SH REPORTING BUGS
Report bugs to jmkasunich AT users DOT sourceforge DOT net
.SH COPYRIGHT
Copyright \(co 2006 John Kasunich.
.br
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.