forked from ArduPilot/ardupilot
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AP_Scripting: added bindings for VTOL motor loss
this allows a script to take an action on loss of a VTOL motor
- Loading branch information
Showing
3 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--[[ | ||
display motor lost number from MotorsMatrix for multirotors | ||
--]] | ||
|
||
local last_motor_lost = -1 | ||
|
||
function update() | ||
local lost_index | ||
if not MotorsMatrix:get_thrust_boost() then | ||
-- when get_thrust_boost is false then we have not lost a motor | ||
lost_index = -1 | ||
else | ||
-- otherwise get the lost motor number | ||
lost_index = MotorsMatrix:get_lost_motor() | ||
end | ||
if lost_index ~= last_motor_lost then | ||
if lost_index == -1 then | ||
gcs:send_text(0, string.format("Motors: recovered")) | ||
else | ||
gcs:send_text(0, string.format("Motors: lost motor %d", lost_index+1)) | ||
end | ||
last_motor_lost = lost_index | ||
end | ||
return update, 100 | ||
end | ||
|
||
return update, 100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters