-
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 bindings for servo telemetry #28857
base: master
Are you sure you want to change the base?
Conversation
7cab0c2
to
ad05ddb
Compare
This now gets the structure and adds auto generation of a bitmask check and set. This means the script writer does not need to know there is a validity bitmask in the structure. This is currently read only, but it also adds auto setting of the mask when a value is set. The only slight problem is that once set there is no way to un-set the mask from lua. One disadvantage to this method is that were stuck with the types in the structure, previously I had returned the temp in degrees by applying the scale in the getter, now were stuck with centi degrees. |
Example of the new docs markup:
First bit is the same, the stuff added is:
"valid_mask" is the keyword to enable the bitmask validity check. |
I haven't looked in detail, but it seems this can't absolutely fix the race condition because there isn't a lock protecting the telemetry data. The race window is much shorter now however, so maybe it's fixed enough? It was said in the call that there's servos which output different data at different rates anyway, so maybe comparing commanded vs. achieved just isn't possible in general. Also still curious what the size impact would be if you had one mega function which returned eleven values. |
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.
Looks OK to me but @tpwrules will review more thoroughly
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.
A couple little things in the generator but should be ready to go after!
I tested in SITL using quadplane-can and the position from four servos comes through but it's the same for all four of them. I checked that the data I could get from Lua matched the data logged in CSRV, and it all did so this PR is good, but there's still probably something funky here.
cbed113
to
19b0ebb
Compare
Fix generator to skip generation of docs for generation methods that don't exist, and to avoid generating Lua creation methods that couldn't be called. Co-authored-by: Thomas Watson <[email protected]>
19b0ebb
to
e72720f
Compare
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.
Tested and still works, thanks for the fixes.
I cleaned up the history slightly and folded in another really tiny fix to the generator. Figured it was easier to do it myself then to go through review again.
Concerned whether servo telemetry needs a fix similar to #28999 but that doesn't impact this PR at all. |
Adds bindings for servo telem, this allows servo checks to be done in lua.