-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AP_Scripting: quadplane terrain avoidance with "can't make that climb" #28625
base: master
Are you sure you want to change the base?
Conversation
Hi @IamPete1 and @peterbarker - I wonder if you could take a look at this. It's mostly a Lua script with some added bindings. |
libraries/AP_Scripting/docs/docs.lua
Outdated
@@ -3043,7 +3043,6 @@ function terrain:status() end | |||
---@return boolean | |||
function terrain:enabled() end | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left over white space change.
return true | ||
end | ||
|
||
return MAVLink |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return MAVLink | |
return MAVLink | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that a standard/recommended style? I like it like this if I don't have to change it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, standard to have a blank line at the end of the file. You will notice guthub puts a little stop sign there to warn you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I thought you were talking about the blank line before the return. No worries. I'll fix it.
local now = millis():tofloat() * 0.001 | ||
if not _last_t then | ||
_last_t = now | ||
end | ||
local dt = now - _last_t |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do the DT first and then convert to float. That prevent lose of precision at millis get larger.
-- I = calculated Integral component | ||
-- Total = calculated new Airspeed | ||
-- Add - passed in as 0 | ||
logger.write(name,'Targ,Curr,P,I,Total,Add','ffffff',_target,_current,_P,_I,_total,add_total) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logger.write(name,'Targ,Curr,P,I,Total,Add','ffffff',_target,_current,_P,_I,_total,add_total) | |
logger:write(name,'Targ,Curr,P,I,Total,Add','ffffff',_target,_current,_P,_I,_total,add_total) |
This is a Lua script that runs continually while a quadplane is in AUTO mode (typically running a mission) and monitors LIDAR readings for dangerously close terrain. If the terrain gets too close, the script will take over the quadplane performing one of three avoidance maneouvers:
This has been extensively tested in the wilds of northern Canada.
Here's a video of a RealFlight demo which demonstrates each kind of avoidance https://youtu.be/wbSNbGx1tDM