-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlib_probe.ks
More file actions
53 lines (42 loc) · 1.32 KB
/
lib_probe.ks
File metadata and controls
53 lines (42 loc) · 1.32 KB
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
49
50
51
52
53
@LAZYGLOBAL OFF. // #include init
FOR f IN LIST(
"lib_steer.ks", // #include lib_steer
"lib_geo.ks", // #include lib_geo
"lib_science.ks" // #include lib_science
) { runScript(f,debug()). }
GLOBAL WP_BUFFER IS 30.
FUNCTION pointAtSun {
steerSun().
WAIT UNTIL steerOk().
steerOff().
}
FUNCTION visitContractWaypoints {
// max_dist in kilometres
PARAMETER max_dist,days_limit.
pointAtSun().
LOCAL etaList IS LIST().
SET etaList TO listContractWaypointsbyETA(SHIP, max_dist, days_limit).
FOR details IN etaList {
LOCAL wp_time IS details[0].
LOCAL wp_name IS details[1].
LOCAL ca_dist IS details[2].
LOCAL wp_spot IS details[3].
LOCAL time_str IS formatTS(wp_time,TIME:SECONDS-MISSIONTIME).
pOut("Next waypoint: " + wp_name +
". Expected closest approach of " + ROUND(ca_dist) + "m at " + time_str).
doWarp(wp_time - WP_BUFFER).
LOCAL prev_dist IS greatCircleDistance(BODY,SHIP:GEOPOSITION,wp_spot).
LOCAL done IS FALSE.
UNTIL done {
WAIT 0.25.
LOCAL wp_dist IS greatCircleDistance(BODY,SHIP:GEOPOSITION,wp_spot).
IF NOT done AND wp_dist > prev_dist {
pOut("Closest approach. Triggering science.").
doScience().
resetScience().
SET done TO TRUE.
} ELSE { SET prev_dist TO wp_dist. }
}
pointAtSun().
}
}