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.525721 + 0.331211⋅i + 0.0472393⋅j + 0.782103⋅k
julia> rand(DCM)
DCM{Float64}: 0.914219 0.126734 0.384892 -0.0950651 -0.856247 0.507743 0.393911 -0.500778 -0.77075
julia> rand(EulerAngles)
EulerAngles{Float64}: R(X) : 3.75207 rad ( 214.978°) R(Y) : 3.25544 rad ( 186.523°) R(Z) : 2.8572 rad ( 163.705°)
julia> rand(EulerAngleAxis)
EulerAngleAxis{Float64}: Euler angle : 1.76824 rad (101.313°) Euler axis : [0.269311, -0.897076, -0.350322]