-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtos20S4.ks
More file actions
144 lines (114 loc) · 3.94 KB
/
Copy pathtos20S4.ks
File metadata and controls
144 lines (114 loc) · 3.94 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
// import
run shipstate.
run shipsystems.
run science.
// control params
set steerPID to PIDLOOP(-0.01, 0, 0, -0.15, 0.15).
set speedPID to PIDLOOP(0.1, 0.01, 0.2, 0, 1).
stage.
function stopAndMeasure {
local goo to ship:partsnamed("GooExperiment")[0]:getModule("ModuleScienceExperiment").
local sci to ship:partsnamed("science.module")[0]:getModule("ModuleScienceExperiment").
local trm to ship:partsnamed("sensorThermometer")[0]:getModule("ModuleScienceExperiment").
local bar to ship:partsnamed("sensorBarometer")[0]:getModule("ModuleScienceExperiment").
set speedPID:setpoint to 0.
set ship:control:mainthrottle to 0.
brakes on.
print "taking measurements".
wait 5.0.
set ship:control:mainthrottle to 0.
measureALL().
wait until goo:hasdata and sci:hasdata.
wait 5.0.
storeAll(0).
set ship:control:mainthrottle to 0.
print "all stored, waiting for cleanup".
wait until not (goo:inoperable or sci:inoperable).
print "cleaned up".
wait 5.0.
print "remeasuring".
set ship:control:mainthrottle to 0.
measureALL().
wait until goo:hasdata and sci:hasdata.
wait 5.0.
set ship:control:mainthrottle to 0.
storeAll(1).
print "all stored, waiting for cleanup (2)".
wait until not (goo:inoperable or sci:inoperable or goo:hasdata or sci:hasdata or trm:hasdata or bar:hasdata).
print "cleaned up".
wait 5.0.
print "rolling out".
brakes off.
set speedPID:setpoint to 10.
}
set speedPID:setpoint to 10.
set phase to 0.
set geotarget to latlng( -0.094469, -74.658433). // administartion
set geotarget to latlng( -0.086692, -74.663039). // administartion
when geotarget:distance < 10 then {
stopAndMeasure().
set geotarget to latlng( -0.094686, -74.647744). // astronaut complext
set geotarget to latlng( -0.095321, -74.654667). // astronaut complext
when geotarget:distance < 10 then {
stopAndMeasure().
set geotarget to latlng( -0.103452, -74.637692). // RnD
set geotarget to latlng( -0.102822, -74.643380). // RnD
when geotarget:distance < 10 then {
stopAndMeasure().
set geotarget to latlng( -0.090729, -74.614654). // VAB
set geotarget to latlng( -0.100779, -74.629151). // VAB
set geotarget to latlng( -0.103834, -74.631518). // VAB
when geotarget:distance < 10 then {
stopAndMeasure().
set geotarget to latlng( -0.112747, -74.614847). // KSC
when geotarget:distance < 10 then {
stopAndMeasure().
set geotarget to latlng( -0.123962, -74.611376). // tracking station
set geotarget to latlng( -0.116044, -74.609753). // tracking station
when geotarget:distance < 10 then {
stopAndMeasure().
set geotarget to latlng( -0.096976, -74.600203). // crawlerway
when geotarget:distance < 15 then {
stopAndMeasure().
set geotarget to latlng( -0.079782, -74.616950). // mission control
set geotarget to latlng( -0.069980, -74.610802). // mission control
when geotarget:distance < 10 then {
stopAndMeasure().
set geotarget to latlng( -0.067253, -74.628492). // SPH
set geotarget to latlng( -0.060558, -74.622420). // SPH
when geotarget:distance < 10 then {
stopAndMeasure().
set geotarget to latlng( -0.0485, -74.7131). // return home
when geotarget:distance < 10 then {
set phase to 4.
}
}
}
}
}
}
}
}
}
}
setBrakes(20).
until phase = 4 {
// throttle
set ship:control:mainthrottle to speedPID:UPDATE(time:seconds, ship:velocity:surface:mag).
if (ship:velocity:surface:mag - speedPID:setpoint > 2 ) {
brakes on.
} else {
brakes off.
}
set steerPID:setpoint to geotarget:heading.
set ship:control:wheelsteer to steerPID:UPDATE(time:seconds, realHEADING(steerPID:setpoint)).
print realHEADING(steerPID:setpoint) + "->" + geotarget:heading + " | " + geotarget:distance.
}
set ship:control:neutralize to true.
set ship:control:mainthrottle to 0.
lock throttle to 0.
brakes on.
wait until ship:velocity:surface:mag < 1.0.
wait 5.0.
setBrakes(50).
print "done".