Skip to content

Instantly share code, notes, and snippets.

@KSAMissionCtrl
Created January 26, 2018 11:56
Embed
What would you like to do?
Automatic control of wheel friction to prevent spinouts at high speeds on takeoff/landing
set tailwheel to ship:partstagged("tail")[0]:getmodule("modulewheelbase").
set mainwheels to ship:partstagged("main").
set state to "speedup".
until false {
if state = "speedup" and ship:velocity:surface:mag >= 25 {
set state to "slowdown".
tailwheel:setfield("friction control", 0).
mainwheels[0]:getmodule("kspwheelbase"):setfield("friction multiplier", 0).
mainwheels[1]:getmodule("kspwheelbase"):setfield("friction multiplier", 0).
}
if state = "slowdown" and ship:velocity:surface:mag <= 25 {
set state to "speedup".
tailwheel:setfield("friction control", 1).
mainwheels[0]:getmodule("kspwheelbase"):setfield("friction multiplier", 1).
mainwheels[1]:getmodule("kspwheelbase"):setfield("friction multiplier", 1).
}
wait 0.01.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment