-
Notifications
You must be signed in to change notification settings - Fork 1
/
match_inc.ks
46 lines (35 loc) · 1.16 KB
/
match_inc.ks
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
parameter
other_thing, // i.e. target, vessel("name"), or body("name").
soonest is false. // true means use the soonest node, not highest.
// NOTE- This "soonest" is buggy and doesn't seem to work yet.
run once "/lib/prediction".
run once "/lib/burn".
set burn to inclination_match_burn(ship, other_thing:obt, soonest).
set utime to burn[0].
set deltaV to burn[1].
set duration to burn_seconds(deltaV:mag).
set lead_time to burn_seconds(deltaV:mag/2).
clearscreen.
print " ----------------------------------- ".
print " burn_vd is the vector to burn.".
print " ----------------------------------- ".
set burn_vd_tail to POSITIONAT(ship, utime).
set burn_vd to
vecdraw(
burn_vd_tail,
500*deltaV,
blue,
"dV "+round(deltaV:mag,1)+" m/s, " + round(duration,1) + "s",
1,
true).
set burn_done to false.
// Keep updating the vector location in background until burn is done:
when not burn_done then {
set burn_vd:start to POSITIONAT(ship, utime).
if not burn_done {
preserve.
}
}
do_burn_with_display( uTime - lead_time, deltaV, "n/a", "n/a", 5, 10).
set burn_done to true.
set burn_vd to 0.