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
4423b2bf
Commit
4423b2bf
authored
May 22, 2017
by
Don Gagne
Committed by
GitHub
May 22, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5180 from DonLakeFlyer/ArduPilotStartMission
ArduPilot: Add start mission support
parents
e5e72455
d47142ef
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
20 deletions
+51
-20
ArduCopterFirmwarePlugin.cc
src/FirmwarePlugin/APM/ArduCopterFirmwarePlugin.cc
+30
-0
ArduCopterFirmwarePlugin.h
src/FirmwarePlugin/APM/ArduCopterFirmwarePlugin.h
+21
-20
No files found.
src/FirmwarePlugin/APM/ArduCopterFirmwarePlugin.cc
View file @
4423b2bf
...
...
@@ -186,6 +186,8 @@ void ArduCopterFirmwarePlugin::guidedModeTakeoff(Vehicle* vehicle)
takeoffAlt
/=
100
;
// centimeters -> meters
}
setGuidedMode
(
vehicle
,
true
);
if
(
!
_armVehicleAndValidate
(
vehicle
))
{
qgcApp
()
->
showMessage
(
tr
(
"Unable to takeoff: Vehicle failed to arm."
));
return
;
...
...
@@ -285,3 +287,31 @@ bool ArduCopterFirmwarePlugin::vehicleYawsToNextWaypointInMission(const Vehicle*
}
return
true
;
}
void
ArduCopterFirmwarePlugin
::
startMission
(
Vehicle
*
vehicle
)
{
double
currentAlt
=
vehicle
->
altitudeRelative
()
->
rawValue
().
toDouble
();
if
(
!
vehicle
->
flying
())
{
guidedModeTakeoff
(
vehicle
);
// Wait for vehicle to get off ground before switching to auto
bool
didTakeoff
=
false
;
for
(
int
i
=
0
;
i
<
50
;
i
++
)
{
if
(
vehicle
->
altitudeRelative
()
->
rawValue
().
toDouble
()
>=
currentAlt
+
1.0
)
{
didTakeoff
=
true
;
break
;
}
QGC
::
SLEEP
::
msleep
(
100
);
qgcApp
()
->
processEvents
(
QEventLoop
::
ExcludeUserInputEvents
);
}
if
(
!
didTakeoff
)
{
qgcApp
()
->
showMessage
(
QStringLiteral
(
"Unable to switch to Auto. Vehicle takeoff failed."
));
return
;
}
}
vehicle
->
setFlightMode
(
missionFlightMode
());
}
src/FirmwarePlugin/APM/ArduCopterFirmwarePlugin.h
View file @
4423b2bf
...
...
@@ -55,27 +55,28 @@ public:
ArduCopterFirmwarePlugin
(
void
);
// Overrides from FirmwarePlugin
bool
isCapable
(
const
Vehicle
*
vehicle
,
FirmwareCapabilities
capabilities
)
final
;
void
setGuidedMode
(
Vehicle
*
vehicle
,
bool
guidedMode
)
final
;
void
pauseVehicle
(
Vehicle
*
vehicle
)
final
;
void
guidedModeRTL
(
Vehicle
*
vehicle
)
final
;
void
guidedModeLand
(
Vehicle
*
vehicle
)
final
;
void
guidedModeTakeoff
(
Vehicle
*
vehicle
)
final
;
void
guidedModeGotoLocation
(
Vehicle
*
vehicle
,
const
QGeoCoordinate
&
gotoCoord
)
final
;
void
guidedModeChangeAltitude
(
Vehicle
*
vehicle
,
double
altitudeChange
)
final
;
bool
isCapable
(
const
Vehicle
*
vehicle
,
FirmwareCapabilities
capabilities
)
final
;
void
setGuidedMode
(
Vehicle
*
vehicle
,
bool
guidedMode
)
final
;
void
pauseVehicle
(
Vehicle
*
vehicle
)
final
;
void
guidedModeRTL
(
Vehicle
*
vehicle
)
final
;
void
guidedModeLand
(
Vehicle
*
vehicle
)
final
;
void
guidedModeTakeoff
(
Vehicle
*
vehicle
)
final
;
void
guidedModeGotoLocation
(
Vehicle
*
vehicle
,
const
QGeoCoordinate
&
gotoCoord
)
final
;
void
guidedModeChangeAltitude
(
Vehicle
*
vehicle
,
double
altitudeChange
)
final
;
const
FirmwarePlugin
::
remapParamNameMajorVersionMap_t
&
paramNameRemapMajorVersionMap
(
void
)
const
final
{
return
_remapParamName
;
}
int
remapParamNameHigestMinorVersionNumber
(
int
majorVersionNumber
)
const
final
;
bool
multiRotorCoaxialMotors
(
Vehicle
*
vehicle
)
final
;
bool
multiRotorXConfig
(
Vehicle
*
vehicle
)
final
;
QString
geoFenceRadiusParam
(
Vehicle
*
vehicle
)
final
;
QString
offlineEditingParamFile
(
Vehicle
*
vehicle
)
final
{
Q_UNUSED
(
vehicle
);
return
QStringLiteral
(
":/FirmwarePlugin/APM/Copter.OfflineEditing.params"
);
}
QString
pauseFlightMode
(
void
)
const
override
{
return
QString
(
"Brake"
);
}
QString
missionFlightMode
(
void
)
const
override
{
return
QString
(
"Auto"
);
}
QString
rtlFlightMode
(
void
)
const
override
{
return
QString
(
"RTL"
);
}
QString
landFlightMode
(
void
)
const
override
{
return
QString
(
"Land"
);
}
QString
takeControlFlightMode
(
void
)
const
override
{
return
QString
(
"Stablize"
);
}
bool
vehicleYawsToNextWaypointInMission
(
const
Vehicle
*
vehicle
)
const
final
;
QString
autoDisarmParameter
(
Vehicle
*
vehicle
)
final
{
Q_UNUSED
(
vehicle
);
return
QStringLiteral
(
"DISARM_DELAY"
);
}
int
remapParamNameHigestMinorVersionNumber
(
int
majorVersionNumber
)
const
final
;
bool
multiRotorCoaxialMotors
(
Vehicle
*
vehicle
)
final
;
bool
multiRotorXConfig
(
Vehicle
*
vehicle
)
final
;
QString
geoFenceRadiusParam
(
Vehicle
*
vehicle
)
final
;
QString
offlineEditingParamFile
(
Vehicle
*
vehicle
)
final
{
Q_UNUSED
(
vehicle
);
return
QStringLiteral
(
":/FirmwarePlugin/APM/Copter.OfflineEditing.params"
);
}
QString
pauseFlightMode
(
void
)
const
override
{
return
QString
(
"Brake"
);
}
QString
missionFlightMode
(
void
)
const
override
{
return
QString
(
"Auto"
);
}
QString
rtlFlightMode
(
void
)
const
override
{
return
QString
(
"RTL"
);
}
QString
landFlightMode
(
void
)
const
override
{
return
QString
(
"Land"
);
}
QString
takeControlFlightMode
(
void
)
const
override
{
return
QString
(
"Stablize"
);
}
bool
vehicleYawsToNextWaypointInMission
(
const
Vehicle
*
vehicle
)
const
final
;
QString
autoDisarmParameter
(
Vehicle
*
vehicle
)
final
{
Q_UNUSED
(
vehicle
);
return
QStringLiteral
(
"DISARM_DELAY"
);
}
void
startMission
(
Vehicle
*
vehicle
)
override
;
private:
static
bool
_remapParamNameIntialized
;
...
...
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