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
05dc22fc
Commit
05dc22fc
authored
Jul 03, 2011
by
lm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Working towards working maps without runtime issues
parent
93715738
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
124 additions
and
70 deletions
+124
-70
UASManager.cc
src/uas/UASManager.cc
+7
-2
UASManager.h
src/uas/UASManager.h
+1
-1
UASWaypointManager.cc
src/uas/UASWaypointManager.cc
+18
-0
UASWaypointManager.h
src/uas/UASWaypointManager.h
+1
-0
MainWindow.cc
src/ui/MainWindow.cc
+9
-2
MainWindow.h
src/ui/MainWindow.h
+8
-0
UASView.cc
src/ui/uas/UASView.cc
+78
-64
UASView.h
src/ui/uas/UASView.h
+2
-1
No files found.
src/uas/UASManager.cc
View file @
05dc22fc
...
...
@@ -73,10 +73,12 @@ void UASManager::loadSettings()
settings
.
endGroup
();
}
void
UASManager
::
setHomePosition
(
double
lat
,
double
lon
,
double
alt
)
bool
UASManager
::
setHomePosition
(
double
lat
,
double
lon
,
double
alt
)
{
// Checking for NaN and infitiny
if
(
lat
==
lat
&&
lon
==
lon
&&
alt
==
alt
&&
!
std
::
isinf
(
lat
)
&&
!
std
::
isinf
(
lon
)
&&
!
std
::
isinf
(
alt
))
{
if
(
lat
==
lat
&&
lon
==
lon
&&
alt
==
alt
&&
!
std
::
isinf
(
lat
)
&&
!
std
::
isinf
(
lon
)
&&
!
std
::
isinf
(
alt
)
&&
lat
<=
90.0
&&
lat
>=
-
90.0
&&
lon
<=
180.0
&&
lon
>=
-
180.0
)
{
bool
changed
=
false
;
if
(
homeLat
!=
lat
)
changed
=
true
;
if
(
homeLon
!=
lon
)
changed
=
true
;
...
...
@@ -87,6 +89,9 @@ void UASManager::setHomePosition(double lat, double lon, double alt)
homeAlt
=
alt
;
if
(
changed
)
emit
homePositionChanged
(
homeLat
,
homeLon
,
homeAlt
);
return
true
;
}
else
{
return
false
;
}
}
...
...
src/uas/UASManager.h
View file @
05dc22fc
...
...
@@ -175,7 +175,7 @@ public slots:
bool
shutdownActiveUAS
();
/** @brief Set the current home position */
void
setHomePosition
(
double
lat
,
double
lon
,
double
alt
);
bool
setHomePosition
(
double
lat
,
double
lon
,
double
alt
);
/** @brief Load settings */
void
loadSettings
();
...
...
src/uas/UASWaypointManager.cc
View file @
05dc22fc
...
...
@@ -273,7 +273,9 @@ int UASWaypointManager::setCurrentWaypoint(quint16 seq)
}
/**
* @warning Make sure the waypoint stays valid for the whole application lifecycle!
* @param enforceFirstActive Enforces that the first waypoint is set as active
* @see createWaypoint() is more suitable for most use cases
*/
void
UASWaypointManager
::
addWaypoint
(
Waypoint
*
wp
,
bool
enforceFirstActive
)
{
...
...
@@ -288,6 +290,22 @@ void UASWaypointManager::addWaypoint(Waypoint *wp, bool enforceFirstActive)
}
}
/**
* @param enforceFirstActive Enforces that the first waypoint is set as active
*/
Waypoint
*
UASWaypointManager
::
createWaypoint
(
bool
enforceFirstActive
)
{
Waypoint
*
wp
=
new
Waypoint
();
wp
->
setId
(
waypoints
.
size
());
if
(
enforceFirstActive
&&
waypoints
.
size
()
==
0
)
wp
->
setCurrent
(
true
);
waypoints
.
insert
(
waypoints
.
size
(),
wp
);
connect
(
wp
,
SIGNAL
(
changed
(
Waypoint
*
)),
this
,
SLOT
(
notifyOfChange
(
Waypoint
*
)));
emit
waypointListChanged
();
emit
waypointListChanged
(
uas
.
getUASID
());
return
wp
;
}
int
UASWaypointManager
::
removeWaypoint
(
quint16
seq
)
{
if
(
seq
<
waypoints
.
size
())
{
...
...
src/uas/UASWaypointManager.h
View file @
05dc22fc
...
...
@@ -128,6 +128,7 @@ public slots:
/** @name Waypoint list operations */
/*@{*/
void
addWaypoint
(
Waypoint
*
wp
,
bool
enforceFirstActive
=
true
);
///< adds a new waypoint to the end of the list and changes its sequence number accordingly
Waypoint
*
createWaypoint
(
bool
enforceFirstActive
=
true
);
///< Creates a waypoint
int
removeWaypoint
(
quint16
seq
);
///< locally remove the specified waypoint from the storage
void
moveWaypoint
(
quint16
cur_seq
,
quint16
new_seq
);
///< locally move a waypoint from its current position cur_seq to a new position new_seq
void
saveWaypoints
(
const
QString
&
saveFile
);
///< saves the local waypoint list to saveFile
...
...
src/ui/MainWindow.cc
View file @
05dc22fc
...
...
@@ -70,7 +70,8 @@ MainWindow::MainWindow(QWidget *parent):
changingViewsFlag
(
false
),
styleFileName
(
QCoreApplication
::
applicationDirPath
()
+
"/style-indoor.css"
),
autoReconnect
(
false
),
currentStyle
(
QGC_MAINWINDOW_STYLE_INDOOR
)
currentStyle
(
QGC_MAINWINDOW_STYLE_INDOOR
),
lowPowerMode
(
false
)
{
loadSettings
();
if
(
!
settings
.
contains
(
"CURRENT_VIEW"
))
{
...
...
@@ -163,6 +164,9 @@ MainWindow::MainWindow(QWidget *parent):
link
->
connect
();
}
// Set low power mode
enableLowPowerMode
(
lowPowerMode
);
// Initialize window state
windowStateVal
=
windowState
();
}
...
...
@@ -1048,6 +1052,7 @@ void MainWindow::loadSettings()
settings
.
beginGroup
(
"QGC_MAINWINDOW"
);
autoReconnect
=
settings
.
value
(
"AUTO_RECONNECT"
,
autoReconnect
).
toBool
();
currentStyle
=
(
QGC_MAINWINDOW_STYLE
)
settings
.
value
(
"CURRENT_STYLE"
,
currentStyle
).
toInt
();
lowPowerMode
=
settings
.
value
(
"LOW_POWER_MODE"
,
lowPowerMode
).
toBool
();
settings
.
endGroup
();
}
...
...
@@ -1065,6 +1070,8 @@ void MainWindow::storeSettings()
if
(
UASManager
::
instance
()
->
getUASList
().
length
()
>
0
)
settings
.
setValue
(
getWindowStateKey
(),
saveState
(
QGC
::
applicationVersion
()));
// Save the current view only if a UAS is connected
if
(
UASManager
::
instance
()
->
getUASList
().
length
()
>
0
)
settings
.
setValue
(
"CURRENT_VIEW_WITH_UAS_CONNECTED"
,
currentView
);
// Save the current power mode
settings
.
setValue
(
"LOW_POWER_MODE"
,
lowPowerMode
);
settings
.
sync
();
}
...
...
@@ -1886,7 +1893,7 @@ void MainWindow::presentView()
}
}
// ACTIVATE
MAP
WIDGET
// ACTIVATE
HUD
WIDGET
if
(
headUpDockWidget
)
{
HUD
*
tmpHud
=
dynamic_cast
<
HUD
*>
(
headUpDockWidget
->
widget
()
);
if
(
tmpHud
)
{
...
...
src/ui/MainWindow.h
View file @
05dc22fc
...
...
@@ -103,6 +103,11 @@ public:
return
autoReconnect
;
}
/** @brief Get low power mode setting */
bool
lowPowerModeEnabled
()
{
return
lowPowerMode
;
}
public
slots
:
// /** @brief Store the mainwindow settings */
// void storeSettings();
...
...
@@ -160,6 +165,8 @@ public slots:
void
selectStylesheet
();
/** @brief Automatically reconnect last link */
void
enableAutoReconnect
(
bool
enabled
);
/** @brief Save power by reducing update rates */
void
enableLowPowerMode
(
bool
enabled
)
{
lowPowerMode
=
enabled
;
}
/** @brief Switch to native application style */
void
loadNativeStyle
();
/** @brief Switch to indoor mission style */
...
...
@@ -430,6 +437,7 @@ protected:
bool
autoReconnect
;
QGC_MAINWINDOW_STYLE
currentStyle
;
Qt
::
WindowStates
windowStateVal
;
bool
lowPowerMode
;
///< If enabled, QGC reduces the update rates of all widgets
private:
Ui
::
MainWindow
ui
;
...
...
src/ui/uas/UASView.cc
View file @
05dc22fc
...
...
@@ -39,6 +39,7 @@ This file is part of the PIXHAWK project
#include "UASManager.h"
#include "UASView.h"
#include "UASWaypointManager.h"
#include "MainWindow.h"
#include "ui_UASView.h"
UASView
::
UASView
(
UASInterface
*
uas
,
QWidget
*
parent
)
:
...
...
@@ -69,8 +70,13 @@ UASView::UASView(UASInterface* uas, QWidget *parent) :
selectAction
(
new
QAction
(
"Control this system"
,
this
)),
selectAirframeAction
(
new
QAction
(
"Choose Airframe"
,
this
)),
setBatterySpecsAction
(
new
QAction
(
"Set Battery Options"
,
this
)),
lowPowerModeEnabled
(
false
),
m_ui
(
new
Ui
::
UASView
)
{
// FIXME XXX
lowPowerModeEnabled
=
MainWindow
::
instance
()
->
lowPowerModeEnabled
();
m_ui
->
setupUi
(
this
);
// Setup communication
...
...
@@ -129,7 +135,12 @@ UASView::UASView(UASInterface* uas, QWidget *parent) :
// Heartbeat fade
refreshTimer
=
new
QTimer
(
this
);
connect
(
refreshTimer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
refresh
()));
if
(
lowPowerModeEnabled
)
{
refreshTimer
->
start
(
updateInterval
*
10
);
}
else
{
refreshTimer
->
start
(
updateInterval
);
}
// Hide kill and shutdown buttons per default
m_ui
->
killButton
->
hide
();
...
...
@@ -248,7 +259,7 @@ void UASView::showEvent(QShowEvent* event)
// React only to internal (pre-display)
// events
Q_UNUSED
(
event
);
refreshTimer
->
start
(
updateInterval
);
refreshTimer
->
start
(
updateInterval
*
10
);
}
void
UASView
::
hideEvent
(
QHideEvent
*
event
)
...
...
@@ -591,6 +602,8 @@ void UASView::refresh()
}
iconIsRed
=
!
iconIsRed
;
}
else
{
if
(
!
lowPowerModeEnabled
)
{
// Fade heartbeat icon
// Make color darker
heartbeatColor
=
heartbeatColor
.
darker
(
150
);
...
...
@@ -598,6 +611,7 @@ void UASView::refresh()
//m_ui->heartbeatIcon->setAutoFillBackground(true);
m_ui
->
heartbeatIcon
->
setStyleSheet
(
colorstyle
.
arg
(
heartbeatColor
.
name
()));
}
}
//setUpdatesEnabled(true);
//setUpdatesEnabled(false);
...
...
src/ui/uas/UASView.h
View file @
05dc22fc
...
...
@@ -122,7 +122,8 @@ protected:
QAction
*
selectAction
;
QAction
*
selectAirframeAction
;
QAction
*
setBatterySpecsAction
;
static
const
int
updateInterval
=
300
;
static
const
int
updateInterval
=
700
;
bool
lowPowerModeEnabled
;
///< Low power mode reduces update rates
void
mouseDoubleClickEvent
(
QMouseEvent
*
event
);
...
...
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