-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEllipticalPeaks.py
48 lines (34 loc) · 1.03 KB
/
EllipticalPeaks.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from rbarvbar import sat, lvlh, plots
###################################################################################################
# Selecting options
import inspect
# time interval
dt = 0.1
save_every = 3.
n_orbits_to_save = 4.98
# Target
tgt = sat.Satellite(400, 400, "TGT")
tgt.set_init_pos(true_anomaly=0)
# Chaser
chaser = sat.Satellite(389, 320, "Chaser")
chaser.set_init_pos(true_anomaly=12.)
###################################################################################################
# Running the code
t = 0
nit = int(n_orbits_to_save * chaser.P / dt)
sen = save_every / dt
distances = lvlh.LVLH(tgt, chaser)
for ii in range(nit):
t = ii * dt
if ii % sen == 0:
do_save_state = True
else:
do_save_state = False
tgt.step(dt, do_save_state)
chaser.step(dt, do_save_state)
if do_save_state:
distances.compute_distances()
outdir = (inspect.stack()[0][1].split("/")[-1]).split(".py")[0]
pl = plots.Plot(tgt, chaser, distances, dt*sen, outdir=outdir)
pl.plot(time_ticks=10)
pl.make_movie(name=outdir)