Man page - sense_rec(1)
Packages contas this manual
apt-get install sense-emu-tools
Manual
| SENSE_REC(1) | sense-emu | SENSE_REC(1) |
NAME
sense_rec - Sense HAT data recorder
Records sensor readings from the Raspberry Pi Sense HAT in real time, outputting the results to a file for later playback or analysis. This is most useful for preparing records of experiments for use with the Sense HAT emulator. For example, a recording of a Sense HAT being dropped, a recording of a HAB flight, a recording of the cycle of temperature over a few days, etc.
SYNOPSIS
sense_rec [-h] [--version] [-q] [-v] [-l FILE] [-P] [-c CONFIG]
[-d DURATION] [-f] output
DESCRIPTION
- -h, --help
- show this help message and exit
- --version
- show this program's version number and exit
- -q, --quiet
- produce less console output
- -v, --verbose
- produce more console output
- -l FILE, --log-file FILE
- log messages to the specified file
- -P, --pdb
- run under PDB (debug mode)
- -c FILE, --config FILE
- the Sense HAT configuration file to use (default: /etc/RTIMULib.ini)
- -d SECS, --duration SECS
- the duration to record for in seconds (default: record until terminated with Control-C)
- -i SECS, --interval SECS
- the delay between each reading in seconds (default: the IMU polling interval, typically 0.003 seconds)
- -f, --flush
- flush every record to disk immediately; reduces chances of truncated data on power loss, but greatly increases disk activity
EXAMPLES
To record an experiment with the Sense HAT, simply execute sense_rec with the filename you wish to record the results:
$ sense_rec experiment.hat
By default, the recording will continue indefinitely. Press Control-C to terminate the recording. If you want to record for a specific duration, you can use the --duration option to specify the number of seconds:
$ sense_rec --duration 10 short_experiment.hat
This tool can be run simultaneously with scripts that use the Sense HAT. Simply start your script in one terminal, then open another to start sense_rec. Alternatively, you can use the shell's job control facilities to start recording in the background:
$ sense_rec experiment.hat & $ python experiment.py ... $ kill %1
WARNING:
If - is specified as the output file, sense_rec will write its output to stdout. This can be used to reduce the disk space required for long output by piping the output through a compression tool like gzip:
$ sense_rec - | gzip -c - > experiment.hat.gz
When compressed in this manner the data typically uses approximately 3Kb per second (without gzip the recording will use approximately 10Kb of disk space per second). Use gunzip to de-compress the data for playback or analysis:
$ gunzip -c experiment.hat.gz | sense_play -
Another method of reducing the data usage is increasing the interval between readings (the default is the IMU polling interval which is an extremely short 3ms). Obviously a longer interval will reduce the "fidelity" of the recording; you will only see the sensors update at each interval during playback, however it can be extremely useful for very long recordings. For example, to record with a 1 second interval between readings for 24 hours:
$ sense_rec -i 1 -d $((24*60*60)) one_day_experiment.hat
Finally, you can use pipes in conjunction with sense_csv to produce CSV output directly:
$ sense_rec - | sense_csv - experiment.csv
Be warned that CSV data is substantially larger than the binary format (CSV data uses approximately 25Kb per second at the default interval).
AUTHOR
Raspberry Pi Foundation
COPYRIGHT
2016-2024 Raspberry Pi Foundation
| March 26, 2024 | 1.2.2 |