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
3b82d52d
Commit
3b82d52d
authored
Aug 01, 2016
by
Rustom Jehangir
Browse files
Make supportsThrottleModeCenterZero a plugin option
parent
0538e94e
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/FirmwarePlugin/APM/ArduSubFirmwarePlugin.cc
View file @
3b82d52d
...
...
@@ -52,3 +52,8 @@ int ArduSubFirmwarePlugin::manualControlReservedButtonCount(void)
{
return
0
;
}
bool
ArduSubFirmwarePlugin
::
supportsThrottleModeCenterZero
(
void
)
{
return
false
;
}
src/FirmwarePlugin/APM/ArduSubFirmwarePlugin.h
View file @
3b82d52d
...
...
@@ -69,6 +69,8 @@ public:
// Overrides from FirmwarePlugin
int
manualControlReservedButtonCount
(
void
);
bool
supportsThrottleModeCenterZero
(
void
);
};
#endif
src/FirmwarePlugin/FirmwarePlugin.cc
View file @
3b82d52d
...
...
@@ -83,6 +83,12 @@ int FirmwarePlugin::manualControlReservedButtonCount(void)
return
-
1
;
}
bool
FirmwarePlugin
::
supportsThrottleModeCenterZero
(
void
)
{
// By default, this is supported
return
true
;
}
bool
FirmwarePlugin
::
adjustIncomingMavlinkMessage
(
Vehicle
*
vehicle
,
mavlink_message_t
*
message
)
{
Q_UNUSED
(
vehicle
);
...
...
src/FirmwarePlugin/FirmwarePlugin.h
View file @
3b82d52d
...
...
@@ -128,6 +128,11 @@ public:
/// @return -1: reserver all buttons, >0 number of buttons to reserve
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
);
/// 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
/// spec implementations such that the base code can remain mavlink generic.
...
...
src/Joystick/Joystick.cc
View file @
3b82d52d
...
...
@@ -284,7 +284,7 @@ void Joystick::run(void)
throttle
=
std
::
max
(
-
1.0
f
,
std
::
min
(
tanf
(
asinf
(
throttle_limited
)),
1.0
f
));
// Adjust throttle to 0:1 range
if
(
_throttleMode
==
ThrottleModeCenterZero
&&
!
_activeVehicle
->
su
b
())
{
if
(
_throttleMode
==
ThrottleModeCenterZero
&&
_activeVehicle
->
su
pportsThrottleModeCenterZero
())
{
throttle
=
std
::
max
(
0.0
f
,
throttle
);
}
else
{
throttle
=
(
throttle
+
1.0
f
)
/
2.0
f
;
...
...
src/Vehicle/Vehicle.cc
View file @
3b82d52d
...
...
@@ -1528,6 +1528,11 @@ bool Vehicle::supportsManualControl(void) const
return
false
;
}
bool
Vehicle
::
supportsThrottleModeCenterZero
(
void
)
const
{
return
_firmwarePlugin
->
supportsThrottleModeCenterZero
();
}
void
Vehicle
::
_setCoordinateValid
(
bool
coordinateValid
)
{
if
(
coordinateValid
!=
_coordinateValid
)
{
...
...
src/Vehicle/Vehicle.h
View file @
3b82d52d
...
...
@@ -276,6 +276,7 @@ public:
Q_PROPERTY
(
bool
vtol
READ
vtol
CONSTANT
)
Q_PROPERTY
(
bool
rover
READ
rover
CONSTANT
)
Q_PROPERTY
(
bool
supportsManualControl
READ
supportsManualControl
CONSTANT
)
Q_PROPERTY
(
bool
supportsThrottleModeCenterZero
READ
supportsThrottleModeCenterZero
CONSTANT
)
Q_PROPERTY
(
bool
sub
READ
sub
CONSTANT
)
Q_PROPERTY
(
bool
autoDisconnect
MEMBER
_autoDisconnect
NOTIFY
autoDisconnectChanged
)
Q_PROPERTY
(
QString
prearmError
READ
prearmError
WRITE
setPrearmError
NOTIFY
prearmErrorChanged
)
...
...
@@ -473,6 +474,7 @@ public:
bool
sub
(
void
)
const
;
bool
supportsManualControl
(
void
)
const
;
bool
supportsThrottleModeCenterZero
(
void
)
const
;
void
setFlying
(
bool
flying
);
void
setGuidedMode
(
bool
guidedMode
);
...
...
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