-
Notifications
You must be signed in to change notification settings - Fork 44
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
QuatRotation construction using symbolics #248
Comments
The error is due to the normalization in the julia> using Rotations
julia> using Symbolics
julia> @variables q[1:4] = [1.0, 0, 0, 0]
1-element Vector{Symbolics.Arr{Num, 1}}:
q[1:4]
julia> r = QuatRotation(q..., false)
3×3 QuatRotation{Num} with indices SOneTo(3)×SOneTo(3)(Quaternion{Num}(q[1], q[2], q[3], q[4])):
q[1]^2 + q[2]^2 - (q[3]^2) - (q[4]^2) 2q[2]*q[3] - 2q[1]*q[4] 2q[1]*q[3] + 2q[2]*q[4]
2q[2]*q[3] + 2q[1]*q[4] q[1]^2 + q[3]^2 - (q[2]^2) - (q[4]^2) 2q[3]*q[4] - 2q[1]*q[2]
2q[2]*q[4] - 2q[1]*q[3] 2q[1]*q[2] + 2q[3]*q[4] q[1]^2 + q[4]^2 - (q[2]^2) - (q[3]^2)
julia> r^2
3×3 QuatRotation{Num} with indices SOneTo(3)×SOneTo(3)(Quaternion{Num}(q[1]^2 - (q[2]^2) - (q[3]^2) - (q[4]^2), 2q[1]*q[2], 2q[1]*q[3], 2q[1]*q[4])):
(q[1]^2 - (q[2]^2) - (q[3]^2) - (q[4]^2))^2 + 4(q[1]^2)*(q[2]^2) - 4(q[1]^2)*(q[3]^2) - 4(q[1]^2)*(q[4]^2) … 4(q[1]^2 - (q[2]^2) - (q[3]^2) - (q[4]^2))*q[1]*q[3] + 8(q[1]^2)*q[2]*q[4]
8(q[1]^2)*q[2]*q[3] + 4(q[1]^2 - (q[2]^2) - (q[3]^2) - (q[4]^2))*q[1]*q[4] 8(q[1]^2)*q[3]*q[4] - 4(q[1]^2 - (q[2]^2) - (q[3]^2) - (q[4]^2))*q[1]*q[2]
8(q[1]^2)*q[2]*q[4] - 4(q[1]^2 - (q[2]^2) - (q[3]^2) - (q[4]^2))*q[1]*q[3] (q[1]^2 - (q[2]^2) - (q[3]^2) - (q[4]^2))^2 + 4(q[1]^2)*(q[4]^2) - 4(q[1]^2)*(q[2]^2) - 4(q[1]^2)*(q[3]^2)
julia> principal_value(r)
ERROR: TypeError: non-boolean (Num) used in boolean context Some methods (e.g. |
@hyrodium Thanks a lot! |
Yes, that's right. If Symbolics.jl had compatibility with Quaternions.jl (JuliaGeometry/Quaternions.jl#123), the original error in this issue will be fixed, but I don't know whether other operations work correctly. |
I think we have the following three ways to solve this problem:
I'm not familiar with Symbolics.jl, so I think the first and the last choices will be acceptable for now. |
One should test if simply making Symbolics compatible with Quaternions resolves this issue. If so, a cleaner way would be to add Symbolics support with package extensions to Quaternions. |
I was trying to use a symbolic to construct a
QuatRotation
but failed.Can anyone help me to debug this or is it a limitation of this package?
The text was updated successfully, but these errors were encountered: