Skip to content

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

Merged
merged 1 commit into from
May 25, 2025

Conversation

Ryanf55
Copy link
Contributor

@Ryanf55 Ryanf55 commented May 12, 2025

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.
image

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.

@Ryanf55 Ryanf55 changed the title AP_Scripting: Add wind decoder AP_Scripting: Add wind decoder for Trisonica LI-550 May 12, 2025
@Ryanf55 Ryanf55 force-pushed the wind-3d-logger branch 3 times, most recently from 6ce9322 to 281e788 Compare May 12, 2025 20:02
-- 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)
Copy link
Contributor

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.

Copy link
Contributor Author

@Ryanf55 Ryanf55 May 17, 2025

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
Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

@Hwurzburg Hwurzburg added the WikiNeeded needs wiki update label May 13, 2025
@Ryanf55 Ryanf55 requested review from IamPete1 and tpwrules May 17, 2025 20:29
tridge
tridge previously requested changes May 20, 2025
@tpwrules tpwrules dismissed tridge’s stale review May 25, 2025 01:09

moved to examples as requested

@tpwrules tpwrules merged commit 03adf5e into ArduPilot:master May 25, 2025
103 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants