Skip to content

Bug for yaw in data converter #105

@YangyangFu

Description

@YangyangFu

Is this a bug for calculating yaw?

def quart_to_rpy(qua):
x, y, z, w = qua
roll = math.atan2(2 * (w * x + y * z), 1 - 2 * (x * x + y * y))
pitch = math.asin(2 * (w * y - x * z))
yaw = math.atan2(2 * (w * z + x * y), 1 - 2 * (z * z + y * y))
return roll, pitch, yaw

The quaternion should be (w, x, y, z). And shouldn't the correct code be:

def quart_to_rpy(qua):
    w, x, y, z = qua
    roll = math.atan2(2 * (w * x - y * z), 1 - 2 * (x * x + y * y))
    pitch = math.asin(2 * (w * y + x * z))
    yaw = math.atan2(2 * (w * z - x * y), 1 - 2 * (z * z + y * y))
    return roll, pitch, yaw

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions