Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
HighBlueParsers
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Paul Best
HighBlueParsers
Commits
355429b0
Commit
355429b0
authored
10 months ago
by
Philemon Prevot
Browse files
Options
Downloads
Patches
Plain Diff
Add qhb_version check
parent
4ae621ea
Branches
Branches containing commit
No related tags found
1 merge request
!2
HighBlueParser dev branch merged to empty main branch
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
CMakeLists.txt
+1
-1
1 addition, 1 deletion
CMakeLists.txt
src/filewriter.cpp
+60
-60
60 additions, 60 deletions
src/filewriter.cpp
src/filewriter.h
+13
-12
13 additions, 12 deletions
src/filewriter.h
src/main.cpp
+30
-16
30 additions, 16 deletions
src/main.cpp
with
104 additions
and
89 deletions
CMakeLists.txt
+
1
−
1
View file @
355429b0
...
...
@@ -4,7 +4,7 @@ if(POLICY CMP0063)
endif
()
project
(
jasonrec
)
set
(
JASONREC_VERSION
"
1.3
"
)
set
(
JASONREC_VERSION
"
2.0
"
)
add_definitions
(
-DJASONREC_VERSION=
"
${
JASONREC_VERSION
}
"
)
find_path
(
LIBUSB_INCLUDE_DIR
...
...
This diff is collapsed.
Click to expand it.
src/filewriter.cpp
+
60
−
60
View file @
355429b0
...
...
@@ -16,8 +16,8 @@
#include
<cstring>
#include
<cmath>
FileWriter
::
FileWriter
(
std
::
string
&
filename_template
,
size_t
num_channels
,
size_t
sample_rate
,
size_t
depth
)
:
filename_template
(
filename_template
),
num_channels
(
num_channels
),
sample_rate
(
sample_rate
),
depth
(
depth
)
{
FileWriter
::
FileWriter
(
std
::
string
&
filename_template
,
size_t
qhb_version
,
size_t
num_channels
,
size_t
sample_rate
,
size_t
depth
)
:
filename_template
(
filename_template
),
qhb_version
(
qhb_version
),
num_channels
(
num_channels
),
sample_rate
(
sample_rate
),
depth
(
depth
)
{
// nothing
}
...
...
@@ -75,14 +75,14 @@ uint32_t read_little_endian(uint8_t (&source)[4]) {
return
(
source
[
0
]
+
source
[
1
]
<<
8
+
source
[
2
]
<<
16
+
source
[
3
]
<<
24
);
}
WavFileWriter
::
WavFileWriter
(
std
::
string
&
filename_template
,
size_t
num_channels
,
size_t
sample_rate
,
size_t
depth
)
:
WavFileWriter
(
filename_template
,
num_channels
,
sample_rate
,
depth
,
0
)
{
WavFileWriter
::
WavFileWriter
(
std
::
string
&
filename_template
,
size_t
qhb_version
,
size_t
num_channels
,
size_t
sample_rate
,
size_t
depth
)
:
WavFileWriter
(
filename_template
,
qhb_version
,
num_channels
,
sample_rate
,
depth
,
0
)
{
// nothing
}
WavFileWriter
::
WavFileWriter
(
std
::
string
&
filename_template
,
size_t
num_channels
,
size_t
sample_rate
,
size_t
depth
,
WavFileWriter
::
WavFileWriter
(
std
::
string
&
filename_template
,
size_t
qhb_version
,
size_t
num_channels
,
size_t
sample_rate
,
size_t
depth
,
size_t
expected_num_samples
)
:
FileWriter
(
filename_template
,
num_channels
,
sample_rate
,
depth
),
FileWriter
(
filename_template
,
qhb_version
,
num_channels
,
sample_rate
,
depth
),
outfile
(
generate_filename
(),
std
::
ios
::
out
|
std
::
ios
::
binary
|
std
::
ios
::
trunc
),
samples_written
(
0
)
{
// check if we could open the file
...
...
@@ -122,8 +122,8 @@ void WavFileWriter::write(uint8_t *samples, size_t num_samples, uint8_t *imu_dat
samples_written
+=
num_samples
/
(
num_channels
*
depth
);
}
IMUFileWriter
::
IMUFileWriter
(
std
::
string
&
filename_template
,
size_t
num_channels
,
size_t
sample_rate
,
size_t
depth
,
size_t
timestamp
)
:
FileWriter
(
filename_template
,
num_channels
,
sample_rate
,
depth
),
IMUFileWriter
::
IMUFileWriter
(
std
::
string
&
filename_template
,
size_t
qhb_version
,
size_t
num_channels
,
size_t
sample_rate
,
size_t
depth
,
size_t
timestamp
)
:
FileWriter
(
filename_template
,
qhb_version
,
num_channels
,
sample_rate
,
depth
),
outfile
(
generate_filename
(),
std
::
ios
::
out
|
std
::
ios
::
trunc
),
last_timestamp
(
0
),
...
...
@@ -450,7 +450,7 @@ void IMUFileWriter::ProcessDecodedMessage(int msgFunction, int msgPayloadLength,
void
IMUFileWriter
::
write
(
uint8_t
*
sample
,
size_t
size
,
uint8_t
*
imu_data
)
{
uint8_t
*
imu_data_cur
(
imu_data
);
if
(
!
(
imu_data
[
0
]
==
0xFE
)
&&
(
imu_data
[
0
]
>=
2
)
)
{
if
(
this
->
qhb_version
==
3
)
{
for
(
int
i
=
1
;
i
<
size
-
1
;
i
++
)
{
DecodeMessage
(
imu_data
[
i
]);
...
...
@@ -490,9 +490,9 @@ size_t IMUFileWriter::get_last_timestamp(){
}
SplitWavFileWriter
::
SplitWavFileWriter
(
std
::
string
&
filename_template
,
size_t
num_channels
,
size_t
sample_rate
,
SplitWavFileWriter
::
SplitWavFileWriter
(
std
::
string
&
filename_template
,
size_t
qhb_version
,
size_t
num_channels
,
size_t
sample_rate
,
size_t
depth
,
size_t
samples_per_file
)
:
FileWriter
(
filename_template
,
num_channels
,
sample_rate
,
depth
),
FileWriter
(
filename_template
,
qhb_version
,
num_channels
,
sample_rate
,
depth
),
samples_per_file
(
samples_per_file
),
current_file
(
nullptr
),
current_file_samples_written
(
0
)
{
...
...
@@ -510,7 +510,7 @@ void SplitWavFileWriter::write(uint8_t *samples, size_t num_samples, uint8_t *im
// start as many new files as required to write out the samples
while
(
current_file_samples_written
+
available
>=
samples_per_file
)
{
if
(
!
current_file
)
{
current_file
=
new
WavFileWriter
(
filename_template
,
num_channels
,
sample_rate
,
depth
,
samples_per_file
);
current_file
=
new
WavFileWriter
(
filename_template
,
qhb_version
,
num_channels
,
sample_rate
,
depth
,
samples_per_file
);
}
// write out as much as fits into the current file and move the pointer
size_t
missing
=
samples_per_file
-
current_file_samples_written
;
...
...
@@ -525,7 +525,7 @@ void SplitWavFileWriter::write(uint8_t *samples, size_t num_samples, uint8_t *im
// if there are samples left, write them to the current file
if
(
available
)
{
if
(
!
current_file
)
{
current_file
=
new
WavFileWriter
(
filename_template
,
num_channels
,
sample_rate
,
depth
,
samples_per_file
);
current_file
=
new
WavFileWriter
(
filename_template
,
qhb_version
,
num_channels
,
sample_rate
,
depth
,
samples_per_file
);
}
current_file
->
write
(
samples
,
available
*
num_channels
*
depth
,
imu_data
);
current_file_samples_written
+=
available
;
...
...
@@ -533,9 +533,9 @@ void SplitWavFileWriter::write(uint8_t *samples, size_t num_samples, uint8_t *im
}
SplitIMUWavFileWriter
::
SplitIMUWavFileWriter
(
std
::
string
&
filename_template
,
std
::
string
&
imu_name_template
,
SplitIMUWavFileWriter
::
SplitIMUWavFileWriter
(
std
::
string
&
filename_template
,
std
::
string
&
imu_name_template
,
size_t
qhb_version
,
size_t
num_channels
,
size_t
sample_rate
,
size_t
depth
,
size_t
samples_per_file
)
:
FileWriter
(
filename_template
,
num_channels
,
sample_rate
,
depth
),
FileWriter
(
filename_template
,
qhb_version
,
num_channels
,
sample_rate
,
depth
),
imu_name_template
(
imu_name_template
),
samples_per_file
(
samples_per_file
),
current_file
(
nullptr
),
...
...
@@ -559,14 +559,14 @@ void SplitIMUWavFileWriter::write(uint8_t *samples, size_t num_samples, uint8_t*
// start as many new files as required to write out the samples
while
(
current_file_samples_written
+
available
>=
samples_per_file
)
{
if
(
!
current_file
)
{
current_file
=
new
WavFileWriter
(
filename_template
,
num_channels
,
sample_rate
,
depth
,
samples_per_file
);
current_file
=
new
WavFileWriter
(
filename_template
,
qhb_version
,
num_channels
,
sample_rate
,
depth
,
samples_per_file
);
if
(
imu_file
)
{
max_timestamp
=
imu_file
->
get_last_timestamp
();
delete
imu_file
;
imu_file
=
new
IMUFileWriter
(
imu_name_template
,
num_channels
,
sample_rate
,
depth
,
max_timestamp
);
imu_file
=
new
IMUFileWriter
(
imu_name_template
,
qhb_version
,
num_channels
,
sample_rate
,
depth
,
max_timestamp
);
}
}
if
(
!
imu_file
)
imu_file
=
new
IMUFileWriter
(
imu_name_template
,
num_channels
,
sample_rate
,
depth
,
max_timestamp
);
if
(
!
imu_file
)
imu_file
=
new
IMUFileWriter
(
imu_name_template
,
qhb_version
,
num_channels
,
sample_rate
,
depth
,
max_timestamp
);
// write out as much as fits into the current file and move the pointer
size_t
missing
=
samples_per_file
-
current_file_samples_written
;
current_file
->
write
(
samples
,
missing
*
num_channels
*
depth
,
imu_data
);
...
...
@@ -585,14 +585,14 @@ void SplitIMUWavFileWriter::write(uint8_t *samples, size_t num_samples, uint8_t*
// if there are samples left, write them to the current file
if
(
available
)
{
if
(
!
current_file
)
{
current_file
=
new
WavFileWriter
(
filename_template
,
num_channels
,
sample_rate
,
depth
,
samples_per_file
);
current_file
=
new
WavFileWriter
(
filename_template
,
qhb_version
,
num_channels
,
sample_rate
,
depth
,
samples_per_file
);
if
(
imu_file
)
{
max_timestamp
=
imu_file
->
get_last_timestamp
();
delete
imu_file
;
imu_file
=
new
IMUFileWriter
(
imu_name_template
,
num_channels
,
sample_rate
,
depth
,
max_timestamp
);
imu_file
=
new
IMUFileWriter
(
imu_name_template
,
qhb_version
,
num_channels
,
sample_rate
,
depth
,
max_timestamp
);
}
}
if
(
!
imu_file
)
imu_file
=
new
IMUFileWriter
(
imu_name_template
,
num_channels
,
sample_rate
,
depth
,
max_timestamp
);
if
(
!
imu_file
)
imu_file
=
new
IMUFileWriter
(
imu_name_template
,
qhb_version
,
num_channels
,
sample_rate
,
depth
,
max_timestamp
);
current_file
->
write
(
samples
,
available
*
num_channels
*
depth
,
imu_data
);
if
(
imu_data
)
imu_file
->
write
(
samples
,
available
*
num_channels
*
depth
,
imu_data
);
imu_data
=
nullptr
;
...
...
This diff is collapsed.
Click to expand it.
src/filewriter.h
+
13
−
12
View file @
355429b0
...
...
@@ -29,13 +29,14 @@ protected:
std
::
string
generate_filename
();
// sample format options
size_t
qhb_version
;
size_t
num_channels
;
size_t
sample_rate
;
size_t
depth
;
public:
/** Abstract constructor to be used by subclasses.
*/
FileWriter
(
std
::
string
&
filename_template
,
size_t
num_channels
,
size_t
sample_rate
,
size_t
depth
);
FileWriter
(
std
::
string
&
filename_template
,
size_t
qhb_version
,
size_t
num_channels
,
size_t
sample_rate
,
size_t
depth
);
virtual
~
FileWriter
();
/** Writes out the given vector of 8-bit samples.
...
...
@@ -87,7 +88,7 @@ public:
* \param[in] depth The number of bytes per samples the
* sample data to be written will contain.
*/
WavFileWriter
(
std
::
string
&
filename_template
,
size_t
num_channels
,
size_t
sample_rate
,
size_t
depth
);
WavFileWriter
(
std
::
string
&
filename_template
,
size_t
qhb_version
,
size_t
num_channels
,
size_t
sample_rate
,
size_t
depth
);
/** Instantiates a wave file writer.
* \param[in] filename_template The name of the file to write to. Will be
* created or opened immediately, truncating any existing content. May
...
...
@@ -103,7 +104,7 @@ public:
* channel) that will be written. The file header will be written
* accordingly and not rewritten on closing the file if the number matches.
*/
WavFileWriter
(
std
::
string
&
filename_template
,
size_t
num_channels
,
size_t
sample_rate
,
size_t
depth
,
WavFileWriter
(
std
::
string
&
filename_template
,
size_t
qhb_version
,
size_t
num_channels
,
size_t
sample_rate
,
size_t
depth
,
size_t
expected_num_samples
);
~
WavFileWriter
()
override
;
...
...
@@ -135,7 +136,7 @@ public:
* \param[in] samples_per_file The target number of samples (per channel)
* that will be written to a file before starting the next one.
*/
SplitWavFileWriter
(
std
::
string
&
filename_template
,
size_t
num_channels
,
size_t
sample_rate
,
SplitWavFileWriter
(
std
::
string
&
filename_template
,
size_t
qhb_version
,
size_t
num_channels
,
size_t
sample_rate
,
size_t
depth
,
size_t
samples_per_file
);
~
SplitWavFileWriter
()
override
;
...
...
@@ -185,13 +186,13 @@ private:
};
std
::
ofstream
outfile
;
size_t
last_timestamp
;
unsigned
int
lastAccelTimeStamp
;
unsigned
int
lastGyroTimeStamp
;
unsigned
int
lastMagTimeStamp
;
unsigned
int
lastLightTimeStamp
;
size_t
last_timestamp
=
0
;
unsigned
int
lastAccelTimeStamp
=
0
;
unsigned
int
lastGyroTimeStamp
=
0
;
unsigned
int
lastMagTimeStamp
=
0
;
unsigned
int
lastLightTimeStamp
=
0
;
unsigned
int
lastPressureTimeStamp
=
0
;
unsigned
int
lastTemperatureTimeStamp
;
unsigned
int
lastTemperatureTimeStamp
=
0
;
unsigned
int
lastTimeStamp
=
0
;
DateTime
lastGPSDate
;
double
lastPPSTimeStampNS
;
...
...
@@ -236,7 +237,7 @@ public:
int
msgPayloadLength
,
const
unsigned
char
msgPayload
[]);
void
DecodeMessage
(
unsigned
char
c
);
IMUFileWriter
(
std
::
string
&
filename_template
,
size_t
num_channels
,
size_t
sample_rate
,
size_t
depth
,
size_t
timestamp
);
IMUFileWriter
(
std
::
string
&
filename_template
,
size_t
qhb_version
,
size_t
num_channels
,
size_t
sample_rate
,
size_t
depth
,
size_t
timestamp
);
void
write
(
uint8_t
*
samples
,
size_t
num_samples
,
uint8_t
*
imu_data
)
override
;
size_t
get_last_timestamp
();
};
...
...
@@ -268,7 +269,7 @@ public:
* \param[in] samples_per_file The target number of samples (per channel)
* that will be written to a file before starting the next one.
*/
SplitIMUWavFileWriter
(
std
::
string
&
filename_template
,
std
::
string
&
imu_name_template
,
size_t
num_channels
,
SplitIMUWavFileWriter
(
std
::
string
&
filename_template
,
std
::
string
&
imu_name_template
,
size_t
qhb_version
,
size_t
num_channels
,
size_t
sample_rate
,
size_t
depth
,
size_t
samples_per_file
);
~
SplitIMUWavFileWriter
()
override
;
...
...
This diff is collapsed.
Click to expand it.
src/main.cpp
+
30
−
16
View file @
355429b0
...
...
@@ -18,10 +18,11 @@ void print_usage(char *name) {
std
::
cout
<<
" v"
<<
JASONREC_VERSION
;
#endif
std
::
cout
<<
std
::
endl
;
std
::
cout
<<
"Usage: "
<<
name
<<
" channels rate filename [--help, -h] [--chunk_len, -c CHUNK_LEN] "
std
::
cout
<<
"Usage: "
<<
name
<<
"
qhbversion
channels rate filename [--help, -h] [--chunk_len, -c CHUNK_LEN] "
<<
"[--total_len, -t TOTAL_LEN] [--device, -d DEVICE] [--bit_depth, -b BIT_DEPTH] "
<<
"[--imu, -i IMU] [--filter, -f FILTER] [--verbose, -v]"
<<
std
::
endl
;
std
::
cout
<<
"Positional arguments:"
<<
std
::
endl
;
std
::
cout
<<
" QHB VERSION:
\t
version of the QHB audio card (2 or 3)"
<<
std
::
endl
;
std
::
cout
<<
" CHANNELS:
\t
number of channels to record (1 to 5)"
<<
std
::
endl
;
std
::
cout
<<
" RATE:
\t
sample rate in Hz to record at (integral number)"
<<
std
::
endl
;
std
::
cout
<<
" FILENAME:
\t
output file name. should include strftime() format specifiers"
<<
std
::
endl
;
...
...
@@ -41,8 +42,8 @@ void print_usage(char *name) {
std
::
cout
<<
" --verbose, -v
\t\t
Enable the printing of status message "
<<
std
::
endl
;
}
int
record
(
size_t
channels
,
size_t
rate
,
size_t
depth
,
size_t
filter
,
std
::
string
&
filename
,
std
::
string
&
imu_name
,
float
chunklen
,
float
totallen
,
size_t
device
,
bool
verbose
)
{
int
record
(
size_t
qhb_version
,
size_t
channels
,
size_t
rate
,
size_t
depth
,
size_t
filter
,
std
::
string
&
filename
,
std
::
string
&
imu_name
,
float
chunklen
,
float
totallen
,
size_t
device
,
bool
verbose
,
size_t
accelSamplingFrequency
,
size_t
gyroSamplingFrequency
,
size_t
magSamplingFrequency
,
size_t
accelRangeScale
,
size_t
gyroRangeScale
,
size_t
magRangeScale
)
{
JasonRecorder
recorder
=
JasonRecorder
(
verbose
);
std
::
cout
<<
"Found "
<<
recorder
.
get_device_count
()
<<
" JASON card(s)."
<<
std
::
endl
;
if
(
recorder
.
get_device_count
()
==
0
)
{
...
...
@@ -57,17 +58,17 @@ int record(size_t channels, size_t rate, size_t depth, size_t filter, std::stri
std
::
unique_ptr
<
FileWriter
>
filewriter
;
if
(
chunklen
>
0
&&
imu_name
.
empty
())
{
// implementation note: in C++14 we would use std::make_unique<SplitWavFileWriter>(...)
filewriter
.
reset
(
new
SplitWavFileWriter
(
filename
,
channels
,
rate
,
depth
,
chunklen
*
rate
));
filewriter
.
reset
(
new
SplitWavFileWriter
(
filename
,
qhb_version
,
channels
,
rate
,
depth
,
chunklen
*
rate
));
}
else
if
(
chunklen
>
0
)
{
// implementation note: in C++14 we would use std::make_unique<SplitWavFileWriter>(...)
filewriter
.
reset
(
new
SplitIMUWavFileWriter
(
filename
,
imu_name
,
channels
,
rate
,
depth
,
chunklen
*
rate
));
filewriter
.
reset
(
new
SplitIMUWavFileWriter
(
filename
,
imu_name
,
qhb_version
,
channels
,
rate
,
depth
,
chunklen
*
rate
));
}
else
if
(
imu_name
.
empty
()){
filewriter
.
reset
(
new
WavFileWriter
(
filename
,
channels
,
rate
,
depth
,
totallen
*
rate
));
filewriter
.
reset
(
new
WavFileWriter
(
filename
,
qhb_version
,
channels
,
rate
,
depth
,
totallen
*
rate
));
}
else
{
filewriter
.
reset
(
new
SplitIMUWavFileWriter
(
filename
,
imu_name
,
channels
,
rate
,
depth
,
totallen
*
rate
));
filewriter
.
reset
(
new
SplitIMUWavFileWriter
(
filename
,
imu_name
,
qhb_version
,
channels
,
rate
,
depth
,
totallen
*
rate
));
}
// start the recording loop
std
::
cout
<<
"Starting to record..."
<<
std
::
endl
;
...
...
@@ -80,7 +81,7 @@ int record(size_t channels, size_t rate, size_t depth, size_t filter, std::stri
std
::
vector
<
std
::
uint8_t
>
imu_data
;
try
{
std
::
cout
<<
"Setting recording format to "
<<
channels
<<
" channels at "
<<
rate
<<
" Hz "
<<
(
8
*
depth
)
<<
" bits"
<<
std
::
endl
;
recorder
.
start_recording
(
channels
,
rate
,
depth
,
filter
);
recorder
.
start_recording
(
qhb_version
,
channels
,
rate
,
depth
,
filter
,
accelSamplingFrequency
,
gyroSamplingFrequency
,
magSamplingFrequency
,
accelRangeScale
,
gyroRangeScale
,
magRangeScale
);
// we will record until we have enough (or forever, if totallen == 0)
while
((
total_samples_wanted
==
0
)
||
(
total_samples_read
<
total_samples_wanted
))
{
if
(
exit_requested
())
{
...
...
@@ -122,41 +123,54 @@ int record(size_t channels, size_t rate, size_t depth, size_t filter, std::stri
}
int
main
(
int
argc
,
char
*
argv
[])
{
if
(
argc
<
4
)
{
if
(
argc
<
5
)
{
print_usage
(
argv
[
0
]);
return
2
;
}
// parse command line options
int
qhb_version
;
try
{
qhb_version
=
std
::
stoi
(
argv
[
1
]);
if
((
qhb_version
<
2
)
||
(
qhb_version
>
3
))
{
std
::
cout
<<
"Error: QHBVERSION must be 2..3, got "
<<
qhb_version
<<
" instead. Version unsupported."
<<
std
::
endl
;
return
2
;}
}
catch
(
const
std
::
exception
&
e
)
{
std
::
cout
<<
"Error: Could not interpret "
<<
argv
[
1
]
<<
" as an integer."
<<
std
::
endl
;
return
2
;
}
int
num_channels
;
try
{
num_channels
=
std
::
stoi
(
argv
[
1
]);
num_channels
=
std
::
stoi
(
argv
[
2
]);
if
((
num_channels
<
1
)
||
(
num_channels
>
MAX_CHANNELS
))
{
std
::
cout
<<
"Error: CHANNELS must be in 1.."
<<
MAX_CHANNELS
<<
", got "
<<
num_channels
<<
" instead"
<<
std
::
endl
;
return
2
;}
}
catch
(
const
std
::
exception
&
e
)
{
std
::
cout
<<
"Error: Could not interpret "
<<
argv
[
1
]
<<
" as an integer."
<<
std
::
endl
;
std
::
cout
<<
"Error: Could not interpret "
<<
argv
[
2
]
<<
" as an integer."
<<
std
::
endl
;
return
2
;
}
int
rate
;
try
{
rate
=
std
::
stoi
(
argv
[
2
]);
rate
=
std
::
stoi
(
argv
[
3
]);
if
(
rate
!=
32000
&&
rate
!=
64000
&&
rate
!=
128000
&&
rate
!=
256000
&&
rate
!=
512000
)
{
std
::
cout
<<
"Error: RATE must be a power 2 times 32kHz, got "
<<
rate
<<
" instead"
<<
std
::
endl
;
return
2
;
}
}
catch
(
const
std
::
exception
&
e
)
{
std
::
cout
<<
"Error: Could not interpret "
<<
argv
[
2
]
<<
" as an integer."
<<
std
::
endl
;
std
::
cout
<<
"Error: Could not interpret "
<<
argv
[
3
]
<<
" as an integer."
<<
std
::
endl
;
return
2
;
}
std
::
string
filename
=
argv
[
3
];
std
::
string
filename
=
argv
[
4
];
int
i
=
4
;
int
i
=
5
;
int
device
(
0
),
bit_depth
(
16
),
filter
(
0
);
float
chunklen
(
0
),
totallen
(
0
);
float
accelSamplingFrequency
(
25
),
gyroSamplingFrequency
(
25
),
magSamplingFrequency
(
20
);
float
accelRangeScale
(
8
),
gyroRangeScale
(
250
),
magRangeScale
(
12
);
std
::
string
imu_name
;
bool
verbose
(
false
);
while
(
i
<
argc
){
...
...
@@ -212,5 +226,5 @@ int main(int argc, char *argv[]) {
i
++
;
}
// hand over to the recording function
return
record
(
num_channels
,
rate
,
bit_depth
/
8
,
filter
,
filename
,
imu_name
,
chunklen
,
totallen
,
device
,
verbose
);
return
record
(
qhb_version
,
num_channels
,
rate
,
bit_depth
/
8
,
filter
,
filename
,
imu_name
,
chunklen
,
totallen
,
device
,
verbose
,
accelSamplingFrequency
,
gyroSamplingFrequency
,
magSamplingFrequency
,
accelRangeScale
,
gyroRangeScale
,
magRangeScale
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment