Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
105d1d6c
Commit
105d1d6c
authored
Nov 08, 2012
by
Lorenz Meier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed zero order hold for logging
parent
da1218a2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
13 deletions
+41
-13
LogCompressor.cc
src/LogCompressor.cc
+41
-13
No files found.
src/LogCompressor.cc
View file @
105d1d6c
...
...
@@ -107,9 +107,10 @@ void LogCompressor::run()
QString
headerLine
=
"timestamp_ms"
+
delimiter
+
headerList
.
join
(
delimiter
)
+
"
\n
"
;
// Clean header names from symbols Matlab considers as Latex syntax
headerLine
=
headerLine
.
replace
(
":"
,
"-"
);
headerLine
=
headerLine
.
replace
(
"_"
,
"-"
);
headerLine
=
headerLine
.
replace
(
"."
,
"-"
);
headerLine
=
headerLine
.
replace
(
"timestamp"
,
"TIMESTAMP"
);
headerLine
=
headerLine
.
replace
(
":"
,
""
);
headerLine
=
headerLine
.
replace
(
"_"
,
""
);
headerLine
=
headerLine
.
replace
(
"."
,
""
);
outTmpFile
.
write
(
headerLine
.
toLocal8Bit
());
emit
logProcessingStatusChanged
(
tr
(
"Log compressor: Dataset contains dimensions: "
)
+
headerLine
);
...
...
@@ -121,22 +122,32 @@ void LogCompressor::run()
}
// Reset our position in the input file before we start the main processing loop.
in
.
seek
(
0
);
QMap
<
quint64
,
QStringList
>
timestampMap
;
while
(
!
in
.
atEnd
())
{
quint64
timestamp
=
in
.
readLine
().
split
(
delimiter
).
at
(
0
).
toULongLong
();
timestampMap
.
insert
(
timestamp
,
templateList
);
}
// // Reset our position in the input file before we start the main processing loop.
// in.seek(0);
// // Search through all lines and build a list of unique timestamps
// QMap<quint64, QStringList> timestampMap;
// while (!in.atEnd()) {
// quint64 timestamp = in.readLine().split(delimiter).at(0).toULongLong();
// timestampMap.insert(timestamp, templateList);
// }
// Jump back to start of file
in
.
seek
(
0
);
// Map of final output lines, key is time
QMap
<
quint64
,
QStringList
>
timestampMap
;
// Run through the whole file and fill map of timestamps
while
(
!
in
.
atEnd
())
{
QStringList
newLine
=
in
.
readLine
().
split
(
delimiter
);
quint64
timestamp
=
newLine
.
at
(
0
).
toULongLong
();
// Check if timestamp does exist - if not, add it
if
(
!
timestampMap
.
contains
(
timestamp
))
{
timestampMap
.
insert
(
timestamp
,
templateList
);
}
QStringList
list
=
timestampMap
.
value
(
timestamp
);
QString
currentDataName
=
newLine
.
at
(
2
);
...
...
@@ -147,13 +158,30 @@ void LogCompressor::run()
int
lineCounter
=
0
;
QStringList
lastList
=
timestampMap
.
values
().
at
(
1
);
foreach
(
QStringList
list
,
timestampMap
.
values
())
{
// Write this current time set out to the file
// only do so from the 2nd line on, since the first
// line could be incomplete
if
(
lineCounter
>
0
)
{
if
(
lineCounter
>
1
)
{
// Set the timestamp
list
.
replace
(
0
,
QString
(
"%1"
).
arg
(
timestampMap
.
keys
().
at
(
lineCounter
)));
// Fill holes if necessary
if
(
holeFillingEnabled
)
{
int
index
=
0
;
foreach
(
QString
str
,
list
)
{
if
(
str
==
""
||
str
==
"NaN"
)
{
list
.
replace
(
index
,
lastList
.
at
(
index
));
}
index
++
;
}
}
// Set last list
lastList
=
list
;
// Write data columns
QString
output
=
list
.
join
(
delimiter
)
+
"
\n
"
;
outTmpFile
.
write
(
output
.
toLocal8Bit
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment