Skip to content
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

Add get_airspeed method to lua bindings #28044

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

AlexisMGL
Copy link

Add get_airspeed(instance) method, useful for planes with multiple sensors (currently, only the primary sensor is available).

  • Added AP_Airspeed chapter in docs.lua and bindings.desc.
  • Implemented airspeed:get_airspeed method.
  • Tested in SITL with the following_script:

-- This script gives airspeed value if available

function state_init()
gcs:send_text(6, 'script initiated')
return state_update, 500
end

function state_update()

local message = string.format("Airspeed: %.2f m/s", airspeed:get_airspeed(0))
gcs:send_text(6,message)
return state_update, 6000

end

return state_init,500

…eed for planes with multiple airspeed sensors
@AlexisMGL AlexisMGL changed the title Add get_airspeed methode Add get_airspeed method Sep 8, 2024
@AlexisMGL AlexisMGL changed the title Add get_airspeed method Add get_airspeed method to lua bindings Sep 8, 2024
@IamPete1
Copy link
Member

IamPete1 commented Sep 8, 2024

We do have a existing PR for this. #20499

I do think you at least also need a binding for healthy.

The further problem is that if you call the healthy method with a invalid index you will read past the end the array. Is the unsafe methods that have prevented us from adding bindings so far.....

@peterbarker
Copy link
Contributor

@AlexisMGL please compare/contrast to the PR from @MattKear which @IamPete1 pointed out

@AlexisMGL
Copy link
Author

I've added other airspeed methods from #20499. It's unclear to me if I should keep the range check, for instance, or not.

@peterbarker
Copy link
Contributor

@AlexisMGL this needs to pass CI...

@AlexisMGL
Copy link
Author

I can rebase if needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants