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
e1cd6a87
Commit
e1cd6a87
authored
Jan 20, 2020
by
Valentin Platzgummer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugs solved
parent
6cda7cf4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
104 additions
and
8 deletions
+104
-8
WimaController.cc
src/Wima/WimaController.cc
+104
-7
WimaController.h
src/Wima/WimaController.h
+0
-1
No files found.
src/Wima/WimaController.cc
View file @
e1cd6a87
...
...
@@ -440,7 +440,8 @@ bool WimaController::extractCoordinateList(QmlObjectListModel &missionItems, QVa
for
(
int
i
=
0
;
i
<
geoCoordintateList
.
size
();
i
++
)
{
QGeoCoordinate
vertex
=
geoCoordintateList
[
i
];
if
(
qFuzzyIsNull
(
vertex
.
latitude
())
&&
qFuzzyIsNull
(
vertex
.
longitude
()))
if
(
(
qFuzzyIsNull
(
vertex
.
latitude
())
&&
qFuzzyIsNull
(
vertex
.
longitude
()))
||
!
vertex
.
isValid
())
geoCoordintateList
.
removeAt
(
i
);
}
...
...
@@ -691,6 +692,16 @@ bool WimaController::calcNextPhase()
}
settingsItem
->
setCoordinate
(
_takeoffLandPostion
);
// qDebug("homeposition");
// for (int i = 0; i < missionControllerVisuals->count(); ++i) {
// VisualMissionItem *item = missionControllerVisuals->value<VisualMissionItem*>(i);
// if (item != nullptr) {
// qDebug() << item->coordinate();
// } else {
// qDebug("Error");
// }
// }
// set takeoff position for first mission item (bug)
missionController
()
->
insertSimpleMissionItem
(
_takeoffLandPostion
,
1
);
SimpleMissionItem
*
takeoffItem
=
missionControllerVisuals
->
value
<
SimpleMissionItem
*>
(
1
);
...
...
@@ -700,6 +711,16 @@ bool WimaController::calcNextPhase()
}
takeoffItem
->
setCoordinate
(
_takeoffLandPostion
);
// qDebug("takeoff");
// for (int i = 0; i < missionControllerVisuals->count(); ++i) {
// VisualMissionItem *item = missionControllerVisuals->value<VisualMissionItem*>(i);
// if (item != nullptr) {
// qDebug() << item->coordinate();
// } else {
// qDebug("Error");
// }
// }
// create change speed item, after take off
_missionController
->
insertSimpleMissionItem
(
_takeoffLandPostion
,
2
);
SimpleMissionItem
*
speedItem
=
missionControllerVisuals
->
value
<
SimpleMissionItem
*>
(
2
);
...
...
@@ -707,14 +728,34 @@ bool WimaController::calcNextPhase()
qWarning
(
"WimaController::calcNextPhase(): nullptr"
);
return
false
;
}
speedItem
->
setCommand
(
MAV_CMD_DO_CHANGE_SPEED
);
// set coordinate must be after setCommand (setCommand sets coordinate to zero)
speedItem
->
setCoordinate
(
_takeoffLandPostion
);
speedItem
->
setCommand
(
MAV_CMD_DO_CHANGE_SPEED
);
speedItem
->
missionItem
().
setParam2
(
_arrivalReturnSpeed
.
rawValue
().
toDouble
());
// qDebug("speed");
// for (int i = 0; i < missionControllerVisuals->count(); ++i) {
// VisualMissionItem *item = missionControllerVisuals->value<VisualMissionItem*>(i);
// if (item != nullptr) {
// qDebug() << item->coordinate();
// } else {
// qDebug("Error");
// }
// }
// insert arrival path
for
(
auto
coordinate
:
arrivalPath
)
_missionController
->
insertSimpleMissionItem
(
coordinate
,
missionControllerVisuals
->
count
());
// qDebug("arrival");
// for (int i = 0; i < missionControllerVisuals->count(); ++i) {
// VisualMissionItem *item = missionControllerVisuals->value<VisualMissionItem*>(i);
// if (item != nullptr) {
// qDebug() << item->coordinate();
// } else {
// qDebug("Error");
// }
// }
// create change speed item, after arrival path
int
index
=
missionControllerVisuals
->
count
();
_missionController
->
insertSimpleMissionItem
(
CSWpList
.
first
(),
index
);
...
...
@@ -723,14 +764,34 @@ bool WimaController::calcNextPhase()
qWarning
(
"WimaController::calcNextPhase(): nullptr"
);
return
false
;
}
speedItem
->
setCommand
(
MAV_CMD_DO_CHANGE_SPEED
);
// set coordinate must be after setCommand (setCommand sets coordinate to zero)
speedItem
->
setCoordinate
(
CSWpList
.
first
());
speedItem
->
setCommand
(
MAV_CMD_DO_CHANGE_SPEED
);
speedItem
->
missionItem
().
setParam2
(
_flightSpeed
.
rawValue
().
toDouble
());
// qDebug("speed");
// for (int i = 0; i < missionControllerVisuals->count(); ++i) {
// VisualMissionItem *item = missionControllerVisuals->value<VisualMissionItem*>(i);
// if (item != nullptr) {
// qDebug() << item->coordinate();
// } else {
// qDebug("Error");
// }
// }
// insert Circular Survey coordinates
for
(
auto
coordinate
:
CSWpList
)
_missionController
->
insertSimpleMissionItem
(
coordinate
,
missionControllerVisuals
->
count
());
// qDebug("survey");
// for (int i = 0; i < missionControllerVisuals->count(); ++i) {
// VisualMissionItem *item = missionControllerVisuals->value<VisualMissionItem*>(i);
// if (item != nullptr) {
// qDebug() << item->coordinate();
// } else {
// qDebug("Error");
// }
// }
// create change speed item, after circular survey
index
=
missionControllerVisuals
->
count
();
_missionController
->
insertSimpleMissionItem
(
CSWpList
.
last
(),
index
);
...
...
@@ -739,14 +800,34 @@ bool WimaController::calcNextPhase()
qWarning
(
"WimaController::calcNextPhase(): nullptr"
);
return
false
;
}
speedItem
->
setCo
ordinate
(
_takeoffLandPostion
);
speedItem
->
setCo
mmand
(
MAV_CMD_DO_CHANGE_SPEED
);
speedItem
->
setCo
mmand
(
MAV_CMD_DO_CHANGE_SPEED
);
// set coordinate must be after setCommand (setCommand sets coordinate to zero)
speedItem
->
setCo
ordinate
(
CSWpList
.
last
()
);
speedItem
->
missionItem
().
setParam2
(
_arrivalReturnSpeed
.
rawValue
().
toDouble
());
// qDebug("speed");
// for (int i = 0; i < missionControllerVisuals->count(); ++i) {
// VisualMissionItem *item = missionControllerVisuals->value<VisualMissionItem*>(i);
// if (item != nullptr) {
// qDebug() << item->coordinate();
// } else {
// qDebug("Error");
// }
// }
// insert return path coordinates
for
(
auto
coordinate
:
returnPath
)
_missionController
->
insertSimpleMissionItem
(
coordinate
,
missionControllerVisuals
->
count
());
// qDebug("return path");
// for (int i = 0; i < missionControllerVisuals->count(); ++i) {
// VisualMissionItem *item = missionControllerVisuals->value<VisualMissionItem*>(i);
// if (item != nullptr) {
// qDebug() << item->coordinate();
// } else {
// qDebug("Error");
// }
// }
// set land command for last mission item
index
=
missionControllerVisuals
->
count
();
_missionController
->
insertSimpleMissionItem
(
_takeoffLandPostion
,
index
);
...
...
@@ -757,6 +838,16 @@ bool WimaController::calcNextPhase()
}
_missionController
->
setLandCommand
(
*
landItem
);
// qDebug("land");
// for (int i = 0; i < missionControllerVisuals->count(); ++i) {
// VisualMissionItem *item = missionControllerVisuals->value<VisualMissionItem*>(i);
// if (item != nullptr) {
// qDebug() << item->coordinate();
// } else {
// qDebug("Error");
// }
// }
// copy to _currentMissionItems
for
(
int
i
=
1
;
i
<
missionControllerVisuals
->
count
();
i
++
)
{
SimpleMissionItem
*
visualItem
=
missionControllerVisuals
->
value
<
SimpleMissionItem
*>
(
i
);
...
...
@@ -880,6 +971,8 @@ void WimaController::checkBatteryLevel()
WimaSettings
*
wimaSettings
=
qgcApp
()
->
toolbox
()
->
settingsManager
()
->
wimaSettings
();
int
batteryThreshold
=
wimaSettings
->
lowBatteryThreshold
()
->
rawValue
().
toInt
();
static
long
attemptCounter
=
0
;
if
(
managerVehicle
!=
nullptr
)
{
Fact
*
battery1percentRemaining
=
managerVehicle
->
battery1FactGroup
()
->
getFact
(
VehicleBatteryFactGroup
::
_percentRemainingFactName
);
Fact
*
battery2percentRemaining
=
managerVehicle
->
battery2FactGroup
()
->
getFact
(
VehicleBatteryFactGroup
::
_percentRemainingFactName
);
...
...
@@ -890,10 +983,14 @@ void WimaController::checkBatteryLevel()
_setVehicleHasLowBattery
(
true
);
if
(
!
_lowBatteryHandlingTriggered
)
{
QString
errorString
;
attemptCounter
++
;
if
(
attemptCounter
>
3
)
{
_lowBatteryHandlingTriggered
=
true
;
attemptCounter
=
0
;
}
if
(
_checkSmartRTLPreCondition
(
errorString
)
==
true
)
{
managerVehicle
->
pauseVehicle
();
if
(
_calcReturnPath
(
errorString
))
{
_lowBatteryHandlingTriggered
=
true
;
if
(
_calcReturnPath
(
errorString
))
{
emit
returnBatteryLowConfirmRequired
();
}
else
{
qgcApp
()
->
showMessage
(
tr
(
"Battery level is low. Smart RTL not possible."
));
...
...
src/Wima/WimaController.h
View file @
e1cd6a87
...
...
@@ -240,7 +240,6 @@ private:
bool
_lowBatteryHandlingTriggered
;
bool
_executingSmartRTL
;
};
/*
...
...
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