Potential Bug in geodeticConversion

42 views
Skip to first unread message

Michael Mercurio

unread,
Aug 17, 2022, 12:29:42 PM8/17/22
to Basilisk Forum
I may have identified a potential bug in geodeticConversion::PCPF2LLA. The latitude is computed as:

llaPosition[0] = atan2( sqrt(pow(pcpfPosition[0],2.) + pow(pcpfPosition[1],2.)), pcpfPosition.norm());

I believe this should be:

llaPosition[0] = atan2(pcpfPosition[2], sqrt(pow(pcpfPosition[0], 2.0) + pow(pcpfPosition[1], 2.0)));

Is this function depreciated, or is a fix required?

Thank you!

benjamin....@u-space.fr

unread,
Aug 22, 2022, 9:49:21 AM8/22/22
to Basilisk Forum
Hello, 

It appears that the unit tests of the groundLocation module (the only BSk module to ever call PCPF2LLA() at Update()) do not actually call this function, and as such this bug may have gone unnoticed until now. 

benjamin....@u-space.fr

unread,
Aug 22, 2022, 9:50:13 AM8/22/22
to Basilisk Forum
Sorry, i pressed send to quickly! 

In summary, a fix is required, as well as an augmented unit test.

Hanspeter Schaub

unread,
Aug 22, 2022, 9:29:12 PM8/22/22
to Basilisk Forum
Howdy everyone, thanks for bringing this up.  Beginning of the semester here and I've not had a chance to confirm and create a fix.  It is on my to-do list.

Hanspeter Schaub

unread,
Aug 28, 2022, 4:51:31 PM8/28/22
to Basilisk Forum
Howdy Michael and Ben, had a chance to look at this and yes, this `PCPF2LLA()` computed the latitude incorrectly.  I think the author was thinking of using the `acos()` function looking at the attempted math, but it was not correct.  I'm pushing a fix to develop and added a not to the "known issues" page.  This only impacts users who used the helper function `specifyLocationPCPF()` method inside the `groundLocation` module.
Reply all
Reply to author
Forward
0 new messages