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
c3232d4f
Commit
c3232d4f
authored
May 27, 2016
by
Don Gagne
Browse files
Merge pull request #3397 from dagar/misc
PX4 misc
parents
4af57560
17fcb294
Changes
10
Hide whitespace changes
Inline
Side-by-side
src/AutoPilotPlugins/PX4/FlightModesComponent.cc
View file @
c3232d4f
...
...
@@ -107,7 +107,7 @@ QString FlightModesComponent::prerequisiteSetup(void) const
return
plugin
->
airframeComponent
()
->
name
();
}
else
if
(
!
plugin
->
radioComponent
()
->
setupComplete
())
{
return
plugin
->
radioComponent
()
->
name
();
}
else
if
(
!
plugin
->
sensorsComponent
()
->
setupComplete
())
{
}
else
if
(
!
plugin
->
vehicle
()
->
hilMode
()
&&
!
plugin
->
sensorsComponent
()
->
setupComplete
())
{
return
plugin
->
sensorsComponent
()
->
name
();
}
}
...
...
src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc
View file @
c3232d4f
...
...
@@ -73,9 +73,11 @@ const QVariantList& PX4AutoPilotPlugin::vehicleComponents(void)
_radioComponent
->
setupTriggerSignals
();
_components
.
append
(
QVariant
::
fromValue
((
VehicleComponent
*
)
_radioComponent
));
_sensorsComponent
=
new
SensorsComponent
(
_vehicle
,
this
);
_sensorsComponent
->
setupTriggerSignals
();
_components
.
append
(
QVariant
::
fromValue
((
VehicleComponent
*
)
_sensorsComponent
));
if
(
!
_vehicle
->
hilMode
())
{
_sensorsComponent
=
new
SensorsComponent
(
_vehicle
,
this
);
_sensorsComponent
->
setupTriggerSignals
();
_components
.
append
(
QVariant
::
fromValue
((
VehicleComponent
*
)
_sensorsComponent
));
}
_flightModesComponent
=
new
FlightModesComponent
(
_vehicle
,
this
);
_flightModesComponent
->
setupTriggerSignals
();
...
...
src/AutoPilotPlugins/PX4/SafetyComponent.qml
View file @
c3232d4f
...
...
@@ -490,7 +490,7 @@ QGCView {
spacing
:
_margins
*
0.5
anchors.verticalCenter
:
parent
.
verticalCenter
Row
{
visible
:
_landSpeedMC
!==
-
1
visible
:
!
controller
.
vehicle
.
fixedWing
&&
(
_landSpeedMC
!==
-
1
)
QGCLabel
{
anchors.baseline
:
landVelField
.
baseline
width
:
_middleRowWidth
...
...
src/FirmwarePlugin/APM/APMFirmwarePlugin.cc
View file @
c3232d4f
...
...
@@ -167,8 +167,9 @@ QList<VehicleComponent*> APMFirmwarePlugin::componentsForVehicle(AutoPilotPlugin
return
QList
<
VehicleComponent
*>
();
}
QStringList
APMFirmwarePlugin
::
flightModes
(
void
)
QStringList
APMFirmwarePlugin
::
flightModes
(
Vehicle
*
vehicle
)
{
Q_UNUSED
(
vehicle
)
QStringList
flightModesList
;
foreach
(
const
APMCustomMode
&
customMode
,
_supportedModes
)
{
if
(
customMode
.
canBeSet
())
{
...
...
src/FirmwarePlugin/APM/APMFirmwarePlugin.h
View file @
c3232d4f
...
...
@@ -87,7 +87,7 @@ public:
QList
<
MAV_CMD
>
supportedMissionCommands
(
void
)
final
;
bool
isCapable
(
FirmwareCapabilities
capabilities
);
QStringList
flightModes
(
void
)
final
;
QStringList
flightModes
(
Vehicle
*
vehicle
)
final
;
QString
flightMode
(
uint8_t
base_mode
,
uint32_t
custom_mode
)
const
final
;
bool
setFlightMode
(
const
QString
&
flightMode
,
uint8_t
*
base_mode
,
uint32_t
*
custom_mode
)
final
;
bool
isGuidedMode
(
const
Vehicle
*
vehicle
)
const
final
;
...
...
src/FirmwarePlugin/FirmwarePlugin.h
View file @
c3232d4f
...
...
@@ -84,7 +84,10 @@ public:
virtual
QList
<
VehicleComponent
*>
componentsForVehicle
(
AutoPilotPlugin
*
vehicle
);
/// Returns the list of available flight modes
virtual
QStringList
flightModes
(
void
)
{
return
QStringList
();
}
virtual
QStringList
flightModes
(
Vehicle
*
vehicle
)
{
Q_UNUSED
(
vehicle
);
return
QStringList
();
}
/// Returns the name for this flight mode. Flight mode names must be human readable as well as audio speakable.
/// @param base_mode Base mode from mavlink HEARTBEAT message
...
...
src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc
View file @
c3232d4f
...
...
@@ -68,6 +68,8 @@ struct Modes2Name {
uint8_t
sub_mode
;
const
char
*
name
;
///< Name for flight mode
bool
canBeSet
;
///< true: Vehicle can be set to this flight mode
bool
fixedWing
;
/// fixed wing compatible
bool
multiRotor
;
/// multi rotor compatible
};
const
char
*
PX4FirmwarePlugin
::
manualFlightMode
=
"Manual"
;
...
...
@@ -89,21 +91,21 @@ const char* PX4FirmwarePlugin::followMeFlightMode = "Follow Me";
/// Tranlates from PX4 custom modes to flight mode names
static
const
struct
Modes2Name
rgModes2Name
[]
=
{
{
PX4_CUSTOM_MAIN_MODE_MANUAL
,
0
,
PX4FirmwarePlugin
::
manualFlightMode
,
true
},
{
PX4_CUSTOM_MAIN_MODE_ACRO
,
0
,
PX4FirmwarePlugin
::
acroFlightMode
,
true
},
{
PX4_CUSTOM_MAIN_MODE_STABILIZED
,
0
,
PX4FirmwarePlugin
::
stabilizedFlightMode
,
true
},
{
PX4_CUSTOM_MAIN_MODE_RATTITUDE
,
0
,
PX4FirmwarePlugin
::
rattitudeFlightMode
,
true
},
{
PX4_CUSTOM_MAIN_MODE_ALTCTL
,
0
,
PX4FirmwarePlugin
::
altCtlFlightMode
,
true
},
{
PX4_CUSTOM_MAIN_MODE_POSCTL
,
0
,
PX4FirmwarePlugin
::
posCtlFlightMode
,
true
},
{
PX4_CUSTOM_MAIN_MODE_OFFBOARD
,
0
,
PX4FirmwarePlugin
::
offboardFlightMode
,
true
},
{
PX4_CUSTOM_MAIN_MODE_AUTO
,
PX4_CUSTOM_SUB_MODE_AUTO_READY
,
PX4FirmwarePlugin
::
readyFlightMode
,
false
},
{
PX4_CUSTOM_MAIN_MODE_AUTO
,
PX4_CUSTOM_SUB_MODE_AUTO_TAKEOFF
,
PX4FirmwarePlugin
::
takeoffFlightMode
,
false
},
{
PX4_CUSTOM_MAIN_MODE_AUTO
,
PX4_CUSTOM_SUB_MODE_AUTO_LOITER
,
PX4FirmwarePlugin
::
pauseFlightMode
,
true
},
{
PX4_CUSTOM_MAIN_MODE_AUTO
,
PX4_CUSTOM_SUB_MODE_AUTO_MISSION
,
PX4FirmwarePlugin
::
missionFlightMode
,
true
},
{
PX4_CUSTOM_MAIN_MODE_AUTO
,
PX4_CUSTOM_SUB_MODE_AUTO_RTL
,
PX4FirmwarePlugin
::
rtlFlightMode
,
true
},
{
PX4_CUSTOM_MAIN_MODE_AUTO
,
PX4_CUSTOM_SUB_MODE_AUTO_LAND
,
PX4FirmwarePlugin
::
landingFlightMode
,
false
},
{
PX4_CUSTOM_MAIN_MODE_AUTO
,
PX4_CUSTOM_SUB_MODE_AUTO_RTGS
,
PX4FirmwarePlugin
::
rtgsFlightMode
,
false
},
{
PX4_CUSTOM_MAIN_MODE_AUTO
,
PX4_CUSTOM_SUB_MODE_AUTO_FOLLOW_ME
,
PX4FirmwarePlugin
::
followMeFlightMode
,
true
},
{
PX4_CUSTOM_MAIN_MODE_MANUAL
,
0
,
PX4FirmwarePlugin
::
manualFlightMode
,
true
,
true
,
true
},
{
PX4_CUSTOM_MAIN_MODE_ACRO
,
0
,
PX4FirmwarePlugin
::
acroFlightMode
,
true
,
false
,
true
},
{
PX4_CUSTOM_MAIN_MODE_STABILIZED
,
0
,
PX4FirmwarePlugin
::
stabilizedFlightMode
,
true
,
true
,
true
},
{
PX4_CUSTOM_MAIN_MODE_RATTITUDE
,
0
,
PX4FirmwarePlugin
::
rattitudeFlightMode
,
true
,
false
,
true
},
{
PX4_CUSTOM_MAIN_MODE_ALTCTL
,
0
,
PX4FirmwarePlugin
::
altCtlFlightMode
,
true
,
true
,
true
},
{
PX4_CUSTOM_MAIN_MODE_POSCTL
,
0
,
PX4FirmwarePlugin
::
posCtlFlightMode
,
true
,
true
,
true
},
{
PX4_CUSTOM_MAIN_MODE_OFFBOARD
,
0
,
PX4FirmwarePlugin
::
offboardFlightMode
,
true
,
true
,
true
},
{
PX4_CUSTOM_MAIN_MODE_AUTO
,
PX4_CUSTOM_SUB_MODE_AUTO_READY
,
PX4FirmwarePlugin
::
readyFlightMode
,
false
,
true
,
true
},
{
PX4_CUSTOM_MAIN_MODE_AUTO
,
PX4_CUSTOM_SUB_MODE_AUTO_TAKEOFF
,
PX4FirmwarePlugin
::
takeoffFlightMode
,
false
,
true
,
true
},
{
PX4_CUSTOM_MAIN_MODE_AUTO
,
PX4_CUSTOM_SUB_MODE_AUTO_LOITER
,
PX4FirmwarePlugin
::
pauseFlightMode
,
true
,
true
,
true
},
{
PX4_CUSTOM_MAIN_MODE_AUTO
,
PX4_CUSTOM_SUB_MODE_AUTO_MISSION
,
PX4FirmwarePlugin
::
missionFlightMode
,
true
,
true
,
true
},
{
PX4_CUSTOM_MAIN_MODE_AUTO
,
PX4_CUSTOM_SUB_MODE_AUTO_RTL
,
PX4FirmwarePlugin
::
rtlFlightMode
,
true
,
true
,
true
},
{
PX4_CUSTOM_MAIN_MODE_AUTO
,
PX4_CUSTOM_SUB_MODE_AUTO_LAND
,
PX4FirmwarePlugin
::
landingFlightMode
,
false
,
true
,
true
},
{
PX4_CUSTOM_MAIN_MODE_AUTO
,
PX4_CUSTOM_SUB_MODE_AUTO_RTGS
,
PX4FirmwarePlugin
::
rtgsFlightMode
,
false
,
true
,
true
},
{
PX4_CUSTOM_MAIN_MODE_AUTO
,
PX4_CUSTOM_SUB_MODE_AUTO_FOLLOW_ME
,
PX4FirmwarePlugin
::
followMeFlightMode
,
true
,
true
,
true
},
};
QList
<
VehicleComponent
*>
PX4FirmwarePlugin
::
componentsForVehicle
(
AutoPilotPlugin
*
vehicle
)
...
...
@@ -113,7 +115,7 @@ QList<VehicleComponent*> PX4FirmwarePlugin::componentsForVehicle(AutoPilotPlugin
return
QList
<
VehicleComponent
*>
();
}
QStringList
PX4FirmwarePlugin
::
flightModes
(
void
)
QStringList
PX4FirmwarePlugin
::
flightModes
(
Vehicle
*
vehicle
)
{
QStringList
flightModes
;
...
...
@@ -121,7 +123,15 @@ QStringList PX4FirmwarePlugin::flightModes(void)
const
struct
Modes2Name
*
pModes2Name
=
&
rgModes2Name
[
i
];
if
(
pModes2Name
->
canBeSet
)
{
flightModes
+=
pModes2Name
->
name
;
bool
fw
=
(
vehicle
->
fixedWing
()
&&
pModes2Name
->
fixedWing
);
bool
mc
=
(
vehicle
->
multiRotor
()
&&
pModes2Name
->
multiRotor
);
// show all modes for generic, vtol, etc
bool
other
=
!
vehicle
->
fixedWing
()
&&
!
vehicle
->
multiRotor
();
if
(
fw
||
mc
||
other
)
{
flightModes
+=
pModes2Name
->
name
;
}
}
}
...
...
src/FirmwarePlugin/PX4/PX4FirmwarePlugin.h
View file @
c3232d4f
...
...
@@ -42,7 +42,7 @@ public:
QList
<
MAV_CMD
>
supportedMissionCommands
(
void
)
final
;
bool
isCapable
(
FirmwareCapabilities
capabilities
)
final
;
QStringList
flightModes
(
void
)
final
;
QStringList
flightModes
(
Vehicle
*
vehicle
)
final
;
QString
flightMode
(
uint8_t
base_mode
,
uint32_t
custom_mode
)
const
final
;
bool
setFlightMode
(
const
QString
&
flightMode
,
uint8_t
*
base_mode
,
uint32_t
*
custom_mode
)
final
;
void
setGuidedMode
(
Vehicle
*
vehicle
,
bool
guidedMode
)
final
;
...
...
src/QmlControls/ParameterEditor.qml
View file @
c3232d4f
...
...
@@ -181,7 +181,7 @@ QGCView {
readonly
property
int
componentId
:
parseInt
(
modelData
)
spacing
:
Math
.
ceil
(
ScreenTools
.
defaultFontPixelHeight
*
0.25
)
QGCLabel
{
text
:
qsTr
(
"
Component #: %1
)
"
).
arg
(
componentId
.
toString
())
text
:
qsTr
(
"
Component #: %1
"
).
arg
(
componentId
.
toString
())
font.family
:
ScreenTools
.
demiboldFontFamily
anchors.horizontalCenter
:
parent
.
horizontalCenter
}
...
...
src/Vehicle/Vehicle.cc
View file @
c3232d4f
...
...
@@ -1193,7 +1193,7 @@ bool Vehicle::flightModeSetAvailable(void)
QStringList
Vehicle
::
flightModes
(
void
)
{
return
_firmwarePlugin
->
flightModes
();
return
_firmwarePlugin
->
flightModes
(
this
);
}
QString
Vehicle
::
flightMode
(
void
)
const
...
...
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