Rotations
This example was generated on 2024-09-13T11:01:44.270.
Before diving into the creation of the axes graph, it is worth highlighting that transformations that express the relative orientation or its time-derivatives between two generic set of axes are represented by a Rotation
object, which stores a Direction Cosine Matrix (DCM) and its derivatives. This package leverages the already available ReferenceFrameRotations.jl to define the DCM objects.
A time-fixed rotation between two axes and its derivative can then be expressed as follows:
using FrameTransformations
using ReferenceFrameRotations
dcm = angle_to_dcm(π/3, :Z)
δdcm = DCM(0I)
R = Rotation(dcm, δdcm)
Rotation{2, Float64}(([0.5000000000000001 0.8660254037844386 0.0; -0.8660254037844386 0.5000000000000001 0.0; 0.0 0.0 1.0], [0.0 0.0 0.0; 0.0 0.0 0.0; 0.0 0.0 0.0]))
R[1]
DCM{Float64}:
0.5 0.866025 0.0
-0.866025 0.5 0.0
0.0 0.0 1.0
R[2]
DCM{Float64}:
0.0 0.0 0.0
0.0 0.0 0.0
0.0 0.0 0.0
A rotation object is returned by all the rotation functions that are applied to the FrameSystem
. It provide overloads to the basic algebraic operations so that multiplication and inversions can be efficiently computed leveraging the properties of rotation matrixes.
For example, to rotate a generic vector v
, we can simply do:
v = [1., -6., 3., 0., 5., 0]
R*v
6-element StaticArraysCore.SVector{6, Float64} with indices SOneTo(6):
-4.696152422706632
-3.8660254037844393
3.0
4.330127018922193
2.5000000000000004
0.0
The inverse can instead be taken as:
inv(R)
Rotation{2, Float64}(([0.5000000000000001 -0.8660254037844386 0.0; 0.8660254037844386 0.5000000000000001 0.0; 0.0 0.0 1.0], [0.0 0.0 0.0; 0.0 0.0 0.0; 0.0 0.0 0.0]))
See the Rotation API for more information on this object.
This page was generated using Literate.jl.