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.106085 + 0.510503⋅i + 0.834236⋅j + 0.179394⋅kjulia> rand(DCM)DCM{Float64}: -0.0711744 -0.609939 -0.789245 -0.677702 -0.551007 0.486941 -0.731884 0.569531 -0.374139julia> rand(EulerAngles)EulerAngles{Float64}: R(Y) : 2.74985 rad ( 157.555°) R(X) : 5.43651 rad ( 311.489°) R(Y) : 0.340472 rad ( 19.5076°)julia> rand(EulerAngleAxis)EulerAngleAxis{Float64}: Euler angle : 1.78048 rad (102.014°) Euler axis : [0.285541, -0.929013, -0.235374]julia> rand(CRP)CRP{Float64}: X : + 31.0924 Y : - 6.88569 Z : - 29.8073julia> rand(MRP)MRP{Float64}: X : - 0.2703 Y : - 0.157447 Z : - 0.361578