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
e45ffc80
Commit
e45ffc80
authored
Dec 28, 2010
by
lm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed logging time base
parent
58a71b67
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
78 additions
and
24 deletions
+78
-24
MainWindow.cc
src/ui/MainWindow.cc
+0
-15
MainWindow.h
src/ui/MainWindow.h
+0
-2
QGCDataPlot2D.cc
src/ui/QGCDataPlot2D.cc
+7
-0
LinechartPlot.cc
src/ui/linechart/LinechartPlot.cc
+26
-1
LinechartPlot.h
src/ui/linechart/LinechartPlot.h
+4
-0
LinechartWidget.cc
src/ui/linechart/LinechartWidget.cc
+40
-6
LinechartWidget.h
src/ui/linechart/LinechartWidget.h
+1
-0
No files found.
src/ui/MainWindow.cc
View file @
e45ffc80
...
...
@@ -1375,23 +1375,8 @@ void MainWindow::loadWidgets()
//loadPilotView();
}
void
MainWindow
::
loadDataView
()
{
clearView
();
// DATAPLOT
if
(
dataplotWidget
)
{
QStackedWidget
*
centerStack
=
dynamic_cast
<
QStackedWidget
*>
(
centralWidget
());
if
(
centerStack
)
centerStack
->
setCurrentWidget
(
dataplotWidget
);
}
}
void
MainWindow
::
loadDataView
(
QString
fileName
)
{
clearView
();
// DATAPLOT
if
(
dataplotWidget
)
{
...
...
src/ui/MainWindow.h
View file @
e45ffc80
...
...
@@ -150,8 +150,6 @@ public slots:
void
loadWidgets
();
/** @brief Load data view, allowing to plot flight data */
void
loadDataView
();
/** @brief Load data view, allowing to plot flight data */
void
loadDataView
(
QString
fileName
);
...
...
src/ui/QGCDataPlot2D.cc
View file @
e45ffc80
...
...
@@ -126,6 +126,13 @@ void QGCDataPlot2D::savePlot()
fileName
=
QFileDialog
::
getSaveFileName
(
this
,
"Export File Name"
,
QDesktopServices
::
storageLocation
(
QDesktopServices
::
DesktopLocation
),
"PDF Documents (*.pdf);;SVG Images (*.svg)"
);
if
(
!
fileName
.
contains
(
"."
))
{
// .csv is default extension
fileName
.
append
(
".pdf"
);
}
while
(
!
(
fileName
.
endsWith
(
".svg"
)
||
fileName
.
endsWith
(
".pdf"
)))
{
QMessageBox
msgBox
;
...
...
src/ui/linechart/LinechartPlot.cc
View file @
e45ffc80
...
...
@@ -57,7 +57,7 @@ maxTime(QUINT64_MIN),
maxInterval
(
MAX_STORAGE_INTERVAL
),
timeScaleStep
(
DEFAULT_SCALE_INTERVAL
),
// 10 seconds
automaticScrollActive
(
false
),
m_active
(
tru
e
),
m_active
(
fals
e
),
m_groundTime
(
true
),
d_data
(
NULL
),
d_curve
(
NULL
)
...
...
@@ -286,6 +286,14 @@ void LinechartPlot::enforceGroundTime(bool enforce)
m_groundTime
=
enforce
;
}
/**
* @return True if the data points are stamped with the packet receive time
*/
bool
LinechartPlot
::
groundTime
()
{
return
m_groundTime
;
}
void
LinechartPlot
::
addCurve
(
QString
id
)
{
QColor
currentColor
=
getNextColor
();
...
...
@@ -468,6 +476,23 @@ bool LinechartPlot::isVisible(QString id)
return
curves
.
value
(
id
)
->
isVisible
();
}
/**
* @return The visibility, true if it is visible, false otherwise
**/
bool
LinechartPlot
::
anyCurveVisible
()
{
bool
visible
=
false
;
foreach
(
QString
key
,
curves
.
keys
())
{
if
(
curves
.
value
(
key
)
->
isVisible
())
{
visible
=
true
;
}
}
return
visible
;
}
/**
* @brief Allows to block interference of the automatic scrolling with user interaction
* When the plot is updated very fast (at 1 ms for example) with new data, it might
...
...
src/ui/linechart/LinechartPlot.h
View file @
e45ffc80
...
...
@@ -190,6 +190,8 @@ public:
QList
<
QwtPlotCurve
*>
getCurves
();
bool
isVisible
(
QString
id
);
/** @brief Check if any curve is visible */
bool
anyCurveVisible
();
int
getPlotId
();
/** @brief Get the number of values to average over */
...
...
@@ -243,6 +245,8 @@ public slots:
/** @brief Enforce the use of the receive timestamp */
void
enforceGroundTime
(
bool
enforce
);
/** @brief Check if the receive timestamp is enforced */
bool
groundTime
();
// General interaction
void
setWindowPosition
(
quint64
end
);
...
...
src/ui/linechart/LinechartWidget.cc
View file @
e45ffc80
...
...
@@ -48,6 +48,7 @@ This file is part of the PIXHAWK project
#include "LinechartWidget.h"
#include "LinechartPlot.h"
#include "LogCompressor.h"
#include "QGC.h"
#include "MG.h"
...
...
@@ -225,7 +226,18 @@ void LinechartWidget::appendData(int uasId, QString curve, double value, quint64
{
if
(
activePlot
->
isVisible
(
curve
))
{
logFile
->
write
(
QString
(
QString
::
number
(
usec
)
+
"
\t
"
+
QString
::
number
(
uasId
)
+
"
\t
"
+
curve
+
"
\t
"
+
QString
::
number
(
value
)
+
"
\n
"
).
toLatin1
());
quint64
time
=
0
;
// Adjust time
if
(
activePlot
->
groundTime
())
{
time
=
QGC
::
groundTimeUsecs
()
-
logStartTime
;
}
else
{
time
=
usec
-
logStartTime
;
}
logFile
->
write
(
QString
(
QString
::
number
(
time
)
+
"
\t
"
+
QString
::
number
(
uasId
)
+
"
\t
"
+
curve
+
"
\t
"
+
QString
::
number
(
value
)
+
"
\n
"
).
toLatin1
());
logFile
->
flush
();
}
}
...
...
@@ -261,14 +273,35 @@ void LinechartWidget::refresh()
void
LinechartWidget
::
startLogging
()
{
// Let user select the log file name
QDate
date
(
QDate
::
currentDate
());
// QString("./pixhawk-log-" + date.toString("yyyy-MM-dd") + "-" + QString::number(logindex) + ".log")
QString
fileName
=
QFileDialog
::
getSaveFileName
(
this
,
tr
(
"Specify log file name"
),
QDesktopServices
::
storageLocation
(
QDesktopServices
::
DesktopLocation
),
tr
(
"Logfile (*.txt, *.csv);;"
));
// Store reference to file
// Append correct file ending if needed
bool
abort
=
false
;
while
(
!
(
fileName
.
endsWith
(
".txt"
)
||
fileName
.
endsWith
(
".csv"
)))
// Check if any curve is enabled
if
(
!
activePlot
->
anyCurveVisible
())
{
QMessageBox
msgBox
;
msgBox
.
setIcon
(
QMessageBox
::
Critical
);
msgBox
.
setText
(
"No curves selected for logging."
);
msgBox
.
setInformativeText
(
"Please check all curves you want to log. Currently no data would be logged, aborting the logging."
);
msgBox
.
setStandardButtons
(
QMessageBox
::
Ok
);
msgBox
.
setDefaultButton
(
QMessageBox
::
Ok
);
msgBox
.
exec
();
return
;
}
// Let user select the log file name
QDate
date
(
QDate
::
currentDate
());
// QString("./pixhawk-log-" + date.toString("yyyy-MM-dd") + "-" + QString::number(logindex) + ".log")
QString
fileName
=
QFileDialog
::
getSaveFileName
(
this
,
tr
(
"Specify log file name"
),
QDesktopServices
::
storageLocation
(
QDesktopServices
::
DesktopLocation
),
tr
(
"Logfile (*.csv, *.txt);;"
));
if
(
!
fileName
.
contains
(
"."
))
{
// .csv is default extension
fileName
.
append
(
".csv"
);
}
while
(
!
(
fileName
.
endsWith
(
".txt"
)
||
fileName
.
endsWith
(
".csv"
))
&&
!
abort
)
{
QMessageBox
msgBox
;
msgBox
.
setIcon
(
QMessageBox
::
Critical
);
...
...
@@ -292,6 +325,7 @@ void LinechartWidget::startLogging()
if
(
logFile
->
open
(
QIODevice
::
WriteOnly
|
QIODevice
::
Text
))
{
logging
=
true
;
logStartTime
=
QGC
::
groundTimeUsecs
();
logindex
++
;
logButton
->
setText
(
tr
(
"Stop logging"
));
disconnect
(
logButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
startLogging
()));
...
...
src/ui/linechart/LinechartWidget.h
View file @
e45ffc80
...
...
@@ -131,6 +131,7 @@ protected:
bool
logging
;
QTimer
*
updateTimer
;
LogCompressor
*
compressor
;
quint64
logStartTime
;
static
const
int
MAX_CURVE_MENUITEM_NUMBER
=
8
;
static
const
int
PAGESTEP_TIME_SCROLLBAR_VALUE
=
(
MAX_TIME_SCROLLBAR_VALUE
-
MIN_TIME_SCROLLBAR_VALUE
)
/
10
;
...
...
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