Skip to content
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

AP_Camera: FOV quaternion should be Earth-Frame #28113

Open
robertlong13 opened this issue Sep 15, 2024 · 0 comments
Open

AP_Camera: FOV quaternion should be Earth-Frame #28113

robertlong13 opened this issue Sep 15, 2024 · 0 comments
Assignees

Comments

@robertlong13
Copy link
Collaborator

Gimbal attitude is reported in a weird "hypothetical earth-frame quaternion if you pointed the aircraft north", which I'm guessing is important for some historical compatibility reason. The gimbal attitude status message at least has a flag indicating if it's using this. The camera FOV status message does not have such a flag, as such I believe the quaternion should be the proper Earth-frame quaternion. You could check the gimbal attitude message, to see if the gimbal is using the "yaw is body-frame", but I think the FOV message should contain all the information needed by a GCS to turn pixel coordinates into a 3D ray vector.

In my testing during Mission Planner development, I'm using this dirty hack as a workaround:

    // getting corresponding mount instance for camera
    AP_Mount* mount = AP::mount();
    if (mount == nullptr) {
        return;
    }
    Quaternion quat;
    Location loc;
    Location poi_loc;
    if (!mount->get_poi(get_mount_instance(), quat, loc, poi_loc)) {
        return;
    }

    float roll, pitch, yaw;
    mount->get_attitude_euler(get_mount_instance(), roll, pitch, yaw);
    quat.from_euler(radians(roll), radians(pitch), radians(yaw) + AP::ahrs().get_yaw());

Platform
[ x ] All

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants