Jump to content

simonwoodburyforget

Members
  • Posts

    4
  • Joined

  • Last visited

Everything posted by simonwoodburyforget

  1. Sure, its the first program i wrote so i mean i feel there is a much better way but i need to do more reading up: [LIST=1] [*][COLOR=#000000]Clearscreen.[/COLOR] [*][COLOR=#000000]PRINT "Coaxial electornic Cyclic/collective pitch Script Running.".[/COLOR] [*][COLOR=#000000]PRINT " ".[/COLOR] [*][COLOR=#000000]PRINT "V1.0".[/COLOR] [*][COLOR=#000000]SET listCyclic1 to ship:PARTSTAGGED("Cyclic1").[/COLOR] [*][COLOR=#000000]SET listCyclic2 to ship:PARTSTAGGED("Cyclic2").[/COLOR] [*][COLOR=#000000]SET listCyclic3 to ship:PARTSTAGGED("Cyclic3").[/COLOR] [*][COLOR=#000000]SET listCyclic4 to ship:PARTSTAGGED("Cyclic4").[/COLOR] [*][COLOR=#000000]LOCK R to ship:control:pilotROLL * 20.[/COLOR] [*][COLOR=#000000]LOCK P to ship:control:pilotPITCH * 20.[/COLOR] [*][COLOR=#000000]LOCK L to ship:control:pilotMAINTHROTTLE * 15.[/COLOR] [*][COLOR=#000000]LOCK Y to ship:control:pilotYAW.[/COLOR] [*][COLOR=#000000]SET listEng1 to ship:PARTSTAGGED("engBlock1").[/COLOR] [*][COLOR=#000000] for x in listEng1 {[/COLOR] [*][COLOR=#000000] SET EngRot1 to x:GETMODULE("mumechtoggle"):GETFIELD("rotation:").}.[/COLOR] [*][COLOR=#000000]until ship:altitude > 40000 {[/COLOR] [*][COLOR=#000000]SET listEng1 to ship:PARTSTAGGED("engBlock1").[/COLOR] [*][COLOR=#000000] for x in listEng1 {[/COLOR] [*][COLOR=#000000] SET EngRot1 to x:GETMODULE("mumechtoggle"):GETFIELD("rotation:").}.[/COLOR] [*][COLOR=#000000] //PF + RL = 2[/COLOR] [*][COLOR=#000000] IF EngRot1 >= -22.5 AND EngRot1 <= -0[/COLOR] [*][COLOR=#000000] OR EngRot1 >= -112.5 AND EngRot1 <= -90[/COLOR] [*][COLOR=#000000] OR EngRot1 >= 157.5 AND EngRot1 <= 180[/COLOR] [*][COLOR=#000000] OR EngRot1 >= 67.5 AND EngRot1 <= 90[/COLOR] [*][COLOR=#000000] {for x in listCyclic1 {[/COLOR] [*][COLOR=#000000] x:GETMODULE("mumechtoggle"):SETFIELD("min rotate", + P - R / 2 - L).[/COLOR] [*][COLOR=#000000] }.for x in listCyclic2 {[/COLOR] [*][COLOR=#000000] x:GETMODULE("mumechtoggle"):SETFIELD("min rotate", + P - R / 2 + L).[/COLOR] [*][COLOR=#000000] }.for x in listCyclic3 {[/COLOR] [*][COLOR=#000000] x:GETMODULE("mumechtoggle"):SETFIELD("min rotate", + P + R / 2 + L).[/COLOR] [*][COLOR=#000000] }.for x in listCyclic4 {[/COLOR] [*][COLOR=#000000] x:GETMODULE("mumechtoggle"):SETFIELD("min rotate", + P + R / 2 - L).[/COLOR] [*][COLOR=#000000] }.}.[/COLOR] [*][COLOR=#000000] //PF + RR = 3[/COLOR] [*][COLOR=#000000] IF EngRot1 >= -45 AND EngRot1 <= -22.5[/COLOR] [*][COLOR=#000000] OR EngRot1 >= -135.5 AND EngRot1 <= -112.5[/COLOR] [*][COLOR=#000000] OR EngRot1 >= 135.5 AND EngRot1 <= 157.5[/COLOR] [*][COLOR=#000000] OR EngRot1 >= 45 AND EngRot1 <= 67.5[/COLOR] [*][COLOR=#000000] {for x in listCyclic1 {[/COLOR] [*][COLOR=#000000] x:GETMODULE("mumechtoggle"):SETFIELD("min rotate", + P + R / 2 - L).[/COLOR] [*][COLOR=#000000] }.for x in listCyclic2 {[/COLOR] [*][COLOR=#000000] x:GETMODULE("mumechtoggle"):SETFIELD("min rotate", + P + R / 2 + L).[/COLOR] [*][COLOR=#000000] }.for x in listCyclic3 {[/COLOR] [*][COLOR=#000000] x:GETMODULE("mumechtoggle"):SETFIELD("min rotate", + P - R / 2 + L).[/COLOR] [*][COLOR=#000000] }.for x in listCyclic4 {[/COLOR] [*][COLOR=#000000] x:GETMODULE("mumechtoggle"):SETFIELD("min rotate", + P - R / 2 - L).[/COLOR] [*][COLOR=#000000] }.}.[/COLOR] [*][COLOR=#000000] //PB + RR = 4[/COLOR] [*][COLOR=#000000] IF EngRot1 >= -67.5 AND EngRot1 <= -45[/COLOR] [*][COLOR=#000000] OR EngRot1 >= -157.5 AND EngRot1 <= -135[/COLOR] [*][COLOR=#000000] OR EngRot1 >= 112.5 AND EngRot1 <= 135.5[/COLOR] [*][COLOR=#000000] OR EngRot1 >= 22.5 AND EngRot1 <= 45[/COLOR] [*][COLOR=#000000] {for x in listCyclic1 {[/COLOR] [*][COLOR=#000000] x:GETMODULE("mumechtoggle"):SETFIELD("min rotate", - P + R / 2 - L).[/COLOR] [*][COLOR=#000000] }.for x in listCyclic2 {[/COLOR] [*][COLOR=#000000] x:GETMODULE("mumechtoggle"):SETFIELD("min rotate", - P + R / 2 + L).[/COLOR] [*][COLOR=#000000] }.for x in listCyclic3 {[/COLOR] [*][COLOR=#000000] x:GETMODULE("mumechtoggle"):SETFIELD("min rotate", - P - R / 2 + L).[/COLOR] [*][COLOR=#000000] }.for x in listCyclic4 {[/COLOR] [*][COLOR=#000000] x:GETMODULE("mumechtoggle"):SETFIELD("min rotate", - P - R / 2 - L).[/COLOR] [*][COLOR=#000000] }.}.[/COLOR] [*][COLOR=#000000] //PB + RL = 1[/COLOR] [*][COLOR=#000000] IF EngRot1 >= -91 AND EngRot1 <= -67.5[/COLOR] [*][COLOR=#000000] OR EngRot1 >= -180 AND EngRot1 <= -157.5[/COLOR] [*][COLOR=#000000] OR EngRot1 >= 90 AND EngRot1 <= 112.5[/COLOR] [*][COLOR=#000000] OR EngRot1 >= 0 AND EngRot1 <= 22.5[/COLOR] [*][COLOR=#000000] {for x in listCyclic1 {[/COLOR] [*][COLOR=#000000] x:GETMODULE("mumechtoggle"):SETFIELD("min rotate", - P - R / 2 - L).[/COLOR] [*][COLOR=#000000] }.for x in listCyclic2 {[/COLOR] [*][COLOR=#000000] x:GETMODULE("mumechtoggle"):SETFIELD("min rotate", - P - R / 2 + L).[/COLOR] [*][COLOR=#000000] }.for x in listCyclic3 {[/COLOR] [*][COLOR=#000000] x:GETMODULE("mumechtoggle"):SETFIELD("min rotate", - P + R / 2 + L).[/COLOR] [*][COLOR=#000000] }.for x in listCyclic4 {[/COLOR] [*][COLOR=#000000] x:GETMODULE("mumechtoggle"):SETFIELD("min rotate", - P + R / 2 - L).[/COLOR] [*][COLOR=#000000] }.}.[/COLOR] [*][COLOR=#000000] //Yaw[/COLOR] [*][COLOR=#000000] SET listEng1 to ship:PARTSTAGGED("engBlock1").[/COLOR] [*][COLOR=#000000] for x in listEng1 {[/COLOR] [*][COLOR=#000000] x:GETMODULE("mumechtoggle"):SETFIELD("coarse speed", 4 - Y).}.[/COLOR] [*][COLOR=#000000] SET listEng2 to ship:PARTSTAGGED("engBlock2").[/COLOR] [*][COLOR=#000000] for x in listEng2 {[/COLOR] [*][COLOR=#000000] x:GETMODULE("mumechtoggle"):SETFIELD("coarse speed", 4 + Y).}.[/COLOR] [*][COLOR=#000000]}.[/COLOR] [/LIST] also i used some tools to interface with IR if you don't know how that i run are pretty simple if you never played with parts modules (note: they're just example not exactly what i did..) SET partsList to ship:PARTSTAGGED("rotortag2"). for x in partsList { print x:modules. }. ^To find out what modules the part has (right click menu's... ect.) SET partsList to ship:PARTSTAGGED("rotortag2"). for x in partsList { log x:GETMODULE("mumechtoggle"):allevents to mylog. log x:GETMODULE("mumechtoggle"):allactions to mylog. log x:GETMODULE("mumechtoggle"):ALLFIELDS to mylog. }. ^This finds different type of in the right click menu options(events, actions, feilds(within each different modules)) (then it logs it to a file named mylog, you could print.... but cant copy from in game screen saves time SET rotorList to ship:PARTSTAGGED("rotortag2"). for x in rotorList { print x:GETMODULE("mumechtoggle"):GETFIELD("coarse speed", 4). }. ^Then i use it in a loop like i did in the script like so here. Also doing this requires slow motion mod because ksp is not able to read physics fast enough to make anything of this type of simulation, 1/2 or 1/3 is way enough to get it working. (i want to try and make it "not angle based branching" but i have yet to had the time to figure it out) .craft:http://pastebin.com/ug2703aN But basicly the blades have 4 different positions, where they set them selves to pitch front + roll left, PF + RR, PB + RL, PB + RR. And the angle of the blade is calculated depending on the amount of pitch, so say, 17 pitch forward + 12 roll / 2 = 14.5 degrees + 10 lift = 24.5 (then you have the opposite on the opposites sides further improving mobility) My on paper calculation for blade angle is this: P = Pitch = 20 forward R = Roll = 45 Right L = Thrust = 23 Up (back left)or(1) - 20 - 45 / 2 = -32.5 + 23 = - 9.5 (front left)or(2) 20 - 45 / 2 = - 12.5 + 23 = 10.5 (front right)or(3) 45 + 20 / 2 = 32.5 + 23 = 55.5 (back right)or(4) -20 + 45 / 2 = 12.5 + 12.5 + 23 = 35.5 So at each angle the blade is going to position it self at everyone of these times (1, 2, 3, 4) Depending on the pitch, roll, thrust. For the Yaw its really simple: Rotor Speed = + Left - Right = Chassis turning Right A force in one direction means you get an opposite reaction, making sure you keep the same amount of rotor speed ensures you keep the same amount of lift to not lose or gain altitude. (reddit post here: http://redd.it/2nql09)
  2. Is there a way to read player imputed ship controls? (pitch, yaw, roll) has the player changes the controls, is it possible to read it and do something with it (so say in this case, more pitch would activate more IR rotors, giving finer controls... (maybe if i figure it out it could tweak there speed but that's something else....)) (just been reading the wiki for the last week and was wondering if you guys can help with a few things.... just trying to see if it can help me control things with IR or not....)
  3. Iv been trying learn this mod since someone told me about it on reddit, i was asking about ways to do things in Inferno robotics that are slightly un humman. My idea was to make a rotor move each time i would be at a certain position while rotation.. (and to be specific, i have a wing attached to the rotor which needs to change its angle while it spins around another rotor, creating differential lift, changing the attitude of the craft) Any idea if this is possible? (im still learning coding little steps at the time, lots of fun)
×
×
  • Create New...