Skip to content

Commit 53a1962

Browse files
basic axes, points and frames tutorials + bugfixes
1 parent d4057ff commit 53a1962

File tree

11 files changed

+559
-13
lines changed

11 files changed

+559
-13
lines changed

docs/make.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ if CI
1313
Pkg.add("Tempo")
1414
end
1515

16-
# include("generate.jl")
16+
include("generate.jl")
1717

1818
makedocs(;
1919
authors="JSMD Development Team",
@@ -23,12 +23,12 @@ makedocs(;
2323
pages=[
2424
"Home" => "index.md",
2525
"Tutorials" => [
26-
# "01 - Frame System" => "Tutorials/gen/t00_frames.md",
27-
# "02 - Rotation" => "Tutorials/gen/t01_rotation.md",
28-
# "03 - Axes" => "Tutorials/gen/t02_axes.md",
29-
# "04 - Points" => "Tutorials/gen/t03_points.md",
30-
# "05 - Light Time Corrections" => "Tutorials/gen/t04_lighttime.md",
31-
# "06 - Multi-threading" => "Tutorials/gen/t05_multithread.md"
26+
"01 - Frame System" => "Tutorials/gen/t00_frames.md",
27+
"02 - Rotation" => "Tutorials/gen/t01_rotation.md",
28+
"03 - Axes" => "Tutorials/gen/t02_axes.md",
29+
"04 - Points" => "Tutorials/gen/t03_points.md",
30+
# "05 - Light Time Corrections" => "Tutorials/gen/t04_lighttime.md",
31+
# "06 - Multi-threading" => "Tutorials/gen/t05_multithread.md"
3232
],
3333
# "Use Cases" => [
3434
# "CR3BP" => "Examples/gen/e01_cr3bp.md",

docs/src/Tutorials/gen/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!.gitignore

docs/src/Tutorials/t00_frames.jl

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
# # [Frame System Overview](@id tutorial_00_frames)
2+
# _This example was generated on DATEOFTODAY._
3+
4+
# The core object of `FrameTransformations` is the [`FrameSystem`](@ref), which provides
5+
# the capability to compute relative position, orientation and their time derivatives up to
6+
# order 3 (jerk), between standard and user-defined point and axes. It works by creating two
7+
# separate graphs that silently store and manage all the parent-child relationships between
8+
# the user-registered axes and points, in the form of `FramePointNode` and `FrameAxesNode`.
9+
10+
# These two objects define two precise entities:
11+
# - **Axes**: defines an orientation in space. These are related each other by means of a
12+
# [`Rotation`](@ref) transformation which relate one axes to a parent axes in
13+
# a certain time interval.
14+
# - **Points**: defines a location in space. These are related each other by
15+
# means of a [`Translation`]@(ref) transformation which relate one point to a parent point in a
16+
# particular axes in a certain time interval.
17+
18+
# Additionally, it is possible to create `Direction`s, as vector valued functions that could
19+
# be used to define custom frames.
20+
21+
#-
22+
#md # !!! note
23+
#md # A single [`FrameSystem`](@ref) instance simultaneously handles both the axes and
24+
#md # point graphs, regardless of what the user registers in it. For instance, if no
25+
#md # points are added, the point graph will remain empty. The same applies for directions.
26+
#-
27+
28+
# Additionally, any node can have several childs, each with different transformations with
29+
# respect to the parent node. However, they shall be **registered** within the
30+
# [`FrameSystem`](@ref) before being used in a transformation or as parents of other nodes.
31+
32+
33+
# ## Basic Constructors
34+
# The creation of a generic [`FrameSystem`](@ref) requires the definition of the maximum
35+
# desired transformation order and of its `DataType`, which in most applications is a `Float64`.
36+
# The transformation order is always one greater than the maximum desired time derivative.
37+
# For instance, if the user only desires to compute position and velocity components (i.e.,
38+
# order 1 time-derivative), the transformation order to be used is 2. Thus, the maximum
39+
# allowed transformation order is 4.
40+
41+
# In this example, we highlight the most basic way to initialise a [`FrameSystem`](@ref):
42+
43+
using FrameTransformations
44+
using Tempo
45+
46+
F = FrameSystem{2,Float64}()
47+
48+
# From this example, you can see that within the frame system there are both point and axes
49+
# graphs. However, at the moment they are completely empty since the graph was just created.
50+
51+
# Each [`FrameSystem`](@ref) object is assigned a reference timescale that is used to perform
52+
# computations with epochs and to parse ephemeris files. The default timescale is the
53+
# `BarycentricDynamicalTime`, however, the user is free to select the most suited timescale
54+
# for his applications. In this example, we set the `InternationalAtomicTime` as the reference scale.
55+
56+
F = FrameSystem{2,Float64,InternationalAtomicTime}()
57+
58+
# ## Graph Inspection
59+
60+
# Once a [`FrameSystem`](@ref) is constructed (and populated) there are many routines devoted
61+
# to inspect its content. As already said, there are three main *objects* that are contained
62+
# in the `FrameSystem`: **points**, **axes** and **directions**. For each of them series of
63+
# utility functions are made available in order to check for the presence of a registered point:
64+
65+
has_point(F, 1)
66+
67+
# a registered axes:
68+
69+
has_axes(F, 1)
70+
71+
# or a registered direction:
72+
73+
has_direction(F, :Root)
74+
75+
# Additionally, the possibility to get a dictionary containing all name-id relationships is
76+
# made available for axes, via the [`axes_alias`](@ref) method:
77+
78+
axes_alias(F)
79+
80+
# and points, via the [`points_alias`](@ref) method:
81+
82+
points_alias(F)
83+
84+
# Finally, the `FrameSystem` order and timescale might be retrieved via the associated methods:
85+
86+
order(F)
87+
88+
#-
89+
90+
FrameTransformations.timescale(F)
91+
92+
# Refer to the [API](@ref frames_api) for additional details.
93+
94+
# ## Basic Usage
95+
96+
#md # !!! note
97+
#md # Work in progress
98+
99+
# ## Ephemerides Support
100+
101+
# In certain scenarios, the transformations require usage of binary ephemeris kernels, e.g.,
102+
# the JPL's DE440 files. To support this applications, this package has an interface relying
103+
# on [JSMDInterfaces.jl](https://github.com/JuliaSpaceMissionDesign/JSMDInterfaces.jl)
104+
# `AbstractEphemerisProvider`s. Currently, this package is shipped with extension for the
105+
# following two ephemeris readers:
106+
# * [Ephemerides.jl](https://github.com/JuliaSpaceMissionDesign/Ephemerides.jl)
107+
# * [CalcephEphemeris.jl](https://github.com/JuliaSpaceMissionDesign/CalcephEphemeris.jl)
108+
109+
# Once the desired ephemeris provider is created, it can be used to register points or axes.
110+
# In this example we begin loading an old DE421 kernels to pass to the ephemeris reader.
111+
112+
using Ephemerides, Downloads
113+
114+
url = "https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/a_old_versions/de421.bsp";
115+
E = EphemerisProvider(Downloads.download(url));
116+
117+
F = FrameSystem{2,Float64}()
118+
119+
# Before registering any node, a set of root axes and a root node shall be anyway registered.
120+
121+
add_axes_icrf!(F)
122+
add_point!(F, :SSB, 0, 1)
123+
124+
# Points from the `EphemerisProvider` can be now registered.
125+
126+
add_point_ephemeris!(F, E, :Sun, 10)
127+
add_point_ephemeris!(F, E, :EMB, 3)
128+
129+
# Here the parent point will be inferred from the ephemeris.
130+
131+
F

docs/src/Tutorials/t01_rotation.jl

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# # [Rotations](@id tutorial_01_rotation)
2+
# _This example was generated on DATEOFTODAY._
3+
4+
# Before diving into the creation of the axes graph, it is worth highlighting that transformations
5+
# that express the relative orientation or its time-derivatives between two generic set of
6+
# axes are represented by a [`Rotation`](@ref) object, which stores a Direction Cosine Matrix
7+
# (DCM) and its derivatives. This package leverages the already available
8+
# [ReferenceFrameRotations.jl](https://github.com/JuliaSpace/ReferenceFrameRotations.jl)
9+
# to define the DCM objects.
10+
11+
# A time-fixed rotation between two axes and its derivative can then be expressed as follows:
12+
13+
using StaticArrays
14+
using FrameTransformations
15+
using ReferenceFrameRotations
16+
17+
dcm = angle_to_dcm/ 3, :Z)
18+
δdcm = DCM(0I)
19+
20+
R = Rotation(dcm, δdcm)
21+
22+
#-
23+
R[1]
24+
25+
#-
26+
R[2]
27+
28+
# A rotation object is returned by all the rotation functions that are applied to the `FrameSystem`.
29+
# It provide overloads to the basic algebraic operations so that multiplication and inversions
30+
# can be efficiently computed leveraging the properties of rotation matrixes.
31+
32+
# For example, to rotate a generic vector `v`, we can simply do:
33+
34+
v = [1.0, -6.0, 3.0, 0.0, 5.0, 0]
35+
R * v
36+
37+
# For a static vector vector `sv`:
38+
39+
sv = SA[1.0, -6.0, 3.0, 0.0, 5.0, 0]
40+
R * sv
41+
42+
# And for a [`Translation`](@ref)
43+
44+
t = Translation(1.0, -6.0, 3.0, 0.0, 5.0, 0)
45+
R * t
46+
47+
# The inverse can instead be taken as:
48+
49+
inv(R)
50+
51+
# See the [Rotation API](@ref rotation_api) for more information on this object.

0 commit comments

Comments
 (0)