-
Notifications
You must be signed in to change notification settings - Fork 18.7k
AP_Scripting: Add wind decoder for Trisonica LI-550 #30054
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
Conversation
6ce9322
to
281e788
Compare
-- Remember to change baud to 230k in the sensor setup and enable the fields you want. | ||
-- Also, enable 10Hz output instead of the default 5Hz. | ||
|
||
-- Example data string (excluding quotes, including the carriage return line feed ending) |
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.
What precisely is the ending? As you describe it's "\r\n" but the code doesn't match that and no endings are in the sample.
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.
\r\n
. I just matched \r
because it was easy. I updated the comments to clarify.
|
||
-- Match any key-value pair where key is a string and value is a number | ||
for key, value in buf:gmatch("(%a+)%s*([%-%.%d]+)") do | ||
parsed_values[key] = tonumber(value) -- Store key-value pair in the table |
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.
Storing as a map is not great, it should be a list. A map's order is not defined so the log fields could be different each time depending on memory allocation etc.
Maybe a check if the log keys have been defined and if not build it separately so the code only has to run once anyway, as Pete correctly noted it can't be changed anyway
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.
Although table order is not guaranteed, my testing on hardware shows that it works fine. I do like the idea of build the fields only once. I'll add that.
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.
Done! I also only assemble the log structure string once now too.
Signed-off-by: Ryan Friedman <[email protected]>
Bin logger for https://www.licor.com/products/trisonica/LI-550-mini
Dynamically writes log depending on what data outputs you enable.
Here's a uvw velocity plot.

Follow up:
Fold this data into ArduPilot, share it via MAVLink or DDS outside AP, and use it as the airspeed source for the EKF.