Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
48f97727
Commit
48f97727
authored
Jan 30, 2018
by
DonLakeFlyer
Browse files
Add gimbal/mode commands for Corridor Scan as well
parent
790d03b4
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/MissionManager/MissionController.cc
View file @
48f97727
...
...
@@ -389,22 +389,41 @@ int MissionController::insertROIMissionItem(QGeoCoordinate coordinate, int i)
int
MissionController
::
insertComplexMissionItem
(
QString
itemName
,
QGeoCoordinate
mapCenterCoordinate
,
int
i
)
{
ComplexMissionItem
*
newItem
;
bool
surveyStyleItem
=
false
;
int
sequenceNumber
=
_nextSequenceNumber
();
if
(
itemName
==
_surveyMissionItemName
)
{
newItem
=
new
SurveyMissionItem
(
_controllerVehicle
,
_visualItems
);
newItem
->
setCoordinate
(
mapCenterCoordinate
);
// If the vehicle is known to have a gimbal then we automatically point the gimbal straight down if not already set
surveyStyleItem
=
true
;
}
else
if
(
itemName
==
_fwLandingMissionItemName
)
{
newItem
=
new
FixedWingLandingComplexItem
(
_controllerVehicle
,
_visualItems
);
}
else
if
(
itemName
==
_structureScanMissionItemName
)
{
newItem
=
new
StructureScanComplexItem
(
_controllerVehicle
,
_visualItems
);
}
else
if
(
itemName
==
_corridorScanMissionItemName
)
{
newItem
=
new
CorridorScanComplexItem
(
_controllerVehicle
,
_visualItems
);
surveyStyleItem
=
true
;
}
else
{
qWarning
()
<<
"Internal error: Unknown complex item:"
<<
itemName
;
return
sequenceNumber
;
}
if
(
surveyStyleItem
)
{
bool
rollSupported
=
false
;
bool
pitchSupported
=
false
;
bool
yawSupported
=
false
;
// If the vehicle is known to have a gimbal then we automatically point the gimbal straight down if not already set
MissionSettingsItem
*
settingsItem
=
_visualItems
->
value
<
MissionSettingsItem
*>
(
0
);
CameraSection
*
cameraSection
=
settingsItem
->
cameraSection
();
// Set camera to photo mode (leave alone if user already specified)
if
(
cameraSection
->
cameraModeSupported
()
&&
!
cameraSection
->
specifyCameraMode
())
{
cameraSection
->
setSpecifyCameraMode
(
true
);
cameraSection
->
cameraMode
()
->
setRawValue
(
CAMERA_MODE_IMAGE_SURVEY
);
}
// Point gimbal straight down
if
(
_controllerVehicle
->
firmwarePlugin
()
->
hasGimbal
(
_controllerVehicle
,
rollSupported
,
pitchSupported
,
yawSupported
)
&&
pitchSupported
)
{
// If the user already specified a gimbal angle leave it alone
...
...
@@ -413,16 +432,8 @@ int MissionController::insertComplexMissionItem(QString itemName, QGeoCoordinate
cameraSection
->
gimbalPitch
()
->
setRawValue
(
-
90.0
);
}
}
}
else
if
(
itemName
==
_fwLandingMissionItemName
)
{
newItem
=
new
FixedWingLandingComplexItem
(
_controllerVehicle
,
_visualItems
);
}
else
if
(
itemName
==
_structureScanMissionItemName
)
{
newItem
=
new
StructureScanComplexItem
(
_controllerVehicle
,
_visualItems
);
}
else
if
(
itemName
==
_corridorScanMissionItemName
)
{
newItem
=
new
CorridorScanComplexItem
(
_controllerVehicle
,
_visualItems
);
}
else
{
qWarning
()
<<
"Internal error: Unknown complex item:"
<<
itemName
;
return
sequenceNumber
;
}
newItem
->
setSequenceNumber
(
sequenceNumber
);
_initVisualItem
(
newItem
);
...
...
@@ -440,17 +451,17 @@ void MissionController::removeMissionItem(int index)
return
;
}
bool
surveyRemoved
=
_visualItems
->
value
<
SurveyMissionItem
*>
(
index
);
bool
removeSurveyStyle
=
_visualItems
->
value
<
SurveyMissionItem
*>
(
index
)
||
_visualItems
->
value
<
CorridorScanComplexItem
*>
(
index
)
;
VisualMissionItem
*
item
=
qobject_cast
<
VisualMissionItem
*>
(
_visualItems
->
removeAt
(
index
));
_deinitVisualItem
(
item
);
item
->
deleteLater
();
if
(
surveyRemoved
)
{
// Determine if the mission still has another survey in it
if
(
removeSurveyStyle
)
{
// Determine if the mission still has another survey
style item
in it
bool
foundSurvey
=
false
;
for
(
int
i
=
1
;
i
<
_visualItems
->
count
();
i
++
)
{
if
(
_visualItems
->
value
<
SurveyMissionItem
*>
(
i
))
{
if
(
_visualItems
->
value
<
SurveyMissionItem
*>
(
i
)
||
_visualItems
->
value
<
CorridorScanComplexItem
*>
(
index
)
)
{
foundSurvey
=
true
;
break
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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