Random rotations
Sometimes it is necessary to generate random rotations. For example, if you are testing a stochastic system numerically, you need to perform a Monte Carlo simulation sampling the initial conditions. ReferenceFrameRotations.jl defines rand
function for all rotation representations, which samples a random rotation uniformly in SO(3).
julia> rand(Quaternion)
Quaternion{Float64}: - 0.521199 - 0.4494⋅i - 0.688986⋅j - 0.227354⋅k
julia> rand(DCM)
DCM{Float64}: -0.0566015 0.965869 -0.252771 -0.193968 0.237715 0.951771 0.979374 0.102901 0.173893
julia> rand(EulerAngles)
EulerAngles{Float64}: R(Y) : 6.07682 rad ( 348.176°) R(Z) : 1.3211 rad ( 75.6935°) R(Y) : 0.858694 rad ( 49.1995°)
julia> rand(EulerAngleAxis)
EulerAngleAxis{Float64}: Euler angle : 2.56912 rad (147.2°) Euler axis : [-0.291155, -0.297709, -0.909174]