Something fishy in the yaw reset code

Hi,

I was browsing the code to follow the chain of what causes yaw resets, when I came across this function:

void NavEKF2::requestYawReset(void)
{
    for (uint8_t i = 0; i < num_cores; i++) {
        core[primary].EKFGSF_requestYawReset();
    }
}

That can’t be right… can it? If we have N cores, then we reset the primary core N times. Looking at nearby code I’m assuming this should be either

    if (core) {
        core[primary].EKFGSF_requestYawReset();
    }

or

    for (uint8_t i = 0; i < num_cores; i++) {
        core[i].EKFGSF_requestYawReset();
    }

but I don’t understand the code so I can’t say which.

1 Like

you’re right, it is a bug. Thanks for letting us know!
PR to fix it here:

2 Likes