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
3a415a88
Commit
3a415a88
authored
Apr 24, 2016
by
Lorenz Meier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Teach QGC to detect the PX4 guided mode.
parent
9e423bea
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
14 deletions
+21
-14
PX4FirmwarePlugin.cc
src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc
+20
-14
PX4FirmwarePlugin.h
src/FirmwarePlugin/PX4/PX4FirmwarePlugin.h
+1
-0
No files found.
src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc
View file @
3a415a88
...
...
@@ -282,31 +282,31 @@ void PX4FirmwarePlugin::guidedModeTakeoff(Vehicle* vehicle, double altitudeRel)
return
;
}
// tell the system first to take off in its internal,
// airframe specific takeoff action
vehicle
->
setFlightMode
(
takeoffFlightMode
);
//
For later use
#if 0
//
then tell it to loiter at the user-selected location
// above the takeoff (home) position
mavlink_message_t
msg
;
mavlink_command_
int
_t cmd = {};
mavlink_command_
long
_t
cmd
=
{};
cmd.command = (uint16_t)MAV_CMD_
NAV_TAKEOFF
;
cmd
.
command
=
(
uint16_t
)
MAV_CMD_
DO_REPOSITION
;
cmd
.
confirmation
=
0
;
cmd.frame = MAV_FRAME_LOCAL_OFFSET_NED;
cmd.param1 = 0.0f;
cmd.param2 = 0.0f;
cmd
.
param1
=
-
1.0
f
;
cmd
.
param2
=
0.0
;
cmd
.
param3
=
0.0
f
;
cmd.param4 =
0.0f
;
cmd.param5 =
0.0f
;
cmd.param6 =
0.0f
;
cmd.param7 =
-altitudeRel; // AMSL meters
cmd
.
param4
=
NAN
;
cmd
.
param5
=
NAN
;
cmd
.
param6
=
NAN
;
cmd
.
param7
=
vehicle
->
altitudeAMSL
()
->
rawValue
().
toDouble
()
+
altitudeRel
;
cmd
.
target_system
=
vehicle
->
id
();
cmd
.
target_component
=
0
;
MAVLinkProtocol
*
mavlink
=
qgcApp
()
->
toolbox
()
->
mavlinkProtocol
();
mavlink_msg_command_
int
_encode(mavlink->getSystemId(), mavlink->getComponentId(), &msg, &cmd);
mavlink_msg_command_
long
_encode
(
mavlink
->
getSystemId
(),
mavlink
->
getComponentId
(),
&
msg
,
&
cmd
);
vehicle
->
sendMessage
(
msg
);
#endif
}
void
PX4FirmwarePlugin
::
guidedModeGotoLocation
(
Vehicle
*
vehicle
,
const
QGeoCoordinate
&
gotoCoord
)
...
...
@@ -368,8 +368,14 @@ void PX4FirmwarePlugin::guidedModeChangeAltitude(Vehicle* vehicle, double altitu
void
PX4FirmwarePlugin
::
setGuidedMode
(
Vehicle
*
vehicle
,
bool
guidedMode
)
{
if
(
guidedMode
)
{
vehicle
->
setFlightMode
(
"Pause"
);
vehicle
->
setFlightMode
(
pauseFlightMode
);
}
else
{
pauseVehicle
(
vehicle
);
}
}
bool
PX4FirmwarePlugin
::
isGuidedMode
(
const
Vehicle
*
vehicle
)
const
{
// Not supported by generic vehicle
return
(
vehicle
->
flightMode
()
==
pauseFlightMode
);
}
src/FirmwarePlugin/PX4/PX4FirmwarePlugin.h
View file @
3a415a88
...
...
@@ -52,6 +52,7 @@ public:
void
guidedModeTakeoff
(
Vehicle
*
vehicle
,
double
altitudeRel
)
final
;
void
guidedModeGotoLocation
(
Vehicle
*
vehicle
,
const
QGeoCoordinate
&
gotoCoord
)
final
;
void
guidedModeChangeAltitude
(
Vehicle
*
vehicle
,
double
altitudeRel
)
final
;
bool
isGuidedMode
(
const
Vehicle
*
vehicle
)
const
;
int
manualControlReservedButtonCount
(
void
)
final
;
void
initializeVehicle
(
Vehicle
*
vehicle
)
final
;
bool
sendHomePositionToVehicle
(
void
)
final
;
...
...
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