-
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:Add disarm on low copter flipping LUA example #29081
base: master
Are you sure you want to change the base?
Conversation
-- Check roll and pitch | ||
local roll = ahrs:get_roll() * 57.2958 -- Convert radians to degrees | ||
local pitch = ahrs:get_pitch() * 57.2958 -- Convert radians to degrees | ||
|
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.
no big deal but maybe we could remove these extra blank lines
|
||
if math.abs(roll) > ANGLE_THRESH or math.abs(pitch) > ANGLE_THRESH then | ||
-- Disarm the drone | ||
arming:disarm() -- |
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.
extra "--" at the end of this line that can probably be deleted
local rotation_downward = 25 | ||
local ALT_THRESH = 250 -- Altitude in which in centimeters | ||
local ANGLE_THRESH = 80 -- Roll/Pitch angle threshold in degrees | ||
|
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.
Not a blocker but normally we print a message to tell the user that the script has been loaded.
gcs:send_text(1, "copter-disarm-on-flip script loaded")
end | ||
end | ||
else | ||
gcs:send_text(1, "No valid data from downward rangefinder!") |
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.
This is going to spam the user at 100hz so perhaps add a "return update(), 1000" to slow it down
thanks for adding this. I've made a couple of comments but it's pretty close to merge-able. Could we rename it to start with "copter-"? I think the script is only valid for Copter so having the vehicle at the front makes it more likely that users who can use it will find it and others can quickly ignore it |
@rmackay9 I dont think this actually works, right? unless somehow the RF is updating so slowly that it still shows close to ground as it rotates toward the sky to get the attitude limits evoked... |
Contribution from a user who wanted to share it