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
b49760af
Commit
b49760af
authored
May 03, 2017
by
DonLakeFlyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New sequence for PX4 Takeoff
parent
81474bf1
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
9 deletions
+31
-9
ArduCopterFirmwarePlugin.cc
src/FirmwarePlugin/APM/ArduCopterFirmwarePlugin.cc
+1
-1
FirmwarePlugin.cc
src/FirmwarePlugin/FirmwarePlugin.cc
+1
-1
FirmwarePlugin.h
src/FirmwarePlugin/FirmwarePlugin.h
+1
-1
PX4FirmwarePlugin.cc
src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc
+25
-6
PX4FirmwarePlugin.h
src/FirmwarePlugin/PX4/PX4FirmwarePlugin.h
+3
-0
No files found.
src/FirmwarePlugin/APM/ArduCopterFirmwarePlugin.cc
View file @
b49760af
...
...
@@ -139,7 +139,7 @@ void ArduCopterFirmwarePlugin::guidedModeLand(Vehicle* vehicle)
void
ArduCopterFirmwarePlugin
::
guidedModeTakeoff
(
Vehicle
*
vehicle
)
{
if
(
!
_armVehicle
(
vehicle
))
{
if
(
!
_armVehicle
AndValidate
(
vehicle
))
{
qgcApp
()
->
showMessage
(
tr
(
"Unable to takeoff: Vehicle failed to arm."
));
return
;
}
...
...
src/FirmwarePlugin/FirmwarePlugin.cc
View file @
b49760af
...
...
@@ -435,7 +435,7 @@ bool FirmwarePlugin::vehicleYawsToNextWaypointInMission(const Vehicle* vehicle)
return
vehicle
->
multiRotor
()
?
false
:
true
;
}
bool
FirmwarePlugin
::
_armVehicle
(
Vehicle
*
vehicle
)
bool
FirmwarePlugin
::
_armVehicle
AndValidate
(
Vehicle
*
vehicle
)
{
if
(
!
vehicle
->
armed
())
{
vehicle
->
setArmed
(
true
);
...
...
src/FirmwarePlugin/FirmwarePlugin.h
View file @
b49760af
...
...
@@ -303,7 +303,7 @@ public:
protected:
// Arms the vehicle, waiting for the arm state to change.
// @return: true - vehicle armed, false - vehicle failed to arm
bool
_armVehicle
(
Vehicle
*
vehicle
);
bool
_armVehicle
AndValidate
(
Vehicle
*
vehicle
);
private:
QVariantList
_toolBarIndicatorList
;
...
...
src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc
View file @
b49760af
...
...
@@ -352,6 +352,29 @@ void PX4FirmwarePlugin::guidedModeOrbit(Vehicle* vehicle, const QGeoCoordinate&
centerCoord
.
isValid
()
?
centerCoord
.
altitude
()
:
NAN
);
}
void
PX4FirmwarePlugin
::
_mavCommandResult
(
int
vehicleId
,
int
component
,
int
command
,
int
result
,
bool
noReponseFromVehicle
)
{
Q_UNUSED
(
vehicleId
);
Q_UNUSED
(
component
);
Q_UNUSED
(
noReponseFromVehicle
);
Vehicle
*
vehicle
=
dynamic_cast
<
Vehicle
*>
(
sender
());
if
(
!
vehicle
)
{
qWarning
()
<<
"Dynamic cast failed!"
;
return
;
}
if
(
command
==
MAV_CMD_NAV_TAKEOFF
&&
result
==
MAV_RESULT_ACCEPTED
)
{
// Now that we are in takeoff mode we can arm the vehicle which will cause it to takeoff.
// We specifically don't retry arming if it fails. This way we don't fight with the user if
// They are trying to disarm.
disconnect
(
vehicle
,
&
Vehicle
::
mavCommandResult
,
this
,
&
PX4FirmwarePlugin
::
_mavCommandResult
);
if
(
!
vehicle
->
armed
())
{
vehicle
->
setArmed
(
true
);
}
}
}
void
PX4FirmwarePlugin
::
guidedModeTakeoff
(
Vehicle
*
vehicle
)
{
QString
takeoffAltParam
(
"MIS_TAKEOFF_ALT"
);
...
...
@@ -367,11 +390,7 @@ void PX4FirmwarePlugin::guidedModeTakeoff(Vehicle* vehicle)
}
Fact
*
takeoffAlt
=
vehicle
->
parameterManager
()
->
getParameter
(
FactSystem
::
defaultComponentId
,
takeoffAltParam
);
if
(
!
_armVehicle
(
vehicle
))
{
qgcApp
()
->
showMessage
(
tr
(
"Unable to takeoff: Vehicle failed to arm."
));
return
;
}
connect
(
vehicle
,
&
Vehicle
::
mavCommandResult
,
this
,
&
PX4FirmwarePlugin
::
_mavCommandResult
);
vehicle
->
sendMavCommand
(
vehicle
->
defaultComponentId
(),
MAV_CMD_NAV_TAKEOFF
,
true
,
// show error is fails
...
...
@@ -436,7 +455,7 @@ void PX4FirmwarePlugin::guidedModeChangeAltitude(Vehicle* vehicle, double altitu
void
PX4FirmwarePlugin
::
startMission
(
Vehicle
*
vehicle
)
{
if
(
!
_armVehicle
(
vehicle
))
{
if
(
!
_armVehicle
AndValidate
(
vehicle
))
{
qgcApp
()
->
showMessage
(
tr
(
"Unable to start mission: Vehicle failed to arm."
));
return
;
}
...
...
src/FirmwarePlugin/PX4/PX4FirmwarePlugin.h
View file @
b49760af
...
...
@@ -103,6 +103,9 @@ protected:
QString
_followMeFlightMode
;
QString
_simpleFlightMode
;
private
slots
:
void
_mavCommandResult
(
int
vehicleId
,
int
component
,
int
command
,
int
result
,
bool
noReponseFromVehicle
);
private:
void
_handleAutopilotVersion
(
Vehicle
*
vehicle
,
mavlink_message_t
*
message
);
...
...
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