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
a0e0f804
Commit
a0e0f804
authored
Oct 14, 2020
by
Valentin Platzgummer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wima planer update improved, wima flight view menu edited.
parent
65210eff
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
356 additions
and
294 deletions
+356
-294
FlightDisplayWimaMenu.qml
src/FlightDisplay/FlightDisplayWimaMenu.qml
+3
-147
CircularSurveyItemEditor.qml
src/PlanView/CircularSurveyItemEditor.qml
+4
-53
CircularSurvey.cc
src/Wima/CircularSurvey.cc
+6
-0
StateMachine.cpp
src/Wima/StateMachine.cpp
+119
-16
StateMachine.h
src/Wima/StateMachine.h
+10
-1
WimaPlaner.cc
src/Wima/WimaPlaner.cc
+157
-50
WimaPlaner.h
src/Wima/WimaPlaner.h
+17
-2
WimaToolBar.qml
src/WimaView/WimaToolBar.qml
+40
-25
No files found.
src/FlightDisplay/FlightDisplayWimaMenu.qml
View file @
a0e0f804
...
@@ -46,8 +46,6 @@ Item {
...
@@ -46,8 +46,6 @@ Item {
// Use Settings to store menu appearance through different sessions.
// Use Settings to store menu appearance through different sessions.
Settings
{
Settings
{
property
alias
missionHeaderChecker
:
missionHeader
.
checked
property
alias
navigateHeaderChecker
:
navigateHeader
.
checked
property
alias
vehicleHeaderChecker
:
vehicleHeader
.
checked
property
alias
vehicleHeaderChecker
:
vehicleHeader
.
checked
property
alias
statsHeaderChecker
:
statsHeader
.
checked
property
alias
statsHeaderChecker
:
statsHeader
.
checked
}
}
...
@@ -173,124 +171,11 @@ Item {
...
@@ -173,124 +171,11 @@ Item {
id
:
mainColumn
id
:
mainColumn
spacing
:
ScreenTools
.
defaultFontPixelHeight
*
0.3
spacing
:
ScreenTools
.
defaultFontPixelHeight
*
0.3
SectionHeader
{
id
:
missionHeader
text
:
qsTr
(
"
Phase Settings
"
)
}
GridLayout
{
columns
:
2
rowSpacing
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
columnSpacing
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
visible
:
missionHeader
.
checked
QGCLabel
{
text
:
qsTr
(
"
Next Waypoint
"
)
Layout.fillWidth
:
true
}
FactTextField
{
fact
:
wimaController
.
startWaypointIndex
Layout.fillWidth
:
true
}
QGCLabel
{
text
:
qsTr
(
"
Max Waypoints
"
)
Layout.fillWidth
:
true
}
FactTextField
{
fact
:
wimaController
.
maxWaypointsPerPhase
Layout.fillWidth
:
true
}
QGCLabel
{
text
:
qsTr
(
"
Overlap
"
)
Layout.fillWidth
:
true
}
FactTextField
{
fact
:
wimaController
.
overlapWaypoints
Layout.fillWidth
:
true
}
QGCLabel
{
text
:
qsTr
(
"
Measurement Speed
"
)
Layout.fillWidth
:
true
}
FactTextField
{
fact
:
wimaController
.
flightSpeed
Layout.fillWidth
:
true
}
QGCLabel
{
text
:
qsTr
(
"
AaR Speed
"
)
Layout.fillWidth
:
true
}
FactTextField
{
fact
:
wimaController
.
arrivalReturnSpeed
Layout.fillWidth
:
true
}
QGCLabel
{
text
:
qsTr
(
"
Altitude
"
)
Layout.fillWidth
:
true
}
FactTextField
{
fact
:
wimaController
.
altitude
Layout.fillWidth
:
true
}
FactCheckBox
{
text
:
qsTr
(
"
Show Mission
"
)
fact
:
wimaController
.
showAllMissionItems
Layout.fillWidth
:
true
}
FactCheckBox
{
text
:
qsTr
(
"
Show Phase
"
)
fact
:
wimaController
.
showCurrentMissionItems
Layout.fillWidth
:
true
}
}
SectionHeader
{
id
:
navigateHeader
text
:
qsTr
(
"
Navigate
"
)
}
GridLayout
{
// Buttons
columns
:
2
rowSpacing
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
columnSpacing
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
visible
:
navigateHeader
.
checked
width
:
missionHeader
.
width
QGCButton
{
id
:
buttonPreviousMissionPhase
text
:
qsTr
(
"
Go Reverse
"
)
onClicked
:
wimaController
.
previousPhase
()
Layout.fillWidth
:
true
}
QGCButton
{
id
:
buttonNextMissionPhase
text
:
qsTr
(
"
Go Forward
"
)
onClicked
:
wimaController
.
nextPhase
()
Layout.fillWidth
:
true
}
QGCButton
{
id
:
buttonResetPhase
text
:
qsTr
(
"
Reset Phase
"
)
onClicked
:
wimaController
.
resetPhase
();
Layout.columnSpan
:
2
Layout.fillWidth
:
true
}
}
// Grid Buttons
SectionHeader
{
SectionHeader
{
id
:
vehicleHeader
id
:
vehicleHeader
text
:
qsTr
(
"
Vehicle
"
)
text
:
qsTr
(
"
Vehicle
"
)
}
}
GridLayout
{
GridLayout
{
columns
:
2
columns
:
2
rowSpacing
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
rowSpacing
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
...
@@ -298,17 +183,6 @@ Item {
...
@@ -298,17 +183,6 @@ Item {
visible
:
vehicleHeader
.
checked
visible
:
vehicleHeader
.
checked
width
:
parent
.
width
width
:
parent
.
width
QGCButton
{
id
:
buttonUpload
text
:
qsTr
(
"
Upload
"
)
onClicked
:
{
if
(
!
planMasterController
.
offline
)
{
wimaController
.
upload
()
}
}
Layout
.
fillWidth
:
true
}
QGCButton
{
QGCButton
{
id
:
buttonRemoveFromVehicle
id
:
buttonRemoveFromVehicle
text
:
qsTr
(
"
Remove
"
)
text
:
qsTr
(
"
Remove
"
)
...
@@ -320,7 +194,6 @@ Item {
...
@@ -320,7 +194,6 @@ Item {
id
:
buttonSmartRTL
id
:
buttonSmartRTL
text
:
qsTr
(
"
Smart RTL
"
)
text
:
qsTr
(
"
Smart RTL
"
)
onClicked
:
wimaController
.
requestSmartRTL
();
onClicked
:
wimaController
.
requestSmartRTL
();
Layout.columnSpan
:
2
Layout.fillWidth
:
true
Layout.fillWidth
:
true
}
}
...
@@ -350,7 +223,7 @@ Item {
...
@@ -350,7 +223,7 @@ Item {
Layout.columnSpan
:
2
Layout.columnSpan
:
2
horizontalAlignment
:
Text
.
AlignHCenter
horizontalAlignment
:
Text
.
AlignHCenter
verticalAlignment
:
Text
.
AlignVCenter
verticalAlignment
:
Text
.
AlignVCenter
text
:
"
Don
e
"
text
:
"
Upload Complet
e
"
visible
:
false
visible
:
false
Layout.fillWidth
:
true
Layout.fillWidth
:
true
}
}
...
@@ -360,6 +233,7 @@ Item {
...
@@ -360,6 +233,7 @@ Item {
id
:
statsHeader
id
:
statsHeader
text
:
qsTr
(
"
Statistics
"
)
text
:
qsTr
(
"
Statistics
"
)
}
}
GridLayout
{
GridLayout
{
columns
:
3
columns
:
3
rowSpacing
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
rowSpacing
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
...
@@ -374,24 +248,6 @@ Item {
...
@@ -374,24 +248,6 @@ Item {
height
:
0
height
:
0
}
}
SmallValue
{
property
var
phaseDistance
:
wimaController
.
phaseDistance
shortDescription
:
qsTr
(
"
Phase Length
"
)
value
:
phaseDistance
>=
0
?
phaseDistance
.
toFixed
(
2
):
"
-.-
"
unit
:
"
m
"
//width: widthItem.width*0.49
}
SmallValue
{
property
var
phaseDuration
:
wimaController
.
phaseDuration
shortDescription
:
qsTr
(
"
Phase Duration
"
)
value
:
phaseDuration
>=
0
?
getTime
(
phaseDuration
)
:
"
-.-
"
//unit: "m"
//width: widthItem.width*0.49
}
SmallValue
{
SmallValue
{
property
var
currentMissionIndex
:
missionController
.
currentMissionIndex
property
var
currentMissionIndex
:
missionController
.
currentMissionIndex
...
...
src/PlanView/CircularSurveyItemEditor.qml
View file @
a0e0f804
...
@@ -154,44 +154,6 @@ Rectangle {
...
@@ -154,44 +154,6 @@ Rectangle {
}
}
}
}
}
}
QGCLabel
{
text
:
qsTr
(
"
Runs
"
)
}
FactTextField
{
fact
:
missionItem
.
numRuns
}
GridLayout
{
Layout.columnSpan
:
2
columnSpacing
:
_margin
rowSpacing
:
_margin
columns
:
6
Repeater
{
id
:
runRepeater
property
var
fact
:
missionItem
.
run
property
int
run
:
fact
.
value
property
var
names
:
missionItem
.
runNames
property
int
len
:
missionItem
.
runNames
.
length
model
:
len
>
1
?
len
:
0
QGCRadioButton
{
checked
:
index
===
runRepeater
.
run
text
:
runRepeater
.
names
[
index
]
onCheckedChanged
:
{
if
(
checked
){
missionItem
.
run
.
value
=
index
}
checked
=
Qt
.
binding
(
function
(){
return
index
===
runRepeater
.
run
})
}
}
}
}
}
}
SectionHeader
{
SectionHeader
{
...
@@ -273,31 +235,20 @@ Rectangle {
...
@@ -273,31 +235,20 @@ Rectangle {
anchors.horizontalCenter
:
parent
.
horizontalCenter
anchors.horizontalCenter
:
parent
.
horizontalCenter
property
bool
calculating
:
missionItem
.
calculating
property
bool
calculating
:
missionItem
.
calculating
running
:
calculating
running
:
calculating
visible
:
calculating
||
timer
.
running
onCalculatingChanged
:
{
onCalculatingChanged
:
{
if
(
calculating
){
if
(
!
calculating
){
visible
=
true
// defer hideing
}
else
{
timer
.
restart
()
timer
.
restart
()
}
}
}
}
Component.onCompleted
:
{
if
(
calculating
){
visible
=
true
}
}
Timer
{
Timer
{
id
:
timer
id
:
timer
interval
:
1000
interval
:
1000
repeat
:
false
repeat
:
false
running
:
false
onTriggered
:
{
if
(
indicator
.
calculating
==
false
){
indicator
.
visible
=
false
}
}
}
}
}
}
}
}
...
...
src/Wima/CircularSurvey.cc
View file @
a0e0f804
...
@@ -109,6 +109,12 @@ CircularSurvey::CircularSurvey(Vehicle *vehicle, bool flyView,
...
@@ -109,6 +109,12 @@ CircularSurvey::CircularSurvey(Vehicle *vehicle, bool flyView,
connect
(
this
->
_pWorker
.
get
(),
&
RoutingThread
::
calculatingChanged
,
this
,
connect
(
this
->
_pWorker
.
get
(),
&
RoutingThread
::
calculatingChanged
,
this
,
&
CircularSurvey
::
calculatingChanged
);
&
CircularSurvey
::
calculatingChanged
);
this
->
_transectsDirty
=
true
;
this
->
_transectsDirty
=
true
;
// Altitude
connect
(
&
_cameraCalc
,
&
CameraCalc
::
distanceToSurfaceRelativeChanged
,
this
,
&
CircularSurvey
::
coordinateHasRelativeAltitudeChanged
);
connect
(
&
_cameraCalc
,
&
CameraCalc
::
distanceToSurfaceRelativeChanged
,
this
,
&
CircularSurvey
::
exitCoordinateHasRelativeAltitudeChanged
);
}
}
CircularSurvey
::~
CircularSurvey
()
{}
CircularSurvey
::~
CircularSurvey
()
{}
...
...
src/Wima/StateMachine.cpp
View file @
a0e0f804
...
@@ -26,6 +26,8 @@ void StateMachine::updateState(EVENT e) {
...
@@ -26,6 +26,8 @@ void StateMachine::updateState(EVENT e) {
case
EVENT
:
:
INIT_DONE
:
case
EVENT
:
:
INIT_DONE
:
setState
(
STATE
::
NEEDS_J_AREA_UPDATE
);
setState
(
STATE
::
NEEDS_J_AREA_UPDATE
);
break
;
break
;
case
EVENT
:
:
M_AREA_NOT_READY
:
case
EVENT
:
:
M_AREA_READY
:
case
EVENT
:
:
M_AREA_PATH_CHANGED
:
case
EVENT
:
:
M_AREA_PATH_CHANGED
:
case
EVENT
:
:
S_AREA_PATH_CHANGED
:
case
EVENT
:
:
S_AREA_PATH_CHANGED
:
case
EVENT
:
:
CORRIDOR_PATH_CHANGED
:
case
EVENT
:
:
CORRIDOR_PATH_CHANGED
:
...
@@ -34,20 +36,52 @@ void StateMachine::updateState(EVENT e) {
...
@@ -34,20 +36,52 @@ void StateMachine::updateState(EVENT e) {
case
EVENT
:
:
J_AREA_UPDATED
:
case
EVENT
:
:
J_AREA_UPDATED
:
case
EVENT
:
:
DEPOT_CHANGED
:
case
EVENT
:
:
DEPOT_CHANGED
:
case
EVENT
:
:
SURVEY_DESTROYED
:
case
EVENT
:
:
SURVEY_DESTROYED
:
case
EVENT
:
:
MISSION_ITEMS_DESTROYED
:
case
EVENT
:
:
SURVEY_UPDATE_TRIGGERED
:
case
EVENT
:
:
SURVEY_UPDATE_TRIGGERED
:
case
EVENT
:
:
SURVEY_UPDATED
:
case
EVENT
:
:
SURVEY_UPDATED
:
case
EVENT
:
:
PATH_CHANGED
:
case
EVENT
:
:
PATH_UPDATED
:
case
EVENT
:
:
PATH_UPDATED
:
break
;
break
;
default:
qCCritical
(
WimaPlanerLog
)
qCCritical
(
WimaPlanerLog
)
<<
"StateMachine::updateState: Unknown event: "
<<
e
;
<<
"StateMachine::updateState: Unknown event: "
<<
e
;
Q_ASSERT
(
false
);
Q_ASSERT
(
false
);
}
break
;
// STATE::NEEDS_INIT
case
STATE
:
:
WAITING_FOR_TILE_UPDATE
:
switch
(
e
)
{
case
EVENT
:
:
INIT_DONE
:
case
EVENT
:
:
M_AREA_NOT_READY
:
break
;
break
;
case
EVENT
:
:
M_AREA_READY
:
setState
(
STATE
::
NEEDS_J_AREA_UPDATE
);
break
;
case
EVENT
:
:
M_AREA_PATH_CHANGED
:
case
EVENT
:
:
S_AREA_PATH_CHANGED
:
case
EVENT
:
:
CORRIDOR_PATH_CHANGED
:
case
EVENT
:
:
M_AREA_TILES_CHANGED
:
case
EVENT
:
:
M_AREA_PROGRESS_CHANGED
:
case
EVENT
:
:
J_AREA_UPDATED
:
case
EVENT
:
:
DEPOT_CHANGED
:
case
EVENT
:
:
SURVEY_DESTROYED
:
case
EVENT
:
:
MISSION_ITEMS_DESTROYED
:
case
EVENT
:
:
SURVEY_UPDATE_TRIGGERED
:
case
EVENT
:
:
SURVEY_UPDATED
:
case
EVENT
:
:
PATH_CHANGED
:
case
EVENT
:
:
PATH_UPDATED
:
break
;
qCCritical
(
WimaPlanerLog
)
<<
"StateMachine::updateState: Unknown event: "
<<
e
;
Q_ASSERT
(
false
);
}
}
break
;
// STATE::NEEDS_INIT
break
;
// STATE::NEEDS_INIT
case
STATE
:
:
NEEDS_J_AREA_UPDATE
:
case
STATE
:
:
NEEDS_J_AREA_UPDATE
:
switch
(
e
)
{
switch
(
e
)
{
case
EVENT
:
:
INIT_DONE
:
case
EVENT
:
:
INIT_DONE
:
break
;
case
EVENT
:
:
M_AREA_NOT_READY
:
setState
(
STATE
::
WAITING_FOR_TILE_UPDATE
);
break
;
case
EVENT
:
:
M_AREA_READY
:
case
EVENT
:
:
M_AREA_PATH_CHANGED
:
case
EVENT
:
:
M_AREA_PATH_CHANGED
:
case
EVENT
:
:
S_AREA_PATH_CHANGED
:
case
EVENT
:
:
S_AREA_PATH_CHANGED
:
case
EVENT
:
:
CORRIDOR_PATH_CHANGED
:
case
EVENT
:
:
CORRIDOR_PATH_CHANGED
:
...
@@ -58,20 +92,24 @@ void StateMachine::updateState(EVENT e) {
...
@@ -58,20 +92,24 @@ void StateMachine::updateState(EVENT e) {
setState
(
STATE
::
NEEDS_SURVEY_UPDATE
);
setState
(
STATE
::
NEEDS_SURVEY_UPDATE
);
case
EVENT
:
:
DEPOT_CHANGED
:
case
EVENT
:
:
DEPOT_CHANGED
:
case
EVENT
:
:
SURVEY_DESTROYED
:
case
EVENT
:
:
SURVEY_DESTROYED
:
case
EVENT
:
:
MISSION_ITEMS_DESTROYED
:
case
EVENT
:
:
SURVEY_UPDATE_TRIGGERED
:
case
EVENT
:
:
SURVEY_UPDATE_TRIGGERED
:
case
EVENT
:
:
SURVEY_UPDATED
:
case
EVENT
:
:
SURVEY_UPDATED
:
case
EVENT
:
:
PATH_CHANGED
:
case
EVENT
:
:
PATH_UPDATED
:
case
EVENT
:
:
PATH_UPDATED
:
break
;
break
;
default:
qCCritical
(
WimaPlanerLog
)
qCCritical
(
WimaPlanerLog
)
<<
"StateMachine::updateState: Unknown event: "
<<
e
;
<<
"StateMachine::updateState: Unknown event: "
<<
e
;
Q_ASSERT
(
false
);
Q_ASSERT
(
false
);
break
;
}
}
break
;
// STATE::NEEDS_J_AREA_UPDATE
break
;
// STATE::NEEDS_J_AREA_UPDATE
case
STATE
:
:
NEEDS_SURVEY_UPDATE
:
case
STATE
:
:
NEEDS_SURVEY_UPDATE
:
switch
(
e
)
{
switch
(
e
)
{
case
EVENT
:
:
INIT_DONE
:
case
EVENT
:
:
INIT_DONE
:
case
EVENT
:
:
M_AREA_NOT_READY
:
setState
(
STATE
::
WAITING_FOR_TILE_UPDATE
);
break
;
case
EVENT
:
:
M_AREA_READY
:
case
EVENT
:
:
M_AREA_PATH_CHANGED
:
case
EVENT
:
:
M_AREA_PATH_CHANGED
:
case
EVENT
:
:
S_AREA_PATH_CHANGED
:
case
EVENT
:
:
S_AREA_PATH_CHANGED
:
case
EVENT
:
:
CORRIDOR_PATH_CHANGED
:
case
EVENT
:
:
CORRIDOR_PATH_CHANGED
:
...
@@ -82,23 +120,27 @@ void StateMachine::updateState(EVENT e) {
...
@@ -82,23 +120,27 @@ void StateMachine::updateState(EVENT e) {
case
EVENT
:
:
J_AREA_UPDATED
:
case
EVENT
:
:
J_AREA_UPDATED
:
case
EVENT
:
:
DEPOT_CHANGED
:
case
EVENT
:
:
DEPOT_CHANGED
:
case
EVENT
:
:
SURVEY_DESTROYED
:
case
EVENT
:
:
SURVEY_DESTROYED
:
case
EVENT
:
:
MISSION_ITEMS_DESTROYED
:
break
;
break
;
case
EVENT
:
:
SURVEY_UPDATE_TRIGGERED
:
case
EVENT
:
:
SURVEY_UPDATE_TRIGGERED
:
setState
(
STATE
::
WAITING_FOR_SURVEY_UPDATE
);
setState
(
STATE
::
WAITING_FOR_SURVEY_UPDATE
);
break
;
break
;
case
EVENT
:
:
SURVEY_UPDATED
:
case
EVENT
:
:
SURVEY_UPDATED
:
case
EVENT
:
:
PATH_CHANGED
:
case
EVENT
:
:
PATH_UPDATED
:
case
EVENT
:
:
PATH_UPDATED
:
break
;
break
;
default:
qCCritical
(
WimaPlanerLog
)
qCCritical
(
WimaPlanerLog
)
<<
"StateMachine::updateState: Unknown event: "
<<
e
;
<<
"StateMachine::updateState: Unknown event: "
<<
e
;
Q_ASSERT
(
false
);
Q_ASSERT
(
false
);
break
;
}
}
break
;
// STATE::NEEDS_SURVEY_UPDATE
break
;
// STATE::NEEDS_SURVEY_UPDATE
case
STATE
:
:
WAITING_FOR_SURVEY_UPDATE
:
case
STATE
:
:
WAITING_FOR_SURVEY_UPDATE
:
switch
(
e
)
{
switch
(
e
)
{
case
EVENT
:
:
INIT_DONE
:
case
EVENT
:
:
INIT_DONE
:
case
EVENT
:
:
M_AREA_NOT_READY
:
setState
(
STATE
::
WAITING_FOR_TILE_UPDATE
);
break
;
case
EVENT
:
:
M_AREA_READY
:
case
EVENT
:
:
M_AREA_PATH_CHANGED
:
case
EVENT
:
:
M_AREA_PATH_CHANGED
:
case
EVENT
:
:
S_AREA_PATH_CHANGED
:
case
EVENT
:
:
S_AREA_PATH_CHANGED
:
case
EVENT
:
:
CORRIDOR_PATH_CHANGED
:
case
EVENT
:
:
CORRIDOR_PATH_CHANGED
:
...
@@ -109,24 +151,28 @@ void StateMachine::updateState(EVENT e) {
...
@@ -109,24 +151,28 @@ void StateMachine::updateState(EVENT e) {
case
EVENT
:
:
J_AREA_UPDATED
:
case
EVENT
:
:
J_AREA_UPDATED
:
case
EVENT
:
:
DEPOT_CHANGED
:
case
EVENT
:
:
DEPOT_CHANGED
:
case
EVENT
:
:
SURVEY_DESTROYED
:
case
EVENT
:
:
SURVEY_DESTROYED
:
case
EVENT
:
:
MISSION_ITEMS_DESTROYED
:
setState
(
STATE
::
NEEDS_SURVEY_UPDATE
);
setState
(
STATE
::
NEEDS_SURVEY_UPDATE
);
break
;
break
;
case
EVENT
:
:
SURVEY_UPDATE_TRIGGERED
:
case
EVENT
:
:
SURVEY_UPDATE_TRIGGERED
:
break
;
break
;
case
EVENT
:
:
SURVEY_UPDATED
:
case
EVENT
:
:
SURVEY_UPDATED
:
setState
(
STATE
::
NEEDS_PATH_UPDATE
);
setState
(
STATE
::
NEEDS_PATH_UPDATE
);
case
EVENT
:
:
PATH_CHANGED
:
case
EVENT
:
:
PATH_UPDATED
:
case
EVENT
:
:
PATH_UPDATED
:
break
;
break
;
default:
qCCritical
(
WimaPlanerLog
)
qCCritical
(
WimaPlanerLog
)
<<
"StateMachine::updateState: Unknown event: "
<<
e
;
<<
"StateMachine::updateState: Unknown event: "
<<
e
;
Q_ASSERT
(
false
);
Q_ASSERT
(
false
);
break
;
}
}
break
;
// STATE::WAYTING_FOR_SURVEY_UPDATE
break
;
// STATE::WAYTING_FOR_SURVEY_UPDATE
case
STATE
:
:
NEEDS_PATH_UPDATE
:
case
STATE
:
:
NEEDS_PATH_UPDATE
:
switch
(
e
)
{
switch
(
e
)
{
case
EVENT
:
:
INIT_DONE
:
case
EVENT
:
:
INIT_DONE
:
case
EVENT
:
:
M_AREA_NOT_READY
:
setState
(
STATE
::
WAITING_FOR_TILE_UPDATE
);
break
;
case
EVENT
:
:
M_AREA_READY
:
case
EVENT
:
:
M_AREA_PATH_CHANGED
:
case
EVENT
:
:
M_AREA_PATH_CHANGED
:
case
EVENT
:
:
S_AREA_PATH_CHANGED
:
case
EVENT
:
:
S_AREA_PATH_CHANGED
:
case
EVENT
:
:
CORRIDOR_PATH_CHANGED
:
case
EVENT
:
:
CORRIDOR_PATH_CHANGED
:
...
@@ -137,26 +183,30 @@ void StateMachine::updateState(EVENT e) {
...
@@ -137,26 +183,30 @@ void StateMachine::updateState(EVENT e) {
case
EVENT
:
:
J_AREA_UPDATED
:
case
EVENT
:
:
J_AREA_UPDATED
:
case
EVENT
:
:
DEPOT_CHANGED
:
case
EVENT
:
:
DEPOT_CHANGED
:
case
EVENT
:
:
SURVEY_DESTROYED
:
case
EVENT
:
:
SURVEY_DESTROYED
:
case
EVENT
:
:
MISSION_ITEMS_DESTROYED
:
setState
(
STATE
::
NEEDS_SURVEY_UPDATE
);
setState
(
STATE
::
NEEDS_SURVEY_UPDATE
);
break
;
break
;
case
EVENT
:
:
SURVEY_UPDATE_TRIGGERED
:
case
EVENT
:
:
SURVEY_UPDATE_TRIGGERED
:
setState
(
STATE
::
WAITING_FOR_SURVEY_UPDATE
);
setState
(
STATE
::
WAITING_FOR_SURVEY_UPDATE
);
break
;
break
;
case
EVENT
:
:
SURVEY_UPDATED
:
case
EVENT
:
:
SURVEY_UPDATED
:
case
EVENT
:
:
PATH_CHANGED
:
break
;
break
;
case
EVENT
:
:
PATH_UPDATED
:
case
EVENT
:
:
PATH_UPDATED
:
setState
(
STATE
::
UP_TO_DATE
);
setState
(
STATE
::
UP_TO_DATE
);
break
;
break
;
default:
qCCritical
(
WimaPlanerLog
)
qCCritical
(
WimaPlanerLog
)
<<
"StateMachine::updateState: Unknown event: "
<<
e
;
<<
"StateMachine::updateState: Unknown event: "
<<
e
;
Q_ASSERT
(
false
);
Q_ASSERT
(
false
);
break
;
}
}
break
;
// STATE::NEEDS_PATH_UPDATE
break
;
// STATE::NEEDS_PATH_UPDATE
case
STATE
:
:
UP_TO_DATE
:
case
STATE
:
:
UP_TO_DATE
:
switch
(
e
)
{
switch
(
e
)
{
case
EVENT
:
:
INIT_DONE
:
case
EVENT
:
:
INIT_DONE
:
case
EVENT
:
:
M_AREA_NOT_READY
:
setState
(
STATE
::
WAITING_FOR_TILE_UPDATE
);
break
;
case
EVENT
:
:
M_AREA_READY
:
case
EVENT
:
:
M_AREA_PATH_CHANGED
:
case
EVENT
:
:
M_AREA_PATH_CHANGED
:
case
EVENT
:
:
S_AREA_PATH_CHANGED
:
case
EVENT
:
:
S_AREA_PATH_CHANGED
:
case
EVENT
:
:
CORRIDOR_PATH_CHANGED
:
case
EVENT
:
:
CORRIDOR_PATH_CHANGED
:
...
@@ -167,52 +217,93 @@ void StateMachine::updateState(EVENT e) {
...
@@ -167,52 +217,93 @@ void StateMachine::updateState(EVENT e) {
case
EVENT
:
:
J_AREA_UPDATED
:
case
EVENT
:
:
J_AREA_UPDATED
:
case
EVENT
:
:
DEPOT_CHANGED
:
case
EVENT
:
:
DEPOT_CHANGED
:
case
EVENT
:
:
SURVEY_DESTROYED
:
case
EVENT
:
:
SURVEY_DESTROYED
:
case
EVENT
:
:
MISSION_ITEMS_DESTROYED
:
setState
(
STATE
::
NEEDS_SURVEY_UPDATE
);
setState
(
STATE
::
NEEDS_SURVEY_UPDATE
);
break
;
break
;
case
EVENT
:
:
SURVEY_UPDATE_TRIGGERED
:
case
EVENT
:
:
SURVEY_UPDATE_TRIGGERED
:
setState
(
STATE
::
WAITING_FOR_SURVEY_UPDATE
);
setState
(
STATE
::
WAITING_FOR_SURVEY_UPDATE
);
break
;
break
;
case
EVENT
:
:
SURVEY_UPDATED
:
case
EVENT
:
:
SURVEY_UPDATED
:
case
EVENT
:
:
PATH_CHANGED
:
setState
(
STATE
::
NEEDS_PATH_UPDATE
);
setState
(
STATE
::
NEEDS_PATH_UPDATE
);
break
;
break
;
case
EVENT
:
:
PATH_UPDATED
:
case
EVENT
:
:
PATH_UPDATED
:
break
;
break
;
default:
qCCritical
(
WimaPlanerLog
)
qCCritical
(
WimaPlanerLog
)
<<
"StateMachine::updateState: Unknown event: "
<<
e
;
<<
"StateMachine::updateState: Unknown event: "
<<
e
;
Q_ASSERT
(
false
);
Q_ASSERT
(
false
);
break
;
}
}
break
;
// STATE::UP_TO_DATE
break
;
// STATE::UP_TO_DATE
default:
qCCritical
(
WimaPlanerLog
)
qCCritical
(
WimaPlanerLog
)
<<
"StateMachine::updateState: Unknown state: "
<<
this
->
_state
;
<<
"StateMachine::updateState: Unknown state: "
<<
this
->
_state
;
Q_ASSERT
(
false
);
Q_ASSERT
(
false
);
break
;
}
}
}
}
bool
StateMachine
::
upToDate
()
{
return
this
->
_state
==
STATE
::
UP_TO_DATE
;
}
bool
StateMachine
::
upToDate
()
{
return
upToDate
(
this
->
_state
);
}
bool
StateMachine
::
surveyReady
()
{
return
surveyReady
(
this
->
_state
);
}
void
StateMachine
::
setState
(
STATE
s
)
{
void
StateMachine
::
setState
(
STATE
s
)
{
if
(
this
->
_state
!=
s
)
{
if
(
this
->
_state
!=
s
)
{
auto
oldState
=
this
->
_state
;
auto
oldState
=
this
->
_state
;
this
->
_state
=
s
;
this
->
_state
=
s
;
emit
stateChanged
();
emit
stateChanged
();
if
(
oldState
==
STATE
::
UP_TO_DATE
||
s
==
STATE
::
UP_TO_DATE
)
{
if
(
upToDate
(
oldState
)
!=
upToDate
(
s
)
)
{
emit
upToDateChanged
();
emit
upToDateChanged
();
}
}
if
(
surveyReady
(
oldState
)
!=
surveyReady
(
s
))
{
emit
surveyReady
();
}
qCDebug
(
WimaPlanerLog
)
<<
"StateMachine::setState():"
<<
oldState
<<
"->"
qCDebug
(
WimaPlanerLog
)
<<
"StateMachine::setState():"
<<
oldState
<<
"->"
<<
s
;
<<
s
;
}
}
}
}
QDebug
&
operator
<<
(
QDebug
&
ds
,
STATE
s
)
{
bool
StateMachine
::
surveyReady
(
STATE
s
)
{
// Using a switch to enable compiler checking of used states.
bool
value
=
false
;
switch
(
s
)
{
case
STATE
:
:
NEEDS_INIT
:
case
STATE
:
:
WAITING_FOR_TILE_UPDATE
:
case
STATE
:
:
NEEDS_J_AREA_UPDATE
:
case
STATE
:
:
NEEDS_SURVEY_UPDATE
:
case
STATE
:
:
WAITING_FOR_SURVEY_UPDATE
:
break
;
case
STATE
:
:
NEEDS_PATH_UPDATE
:
case
STATE
:
:
UP_TO_DATE
:
value
=
true
;
break
;
}
return
value
;
}
bool
StateMachine
::
upToDate
(
STATE
s
)
{
// Using a switch to enable compiler checking of used states.
bool
value
=
false
;
switch
(
s
)
{
switch
(
s
)
{
case
STATE
:
:
NEEDS_INIT
:
case
STATE
:
:
WAITING_FOR_TILE_UPDATE
: