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
5e043189
Commit
5e043189
authored
Aug 02, 2016
by
Don Gagne
Committed by
GitHub
Aug 02, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3896 from bluerobotics/pluginSemantics
Fix plugin semantics for ArduSub additions
parents
2ed50262
2664e9a5
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
103 additions
and
20 deletions
+103
-20
APMAutoPilotPlugin.cc
src/AutoPilotPlugins/APM/APMAutoPilotPlugin.cc
+1
-1
ArduSubFirmwarePlugin.cc
src/FirmwarePlugin/APM/ArduSubFirmwarePlugin.cc
+20
-0
ArduSubFirmwarePlugin.h
src/FirmwarePlugin/APM/ArduSubFirmwarePlugin.h
+7
-0
FirmwarePlugin.cc
src/FirmwarePlugin/FirmwarePlugin.cc
+21
-0
FirmwarePlugin.h
src/FirmwarePlugin/FirmwarePlugin.h
+17
-0
PX4FirmwarePlugin.cc
src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc
+5
-0
PX4FirmwarePlugin.h
src/FirmwarePlugin/PX4/PX4FirmwarePlugin.h
+1
-0
Joystick.cc
src/Joystick/Joystick.cc
+1
-1
Vehicle.cc
src/Vehicle/Vehicle.cc
+16
-9
Vehicle.h
src/Vehicle/Vehicle.h
+5
-0
JoystickConfig.qml
src/VehicleSetup/JoystickConfig.qml
+9
-9
No files found.
src/AutoPilotPlugins/APM/APMAutoPilotPlugin.cc
View file @
5e043189
...
@@ -66,7 +66,7 @@ const QVariantList& APMAutoPilotPlugin::vehicleComponents(void)
...
@@ -66,7 +66,7 @@ const QVariantList& APMAutoPilotPlugin::vehicleComponents(void)
_airframeComponent
->
setupTriggerSignals
();
_airframeComponent
->
setupTriggerSignals
();
_components
.
append
(
QVariant
::
fromValue
((
VehicleComponent
*
)
_airframeComponent
));
_components
.
append
(
QVariant
::
fromValue
((
VehicleComponent
*
)
_airframeComponent
));
if
(
!
_vehicle
->
sub
()
)
{
if
(
_vehicle
->
supportsRadio
()
)
{
_radioComponent
=
new
APMRadioComponent
(
_vehicle
,
this
);
_radioComponent
=
new
APMRadioComponent
(
_vehicle
,
this
);
_radioComponent
->
setupTriggerSignals
();
_radioComponent
->
setupTriggerSignals
();
_components
.
append
(
QVariant
::
fromValue
((
VehicleComponent
*
)
_radioComponent
));
_components
.
append
(
QVariant
::
fromValue
((
VehicleComponent
*
)
_radioComponent
));
...
...
src/FirmwarePlugin/APM/ArduSubFirmwarePlugin.cc
View file @
5e043189
...
@@ -52,3 +52,23 @@ int ArduSubFirmwarePlugin::manualControlReservedButtonCount(void)
...
@@ -52,3 +52,23 @@ int ArduSubFirmwarePlugin::manualControlReservedButtonCount(void)
{
{
return
0
;
return
0
;
}
}
bool
ArduSubFirmwarePlugin
::
supportsThrottleModeCenterZero
(
void
)
{
return
false
;
}
bool
ArduSubFirmwarePlugin
::
supportsManualControl
(
void
)
{
return
true
;
}
bool
ArduSubFirmwarePlugin
::
supportsRadio
(
void
)
{
return
false
;
}
bool
ArduSubFirmwarePlugin
::
supportsJSButton
(
void
)
{
return
true
;
}
src/FirmwarePlugin/APM/ArduSubFirmwarePlugin.h
View file @
5e043189
...
@@ -69,6 +69,13 @@ public:
...
@@ -69,6 +69,13 @@ public:
// Overrides from FirmwarePlugin
// Overrides from FirmwarePlugin
int
manualControlReservedButtonCount
(
void
);
int
manualControlReservedButtonCount
(
void
);
bool
supportsThrottleModeCenterZero
(
void
);
bool
supportsManualControl
(
void
);
bool
supportsRadio
(
void
);
bool
supportsJSButton
(
void
);
};
};
#endif
#endif
src/FirmwarePlugin/FirmwarePlugin.cc
View file @
5e043189
...
@@ -83,6 +83,27 @@ int FirmwarePlugin::manualControlReservedButtonCount(void)
...
@@ -83,6 +83,27 @@ int FirmwarePlugin::manualControlReservedButtonCount(void)
return
-
1
;
return
-
1
;
}
}
bool
FirmwarePlugin
::
supportsThrottleModeCenterZero
(
void
)
{
// By default, this is supported
return
true
;
}
bool
FirmwarePlugin
::
supportsManualControl
(
void
)
{
return
false
;
}
bool
FirmwarePlugin
::
supportsRadio
(
void
)
{
return
true
;
}
bool
FirmwarePlugin
::
supportsJSButton
(
void
)
{
return
false
;
}
bool
FirmwarePlugin
::
adjustIncomingMavlinkMessage
(
Vehicle
*
vehicle
,
mavlink_message_t
*
message
)
bool
FirmwarePlugin
::
adjustIncomingMavlinkMessage
(
Vehicle
*
vehicle
,
mavlink_message_t
*
message
)
{
{
Q_UNUSED
(
vehicle
);
Q_UNUSED
(
vehicle
);
...
...
src/FirmwarePlugin/FirmwarePlugin.h
View file @
5e043189
...
@@ -128,6 +128,23 @@ public:
...
@@ -128,6 +128,23 @@ public:
/// @return -1: reserver all buttons, >0 number of buttons to reserve
/// @return -1: reserver all buttons, >0 number of buttons to reserve
virtual
int
manualControlReservedButtonCount
(
void
);
virtual
int
manualControlReservedButtonCount
(
void
);
/// Returns true if the vehicle and firmware supports the use of a throttle joystick that
/// is zero when centered. Typically not supported on vehicles that have bidirectional
/// throttle.
virtual
bool
supportsThrottleModeCenterZero
(
void
);
/// Returns true if the firmware supports the use of the MAVlink "MANUAL_CONTROL" message.
/// By default, this returns false unless overridden in the firmware plugin.
virtual
bool
supportsManualControl
(
void
);
/// Returns true if the firmware supports the use of the RC radio and requires the RC radio
/// setup page. Returns true by default.
virtual
bool
supportsRadio
(
void
);
/// Returns true if the firmware supports the AP_JSButton library, which allows joystick buttons
/// to be assigned via parameters in firmware. Default is false.
virtual
bool
supportsJSButton
(
void
);
/// Called before any mavlink message is processed by Vehicle such that the firmwre plugin
/// Called before any mavlink message is processed by Vehicle such that the firmwre plugin
/// can adjust any message characteristics. This is handy to adjust or differences in mavlink
/// can adjust any message characteristics. This is handy to adjust or differences in mavlink
/// spec implementations such that the base code can remain mavlink generic.
/// spec implementations such that the base code can remain mavlink generic.
...
...
src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc
View file @
5e043189
...
@@ -170,6 +170,11 @@ int PX4FirmwarePlugin::manualControlReservedButtonCount(void)
...
@@ -170,6 +170,11 @@ int PX4FirmwarePlugin::manualControlReservedButtonCount(void)
return
0
;
// 0 buttons reserved for rc switch simulation
return
0
;
// 0 buttons reserved for rc switch simulation
}
}
bool
PX4FirmwarePlugin
::
supportsManualControl
(
void
)
{
return
true
;
}
bool
PX4FirmwarePlugin
::
isCapable
(
const
Vehicle
*
vehicle
,
FirmwareCapabilities
capabilities
)
bool
PX4FirmwarePlugin
::
isCapable
(
const
Vehicle
*
vehicle
,
FirmwareCapabilities
capabilities
)
{
{
if
(
vehicle
->
multiRotor
())
{
if
(
vehicle
->
multiRotor
())
{
...
...
src/FirmwarePlugin/PX4/PX4FirmwarePlugin.h
View file @
5e043189
...
@@ -44,6 +44,7 @@ public:
...
@@ -44,6 +44,7 @@ public:
void
guidedModeChangeAltitude
(
Vehicle
*
vehicle
,
double
altitudeRel
)
final
;
void
guidedModeChangeAltitude
(
Vehicle
*
vehicle
,
double
altitudeRel
)
final
;
bool
isGuidedMode
(
const
Vehicle
*
vehicle
)
const
;
bool
isGuidedMode
(
const
Vehicle
*
vehicle
)
const
;
int
manualControlReservedButtonCount
(
void
)
final
;
int
manualControlReservedButtonCount
(
void
)
final
;
bool
supportsManualControl
(
void
)
final
;
void
initializeVehicle
(
Vehicle
*
vehicle
)
final
;
void
initializeVehicle
(
Vehicle
*
vehicle
)
final
;
bool
sendHomePositionToVehicle
(
void
)
final
;
bool
sendHomePositionToVehicle
(
void
)
final
;
void
addMetaDataToFact
(
QObject
*
parameterMetaData
,
Fact
*
fact
,
MAV_TYPE
vehicleType
)
final
;
void
addMetaDataToFact
(
QObject
*
parameterMetaData
,
Fact
*
fact
,
MAV_TYPE
vehicleType
)
final
;
...
...
src/Joystick/Joystick.cc
View file @
5e043189
...
@@ -284,7 +284,7 @@ void Joystick::run(void)
...
@@ -284,7 +284,7 @@ void Joystick::run(void)
throttle
=
std
::
max
(
-
1.0
f
,
std
::
min
(
tanf
(
asinf
(
throttle_limited
)),
1.0
f
));
throttle
=
std
::
max
(
-
1.0
f
,
std
::
min
(
tanf
(
asinf
(
throttle_limited
)),
1.0
f
));
// Adjust throttle to 0:1 range
// Adjust throttle to 0:1 range
if
(
_throttleMode
==
ThrottleModeCenterZero
&&
!
_activeVehicle
->
sub
())
{
if
(
_throttleMode
==
ThrottleModeCenterZero
&&
_activeVehicle
->
supportsThrottleModeCenterZero
())
{
throttle
=
std
::
max
(
0.0
f
,
throttle
);
throttle
=
std
::
max
(
0.0
f
,
throttle
);
}
else
{
}
else
{
throttle
=
(
throttle
+
1.0
f
)
/
2.0
f
;
throttle
=
(
throttle
+
1.0
f
)
/
2.0
f
;
...
...
src/Vehicle/Vehicle.cc
View file @
5e043189
...
@@ -1517,15 +1517,22 @@ bool Vehicle::vtol(void) const
...
@@ -1517,15 +1517,22 @@ bool Vehicle::vtol(void) const
bool
Vehicle
::
supportsManualControl
(
void
)
const
bool
Vehicle
::
supportsManualControl
(
void
)
const
{
{
// PX4 Firmware supports manual control message
return
_firmwarePlugin
->
supportsManualControl
();
if
(
px4Firmware
()
)
{
}
return
true
;
}
bool
Vehicle
::
supportsThrottleModeCenterZero
(
void
)
const
// ArduSub supports manual control message (identified by APM + Submarine type)
{
if
(
apmFirmware
()
&&
vehicleType
()
==
MAV_TYPE_SUBMARINE
)
{
return
_firmwarePlugin
->
supportsThrottleModeCenterZero
();
return
true
;
}
}
return
false
;
bool
Vehicle
::
supportsRadio
(
void
)
const
{
return
_firmwarePlugin
->
supportsRadio
();
}
bool
Vehicle
::
supportsJSButton
(
void
)
const
{
return
_firmwarePlugin
->
supportsJSButton
();
}
}
void
Vehicle
::
_setCoordinateValid
(
bool
coordinateValid
)
void
Vehicle
::
_setCoordinateValid
(
bool
coordinateValid
)
...
...
src/Vehicle/Vehicle.h
View file @
5e043189
...
@@ -276,6 +276,8 @@ public:
...
@@ -276,6 +276,8 @@ public:
Q_PROPERTY
(
bool
vtol
READ
vtol
CONSTANT
)
Q_PROPERTY
(
bool
vtol
READ
vtol
CONSTANT
)
Q_PROPERTY
(
bool
rover
READ
rover
CONSTANT
)
Q_PROPERTY
(
bool
rover
READ
rover
CONSTANT
)
Q_PROPERTY
(
bool
supportsManualControl
READ
supportsManualControl
CONSTANT
)
Q_PROPERTY
(
bool
supportsManualControl
READ
supportsManualControl
CONSTANT
)
Q_PROPERTY
(
bool
supportsThrottleModeCenterZero
READ
supportsThrottleModeCenterZero
CONSTANT
)
Q_PROPERTY
(
bool
supportsJSButton
READ
supportsJSButton
CONSTANT
)
Q_PROPERTY
(
bool
sub
READ
sub
CONSTANT
)
Q_PROPERTY
(
bool
sub
READ
sub
CONSTANT
)
Q_PROPERTY
(
bool
autoDisconnect
MEMBER
_autoDisconnect
NOTIFY
autoDisconnectChanged
)
Q_PROPERTY
(
bool
autoDisconnect
MEMBER
_autoDisconnect
NOTIFY
autoDisconnectChanged
)
Q_PROPERTY
(
QString
prearmError
READ
prearmError
WRITE
setPrearmError
NOTIFY
prearmErrorChanged
)
Q_PROPERTY
(
QString
prearmError
READ
prearmError
WRITE
setPrearmError
NOTIFY
prearmErrorChanged
)
...
@@ -473,6 +475,9 @@ public:
...
@@ -473,6 +475,9 @@ public:
bool
sub
(
void
)
const
;
bool
sub
(
void
)
const
;
bool
supportsManualControl
(
void
)
const
;
bool
supportsManualControl
(
void
)
const
;
bool
supportsThrottleModeCenterZero
(
void
)
const
;
bool
supportsRadio
(
void
)
const
;
bool
supportsJSButton
(
void
)
const
;
void
setFlying
(
bool
flying
);
void
setFlying
(
bool
flying
);
void
setGuidedMode
(
bool
guidedMode
);
void
setGuidedMode
(
bool
guidedMode
);
...
...
src/VehicleSetup/JoystickConfig.qml
View file @
5e043189
...
@@ -381,7 +381,7 @@ QGCView {
...
@@ -381,7 +381,7 @@ QGCView {
Column
{
Column
{
spacing
:
ScreenTools
.
defaultFontPixelHeight
/
3
spacing
:
ScreenTools
.
defaultFontPixelHeight
/
3
visible
:
!
_activeVehicle
.
sub
visible
:
_activeVehicle
.
supportsThrottleModeCenterZero
ExclusiveGroup
{
id
:
throttleModeExclusiveGroup
}
ExclusiveGroup
{
id
:
throttleModeExclusiveGroup
}
...
@@ -449,8 +449,8 @@ QGCView {
...
@@ -449,8 +449,8 @@ QGCView {
if
(
buttonActionRepeater
.
itemAt
(
index
))
{
if
(
buttonActionRepeater
.
itemAt
(
index
))
{
buttonActionRepeater
.
itemAt
(
index
).
pressed
=
pressed
buttonActionRepeater
.
itemAt
(
index
).
pressed
=
pressed
}
}
if
(
sub
ButtonActionRepeater
.
itemAt
(
index
))
{
if
(
js
ButtonActionRepeater
.
itemAt
(
index
))
{
sub
ButtonActionRepeater
.
itemAt
(
index
).
pressed
=
pressed
js
ButtonActionRepeater
.
itemAt
(
index
).
pressed
=
pressed
}
}
}
}
}
}
...
@@ -474,7 +474,7 @@ QGCView {
...
@@ -474,7 +474,7 @@ QGCView {
Row
{
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
spacing
:
ScreenTools
.
defaultFontPixelWidth
visible
:
(
_activeVehicle
.
manualControlReservedButtonCount
==
-
1
?
false
:
modelData
>=
_activeVehicle
.
manualControlReservedButtonCount
)
&&
!
_activeVehicle
.
su
b
visible
:
(
_activeVehicle
.
manualControlReservedButtonCount
==
-
1
?
false
:
modelData
>=
_activeVehicle
.
manualControlReservedButtonCount
)
&&
!
_activeVehicle
.
su
pportsJSButton
property
bool
pressed
property
bool
pressed
...
@@ -516,7 +516,7 @@ QGCView {
...
@@ -516,7 +516,7 @@ QGCView {
Row
{
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
spacing
:
ScreenTools
.
defaultFontPixelWidth
visible
:
_activeVehicle
.
su
b
visible
:
_activeVehicle
.
su
pportsJSButton
QGCLabel
{
QGCLabel
{
horizontalAlignment
:
Text
.
AlignHCenter
horizontalAlignment
:
Text
.
AlignHCenter
...
@@ -536,12 +536,12 @@ QGCView {
...
@@ -536,12 +536,12 @@ QGCView {
}
// Row
}
// Row
Repeater
{
Repeater
{
id
:
sub
ButtonActionRepeater
id
:
js
ButtonActionRepeater
model
:
_activeJoystick
.
totalButtonCount
model
:
_activeJoystick
.
totalButtonCount
Row
{
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
spacing
:
ScreenTools
.
defaultFontPixelWidth
visible
:
_activeVehicle
.
su
b
visible
:
_activeVehicle
.
su
pportsJSButton
property
bool
pressed
property
bool
pressed
...
@@ -564,14 +564,14 @@ QGCView {
...
@@ -564,14 +564,14 @@ QGCView {
}
}
FactComboBox
{
FactComboBox
{
id
:
main
Sub
ButtonActionCombo
id
:
main
JS
ButtonActionCombo
width
:
ScreenTools
.
defaultFontPixelWidth
*
15
width
:
ScreenTools
.
defaultFontPixelWidth
*
15
fact
:
controller
.
parameterExists
(
-
1
,
"
BTN
"
+
index
+
"
_FUNCTION
"
)
?
controller
.
getParameterFact
(
-
1
,
"
BTN
"
+
index
+
"
_FUNCTION
"
)
:
null
;
fact
:
controller
.
parameterExists
(
-
1
,
"
BTN
"
+
index
+
"
_FUNCTION
"
)
?
controller
.
getParameterFact
(
-
1
,
"
BTN
"
+
index
+
"
_FUNCTION
"
)
:
null
;
indexModel
:
false
indexModel
:
false
}
}
FactComboBox
{
FactComboBox
{
id
:
shift
Sub
ButtonActionCombo
id
:
shift
JS
ButtonActionCombo
width
:
ScreenTools
.
defaultFontPixelWidth
*
15
width
:
ScreenTools
.
defaultFontPixelWidth
*
15
fact
:
controller
.
parameterExists
(
-
1
,
"
BTN
"
+
index
+
"
_SFUNCTION
"
)
?
controller
.
getParameterFact
(
-
1
,
"
BTN
"
+
index
+
"
_SFUNCTION
"
)
:
null
;
fact
:
controller
.
parameterExists
(
-
1
,
"
BTN
"
+
index
+
"
_SFUNCTION
"
)
?
controller
.
getParameterFact
(
-
1
,
"
BTN
"
+
index
+
"
_SFUNCTION
"
)
:
null
;
indexModel
:
false
indexModel
:
false
...
...
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