ArduPilot / ArduPilot/UAVLogViewer

TypeError: C.trim is not a function with sqrt(XKF2.VWN)

Open
#480 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
258
Forks
296
PR merge metrics
No merged PRs in 30d

Description

Hello,

I would like to report a bug in UAV Log Viewer expression evaluation.

Environment:

UAV Log Viewer commit: 41cd65
Build date: Fri Nov 28 2025 15:55:38 GMT+0000
Browser: Firefox 152.0.6 (64-bit)
OS: Ubuntu

Problem:
Using sqrt() directly with XKF2.VWN causes the following error:

TypeError: C.trim is not a function

Steps to reproduce:

Works:

sqrt(4)
sqrt(GPS[0].Spd)
sqrt(XKF2[0].MN)
sqrt(XKF2[0].VWE)

Fails:

sqrt(XKF2[0].VWN)

The same error occurs with:

sqrt(XKF2[1].VWN)
sqrt(XKF2[0].VWN + 0)

However, forcing arithmetic conversion works:

sqrt(XKF2[0].VWN * XKF2[0].VWN)

XKF2.VWN works correctly in arithmetic expressions:

XKF2[0].VWN + 1
XKF2[0].VWN * 2
min(XKF2[0].VWN, 100)

It looks like XKF2.VWN is not converted correctly before being passed to some mathematical functions.

Could you please check the expression parser handling of XKF2.VWN fields?

Thank you.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the expression-evaluation path for XKF2 fields and reproduce the listed sqrt(XKF2[0].VWN) and arithmetic cases. Trace how the VWN value is converted before mathematical functions; done means the failing sqrt expressions work without breaking the examples that already pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.