Jump to content

[It's Back!] Another Voyage Ares Mission, and A KSP'ers Crash Course in Realism Overhaul.


Nittany Tiger

Recommended Posts

16 minutes ago, Dafni said:

Man, I would love to see that on stream!

I use to livestream on a site for MLP (yeah, I'm an My Little Pony fan), but haven't tried it in a while.  Not sure if my laptop can stream KSP RSS/RO without lag, but I've been thinking of streaming again.  I would definitely want people to watch me do this mission after the hours I've put into the craft and practice.  If it goes well, then maybe I'll make a video and then make more videos of future missions.  I'm already thinking of taking Apollo to Titan as a personal extension to this universe.

Link to comment
Share on other sites

I'd suggest a Twitch account for more attention and views. Whatever you chose, make sure to post a link here.

Of course a video would be nice as well, but a live stream would definitely give it an amazing real life feel. I love to watch good KSP streams... it really is a bit like multiplayer KSP, I love the live interaction.

Link to comment
Share on other sites

2 minutes ago, Dafni said:

I'd suggest a Twitch account for more attention and views. Whatever you chose, make sure to post a link here.

Of course a video would be nice as well, but a live stream would definitely give it an amazing real life feel. I love to watch good KSP streams... it really is a bit like multiplayer KSP, I love the live interaction.

I have a Twitch account.  I'll probably stream it there.

Link to comment
Share on other sites

9 hours ago, Nittany Tiger said:

I have a Twitch account.  I'll probably stream it there.

Twitch has a way of saving the video as well I think, so kinda the best of both worlds.  Except for hammering your PC and internet link.  I'm generally maxing out my asynchronous internet link watching a twitch stream, so I'm guessing I couldn't come close to streaming one.  Yay for ADSL in semi-rural Australia.

Link to comment
Share on other sites

Yeah, it saves video, but not locally.  I also probably won't use that to make a video with music clips and text.  When I talk about making a video, I mean videos like what @winged and @Chris P. Bacon do, except with my video of the Ares video, I want to spend more time on details.  It's partly why I want to make a Venus probe, Mars rover, give my AMM an IVA, and change the Apollo capsule IVA so I can do some basic cinematics.

I actually think Interstellar music would go perfectly with this mission, but if I tried to post a video with it on Youtube, I would be Content ID'd in a heartbeat or worse.

Edited by Nittany Tiger
Link to comment
Share on other sites

  • 2 weeks later...
  • 3 weeks later...

Update: Been playing stock KSP again to take a break from this.  I'm also testing out KSP TOT to see if it can accurately plan flybys.  I'm going to do an Eve flyby mission in my career save.  If that works out, then I can use KSP TOT to plan this mission easily.

I want to get back on this soon to build the Venus probe and Mars Rover and finish my kOS script for the Saturn VB launch.

Furthermore, been talking over with the guys here about this mission: https://forum.nasaspaceflight.com/index.php?topic=35720.520  They gave me some ideas on post-Ares missions.  I'd also love to integrate Ronpur's patch into this somehow as a texture.  I think he'd be thrilled to see it fly.

index.php?action=dlattach;topic=35720.0;attach=1369813;image

Link to comment
Share on other sites

  • 1 month later...

Alright, I'm back to work on this project and on the home stretch.

Working on making a probe for the Venus flyby.  The stock parts make it difficult to make a small probe, so I'm trying out the US probes pack to see if I can't find and use something that might have flown on Ares.  Right now the top two candidates are the Jupiter probe from Galileo and Huygens from Cassini.

E5CBD9A9AEC00FCBE0C4CE432DBF8224FCE0D250 (1280×720)

They are good for size and can survive a Venus descent, but they both didn't exist in 1985, and Huygens was made by the ESA, which may or may have not been doing co-operative missions with NASA in the book.  Another possibility is finding the Pioneer Venus probes, though they weren't designed to land on Venus.  Still, they would be more era-accurate than something that flew in the 90's or 2000's in our timeline.

Link to comment
Share on other sites

  Tested the Galileo atmospheric probe and Huygens probe in Venus entries.  In both instances, RealChute and Venus' intense hit cause parachute failure, leaving both probes to free fall.

  With the Galileo probe, the small size of the probe caused it to fall too fast through Venus' soupy lower atmosphere and crash.  

  In contrast, Huygens' flat profile allowed it to never exceed 30 m/s after parachute failure, and it landed intact on Venus' surface at 12 m/s.  So this is the leading candidate to represent the Venus probe in my Voyage mission.

  For right now, I have Huygens attached to my Ares craft, but I might try to make a custom craft so the probe reflect more of what might been seen in 1985, unless having an ESA probe from the 90's - 2000's real time line isn't a big deal.

Edited by Nittany Tiger
Link to comment
Share on other sites

  • 2 weeks later...

Pics from probe tests:

E6C734B3E2ED10458F7D12CEC3EB7BF29C62E722 (1280×720)

AC664936492FC48491C394CDFAA35DFAE9D196F7 (1280×720)

F00139E426935F23098BDBDC16CDA0A08F54CE62 (1280×720)

B79F2038EBC9A49EC54B0537ACC455C19A3A902F (1280×720)

96C753AE6621D67F974F8E7B783F99611B55F8C7 (1280×720)

62F5212095001C5E936EFC5B0F77D41AB5670CA2 (1280×720)

Also starting on the Mars Rover.  This is going to be tricky to fit on the MEM, along with the weight restriction I'm going to abide by to keep the descent delta V high enough for a safe landing.

217BFAF122C33D4EE9EB668589F8520362D547A4 (1280×720)

All that's left is the AMM IVA, the possible enhancement of the Saturn VB autopilot, and some texture replacement, and Ares will be ready to launch.  Months of work finally comes together!

I think what I'm going to do is fly the mission once, post pics, maybe livestream it, and then fly the mission again and create a video for that.

Edited by Nittany Tiger
Link to comment
Share on other sites

More progress on the rover.  Now I've made it able to fit into the MEM and currently trying to figure out a way to deploy it.

I have IR hinges in places such that it will fold up quite well.

1BC9B57A82744FF5344736319D092A6DB6B06280 (1280×720)

Put on another IR hinge and extendable piston, it creates one way to deploy the rover:

C0D91D5DE0A8BC348F02DCDCDC089AB5FD83E44C (1280×720)

A9C7EA43CB751A689954F299742B9B98BC953799 (1280×720)

Unfortunately, it drops down too far on deployment, so I'm going to need to either build a longer deployment mechanism, or use something like a winch to get it down.

2B2B9520931404F4509C1872966A3C102FF8F4C6 (1280×720)

I'm also concerned about weight, and I don't want to add too much extra weight to the MEM and have it unable to land safely, but I won't worry about that until I test the MEM with the rover and deployment crane added on.  At worst, I'll either have to add more fuel to the descent stage, shave weight from the rover and crane, or omit it completely.

Link to comment
Share on other sites

I'm test streaming on Twitch if anyone wants to join.

http://www.twitch.tv/nittany_tiger

I'm be testing the MEM with the rover setup and may try to install the AAM IVA.  May also fly the Saturn VB if you wish to see it fly.  I probably should get the game clock set to March 1985 soon so I can set up the mission.  The only things left I want to do is the rover, IVA, and a Saturn VB autopilot coded in kOS.

Stream's done.  Went well until I tried to practice a landing with the MEM, and then I ran into game lag that made it pretty much impossible to do the landing.  I'll try to see what I can do to reduce the game lag during stream.

Thank you for anyone that stopped by.  I will be streaming again.  Hope to get these lag issues ironed out for the main mission stream if I can.

Edited by Nittany Tiger
Stream finished.
Link to comment
Share on other sites

Rover is pretty much done.

I added two more hinge sets and pistons, and now the rover deploys just fine.  Drives around fine as well after moving the wheels out.

Test drive on Earth.

0856386D20EA88F7E11C3F3B8C92878F3D484178 (1280×720)

MEM landed just fine with the crane and rover.

EC0415DD9BE2371DA3EE7E8A9AF09C54724ABFC2 (1280×720)

Rover seems to drive just fine on Mars, too.

232189EFA22A7FB8BA5A43C7FF9A1C2D40EC4F76 (1280×720)

And the Saturn VB launches just fine with the rover.  Didn't really see that being a problem.

Got a really nice view of SRB sep here.

CBA68F5C780FA7634204394A862C65C1B1C2EF28 (1280×720)

Did encounter some strange problems and regular mishaps, though.

Bad hyperediting of the MEM to Mars caused the Kraken to have fun with the rover,

DA0E81D8604B499B2B1DA90866769F313349CA5B (1280×720)

and me not paying attention during descent caused a crash.

9496E28BC0DF97F78960FDAEF87E5E6444C31B9C (1280×720)

Quite a spectacular crash.

Up next: IVA replacement, then finally the kOS script.

Link to comment
Share on other sites

Switching IVAs turned out to be easy.

3B8CE3279BC7CC18E0C6162B1C78CA82F999C718 (1280×720)

Switched a 6-person crew cabin's IVA to @raidernick's Skylab IVA with no trouble and embedded the part in my AMM.  Also spoofed the mass of the part to 10kg so it doesn't add weight that's not supposed to be in the AMM.  I'll show the part I embedded the custom AMM later.

EDIT: Here's the part and the reduced weight:

32D9BD2345BA4D81ED63E1D9B8255276E86B0B55 (1280×720)

Edited by Nittany Tiger
Link to comment
Share on other sites

Current version of the Saturn VB launch autopilot.  It's incomplete and based on the previous F-1A throttling program.  I want to display F-1A and SRB thrust levels on the terminal, so gotta figure out how to do that.

//Saturn VB Autopilot program

SET ddyn to 0.
SET dynzero to 0.

//If variables are lists, can I accees each element in loops below and make code more efficient?
SET Inboard to SHIP:PARTSTAGGED("F1AInboard")[0].
SET Outboard to SHIP:PARTSTAGGED("F1AOutboard1")[0].
SET SRB to SHIP:PARTSTAGGED("SRB1")[0].

CLEARSCREEN. //in case we need this

//Display event, throttle setting, F-1A thrust %, and SRB thrust %.

LOCK THROTTLE to 1.0.

STAGE.

PRINT "Ignition sequence start.".

//Display F-1A throttle here?
WAIT UNTIL (Inboard:THRUST/Inboard:MAXTHRUST) > 0.88.

STAGE.
CLEARSCREEN.

//Maybe countdown and abort mode display.
//Display needs to update in real-time.

//Display loop could continue on with a PRESERVE command after throttleback.
UNTIL MISSIONTIME > 25 {
  PRINT "Liftoff.".
  PRINT "Throttle setting: 100%".
  PRINT "F-1A Thrust: " + (Inboard:THRUST/Inboard:MAXTHRUST)*100 + "%".
  IF (SRB:MAXTHRUST > 0){
    PRINT "SRB Thrust: " + (SRB:THRUST/SRB:MAXTHRUST)*100 + "%". 
  }
  WAIT 0.01.
}

//Pitch for gravity turn a svel = 100m/s
//Adjust heading to meet propulsion stack inclination (or desired inclination).  Could have this able to be set as input prior to launch.

LOCK THROTTLE to 0.01.

//check dyn pressure change
//if ddyn < -0.04kPa or so, throttle to 85 (done)

UNTIL ddyn <= -0.04 {
  PRINT "Max Q.".
  PRINT "Throttle setting: 60%".
  PRINT "F-1A Thrust: " + (Inboard:THRUST/Inboard:MAXTHRUST)*100 + "%".
  PRINT "SRB Thrust: " + (SRB:THRUST/SRB:MAXTHRUST)*100 + "%".
  SET ddyn TO (SHIP:Q*constant:ATMtokPa) - dynzero. //units are kPa
  SET dynzero TO (SHIP:Q*constant:ATMtokPa).
  WAIT 0.01. //change to 0.1?
}

//throttle to 85%

LOCK THROTTLE to 0.63.
PRINT "Go at throttle up.".
PRINT "Throttled to 85%.".
WAIT 10.
//Stage SRBs and throttle to 100% when SRB thrust < 8% - 10%

//Center engine shutdown at 20 - 30s before MS-IC burnout (G >= 3.8g)

//Stage MS-IC

//Ignite MS-II and develop guidance to achieve circular orbit at ~200 km - 250 km
//Code should monitor vert vel and time to AP, but code should find optimal pitch profile for MS-II flight and orbital insertion (lowest possible dV usage)

 

Edited by Nittany Tiger
Link to comment
Share on other sites

My autopilot code as of this post.  It's still a WIP, but it's come a long way.  It's now two files due to a recommendation by the kOS documentation to put custom functions in separate files.  So here's AresLaunch.ks:

//Saturn VB Autopilot program

RUNPATH("AresLaunchDisplay.ks").

SET ddyn to 0.
SET dynzero to 0.

//If variables are lists, can I accees each element in loops below and make code more efficient?
SET Inboard to SHIP:PARTSTAGGED("F1AInboard")[0].
SET Outboard to SHIP:PARTSTAGGED("F1AOutboard1")[0].
SET SRB to SHIP:PARTSTAGGED("SRB1")[0].

CLEARSCREEN. //in case we need this

//Display event, throttle setting, F-1A thrust %, and SRB thrust %.

LOCK THROTTLE to 1.0.

STAGE.

//Countdown here?

UNTIL (Outboard:THRUST/Outboard:MAXTHRUST) > 0.88 {
  IF(Outboard:MAXTHRUST > 0) {  //Prevent NAN
    LaunchDisplay(0,2,Outboard:THRUST/Outboard:MAXTHRUST,0).
  }
  WAIT 0.01.
}

STAGE.
CLEARSCREEN.

//Maybe countdown and abort mode display.
//Display needs to update in real-time.

//Display loop could continue on with a PRESERVE command after throttleback.
UNTIL MISSIONTIME > 25 {
  IF(SRB:MAXTHRUST > 0) { //Prevent NAN
    LaunchDisplay(1,2,Outboard:THRUST/Outboard:MAXTHRUST,SRB:THRUST/SRB:MAXTHRUST).
  }
  WAIT 0.01.
}

//Pitch for gravity turn a svel = 100m/s
//Print that gravity turn is in progress.
//Adjust heading to meet propulsion stack inclination (or desired inclination).  Could have this able to be set as input prior to launch.

CLEARSCREEN.

LOCK THROTTLE to 0.01.

//check dyn pressure change
//if ddyn < -0.004kPa/0.01s or so, throttle to 85% (was -0.04kPa/0.1s)

UNTIL ddyn <= -0.004 {
  LaunchDisplay(2,0,Outboard:THRUST/Outboard:MAXTHRUST,SRB:Thrust/SRB:MAXTHRUST).
  SET ddyn TO (SHIP:Q*constant:ATMtokPa) - dynzero. //units are kPa
  SET dynzero TO (SHIP:Q*constant:ATMtokPa).
  WAIT 0.01. //change to 0.1?
}

//throttle to 85%

LOCK THROTTLE to 0.63.

CLEARSCREEN.

//4+Gs before SRB tail-off.

//Stage SRBs and throttle to 100% when SRB thrust < 10%
UNTIL SRB:THRUST/SRB:MAXTHRUST < .1 {
  LaunchDisplay(3,1,Outboard:THRUST/Outboard:MAXTHRUST,SRB:Thrust/SRB:MAXTHRUST).
  WAIT 0.01.
}

STAGE.

LOCK THROTTLE to 1.0.

//Center engine shutdown at 26s before MS-IC burnout (G >= 3.8g)

CLEARSCREEN.

UNTIL STAGE:Kerosene/(Outboard:FUELFLOW * 500) < 26 { // 150 ~ 40s remaining - triggered at stage -8 seconds. Times by 0.01?
  PRINT STAGE:Kerosene at (0,3).
  PRINT Outboard:FUELFLOW at (0,4).
  PRINT STAGE:Kerosene/(Outboard:FUELFLOW * 500) at (0,5).
  LaunchDisplay(4,2,Outboard:THRUST/Outboard:MAXTHRUST).
  WAIT 0.01.
}

Inboard:SHUTDOWN.

CLEARSCREEN.

//Manage g-forces here?

//Stage MS-IC
UNTIL Outboard:FLAMEOUT = TRUE {
  IF Outboard:MAXTHRUST > 0 {//Prevent NAN
    LaunchDisplay(5,2,Outboard:Thrust/Outboard:MAXTHRUST).
  }
  WAIT 0.01.
}

STAGE.

//Ignite MS-II

CLEARSCREEN.

WAIT 3.
STAGE.
PRINT "Second stage ignition.".

//Skirt seperation
WAIT 30.
STAGE.
PRINT "Skirt separation.".

//LES Tower jettison
WAIT 6.
AG27 on.
PRINT "Launch escape tower jettison.".

//Ignite MS-II and develop guidance to achieve circular orbit at ~200 km - 250 km
//Code should monitor vert vel and time to AP, but code should find optimal pitch profile for MS-II flight and orbital insertion (lowest possible dV usage)

Here's the subfile AresLaunchDisplay.ks:

//Display program for Ares Launch program.

SET State to list("Ignition Sequence Start", "Liftoff", "Max Q", "Throttle Up", "SRB Sep", "Center Engine Shutdown", "Staging", "Stage Two Ignition", "Skirt Separation", "LES Jettison", "SECO").
SET Level to list("60", "85", "100").

function LaunchDisplay{

  parameter statevariable.
  parameter throttlelevel.
  parameter liquidthrust.
  parameter SRBthrust is 0.
   
  PRINT State[statevariable] at (0,0).
  PRINT "Throttle Setting: " + Level[throttlelevel] + "%" at (0,1).
  
  IF statevariable <= 5 {
    PRINT "F-1A Thrust: " + ROUND(liquidthrust * 100,1) + "%." at (0,2).
  } ELSE {
    PRINT "J-2S Thrust: " + ROUND(liquidthrust * 100,1) + "%." at (0,2).
  }
  
  IF statevariable < 4 AND statevariable > 0 {
    PRINT "UA1564 Thrust: " + ROUND(SRBthrust * 100,1) + "%." at (0,3).
  }
}

Currently converting whatever units KSP uses for fuel to liters and kilograms of RP-1  so I can derive a stage time for center engine shutdown.  STAGE:Kerosene is given in unknown units and Outboard:FUELFLOW in tons/s.  I'll figure it out soon enough.

Testing the program means tons of test launches.  Somehow, there's fog in Cape Canaveral, so my rocket finds itself flying through a white abyss for a while.  Hopefully it's not a thunderstorm.  Don't need an Apollo 12 incident.

EE39E665AE6448FB8D4807163AED08D0F6E0D47A (1280×720)

I've had a couple of repetitive issues come up during launches.  One is minor but irritating where some sort of glitch upon physics load tricks the game into thinking the rocket has launched and it starts ticking the mission clock.  Since my code depends on the mission clock, it causes a minor timing issue with F-1A throttleback.

A larger issue though is the SLA bending as a result of sideslip.  This is sometimes so severe that the SLA actually bends over and eventually causes the whole rocket to pitch into a high AOA and break up violently.  Tried to apply a bit of magical space tape (struts), but that hasn't corrected the issue.  The only solution for now is to keep the rocket from pitching too far from prograde on launch until it gets mostly out of the atmosphere.

DF06CD5488FE1E4CA62D81133C6A892472E6EC7E (1280×720)

C87B23368422FEA93D73AC2385582A66D7B93173 (1280×720)

Edited by Nittany Tiger
Link to comment
Share on other sites

This is sandbox.  I've done a bit of RP-0, but I'm doing the Ares mission in sandbox.  I might do it in RP-0 if I ever get back to that.  This is pretty much straight to Mars in sandbox (well, swing by Venus to Mars).

I'm putting an incredible amount of effort into this.  Like I really could fly the mission now, but I want to make something presentable along with doing things in KSP I've never tried before but feel I can do like editing part files, programming in kOS, texture replacement, and whatever I can do to make this look realistic.  It's been a lot of fun, but it's also taking me a long time to get to where I want to be to actually make an attempt.  I should be flying this soon, though.

I'm always happy to get likes and responses.  It keeps me on this project since outside interest in my efforts drives me to make something presentable and hopefully enjoyable.

Link to comment
Share on other sites

8 hours ago, Nittany Tiger said:

This is sandbox.  I've done a bit of RP-0, but I'm doing the Ares mission in sandbox.  I might do it in RP-0 if I ever get back to that.  This is pretty much straight to Mars in sandbox (well, swing by Venus to Mars).

I'm putting an incredible amount of effort into this.  Like I really could fly the mission now, but I want to make something presentable along with doing things in KSP I've never tried before but feel I can do like editing part files, programming in kOS, texture replacement, and whatever I can do to make this look realistic.  It's been a lot of fun, but it's also taking me a long time to get to where I want to be to actually make an attempt.  I should be flying this soon, though.

I'm always happy to get likes and responses.  It keeps me on this project since outside interest in my efforts drives me to make something presentable and hopefully enjoyable.

Same here. I did say RO. :P Besides I don't really like career much anyways. Starts off too slow and I want to cut to the fun stuff. However I want to do an LEO station and moon landing first. As for editing stuff and using kOS, editing the files sounds really interesting. If it is not too cheaty, it could be used to make the game your own and play it the way you want to play it. Awesome idea. And kOS is something I've been wanting to try for a while now but I want to try it at a time that I want to focus on it, not everything else since it is a big learning curve.

Keep going! I am enjoying this. :D 

Fire

Link to comment
Share on other sites

Ahh OK.  I learned the stock game through playing sandbox and doing incremental missions, but that's because there was no career mode when I played.

3 hours ago, Firemetal said:

As for editing stuff and using kOS, editing the files sounds really interesting. If it is not too cheaty, it could be used to make the game your own and play it the way you want to play it.

  I've been editing parts to either make them match what might be in the book, make them more realistic, or add functionality.  For example, I added throttling to the F-1A engines in the FASA mod. They normally don't throttle, but in the book, they do.  I went with the throttling range in the Real Scale Boosters mod, which is 60% - 100%, and this combined with editing the SRB thrust curve helps to keep G forces and dynamic pressure to realistic levels.  

  The only "cheaty" things I've done is disable Remote Tech and use HyperEdit for warping craft around to practice parts of the mission.  When I do the entire mission, I'll do everything as realistically as possible.  Cheating would take the fun out of seeing if this mission is possible in real life.

  I never originally intended to use kOS, but I wanted to automate the F-1A throttling, and there was no other mod that could do this easily, so I installed kOS an made a simple throtting script after figuring out kOS (which took a bit, but good thing I knew how to program already).  Now I'm trying to turn the script into a full launch autopilot just to see if I can do it, and it'll also mean I can focus on cinematic if or when I decide to make a video of this mission.  I could theoretically program kOS to run the entire mission, but it wouldn't be fun to just type a few commands and the mission play itself.  

  I'm also hoping writing a kOS script to fly a rocket by itself could be used to demonstrate coding ability to help land me a programming job.  I know kerboscript isn't used outside of KSP, but the ability to program in what could be described as C#-lite might still be a selling point on an interview.  Plus, I might be learning C# itself and writing some KSP mods soon as a further test of coding ability.  This is all passion-driven work.

  P.S. Good luck on your RSS adventures, Fire.  RSS is fun to learn, but the learning curve is very steep.  Even with tons of experience in stock, RSS is hard to learn.  I had to relearn how to make orbit in RSS and it took perseverance and luck to do it (because I tried to learn using the FASA Saturn 1B, which isn't the easiest thing to fly).  My advice is don't be afraid to build something ridiculous and overpowered to get into orbit so you can get used to how launches work in RSS/RO.

Edited by Nittany Tiger
Link to comment
Share on other sites

I won't be afraid to. I have been thinking about different LEO launchers, 2.5-2.75m, 3.75m, 5m, and 10m. I think all missions to other planets with Kerbals will be multi-launch spacecraft, even with the Mun. I am really enjoying RO so far.

Also I should have a thread in mission reports coming out soon and one in spacecraft exchange. After getting to know stock for months now, it is fun to try something new and learn to understand real world launches more easily. 

Thanks,

Fire

Link to comment
Share on other sites

  I love doing in-orbit assemblies.  It's fun to dock the stuff, though docking itself is time-consuming.  A lot of my stock missions to Minmus are Kerbin Orbit Rendezvous-style missions with a lander/return capsule mated to a drive stage.  For Munar missions, I go with Munar Orbit Rendezvous because I love the Apollo missions and just like the style of a single-launch rocket with a lander and CSM.  I'll post the craft I use in the relevant thread.

  Can't wait to see your RO stuff.

Back on topic, here's my current version of my kOS launch script.  I finally got a way to measure stage time after discovering some facts I overlooked.  Turns out it's not too hard to get stage timing.  I ended up diving the fuel mass of the MS-IC stage by five times the rate of fuel consumption of a single F-1A engine.  Fuel mass was obtained by subtracting the total mass of the MS-IC stage by the dry mass.

//Saturn VB Autopilot program

RUNPATH("AresLaunchDisplay.ks").

SET ddyn to 0.
SET dynzero to 0.

//If variables are lists, can I accees each element in loops below and make code more efficient?
SET Inboard to SHIP:PARTSTAGGED("F1AInboard")[0].
SET Outboard to SHIP:PARTSTAGGED("F1AOutboard1")[0].
SET SRB to SHIP:PARTSTAGGED("SRB1")[0].
SET MSIC to SHIP:PARTSTAGGED("MS-IC")[0].

CLEARSCREEN. //in case we need this

//Display event, throttle setting, F-1A thrust %, and SRB thrust %.

LOCK THROTTLE to 1.0.

STAGE. //F-1A ignition

//Countdown here?

UNTIL (Outboard:THRUST/Outboard:MAXTHRUST) > 0.88 {
  IF(Outboard:MAXTHRUST > 0) {  //Prevent NAN
    LaunchDisplay(0,2,Outboard:THRUST/Outboard:MAXTHRUST,0).
  }
  
  WAIT 0.01.
}

STAGE.  //SRB ignition and liftoff
CLEARSCREEN.

//Maybe countdown and abort mode display.

//Ultimate goal of steering program is to set rocket into pre-programmed circular orbit of 200 km - 250 km.
//Pitch by x degrees, then follow prograde until rocket reaches 

//Print that gravity turn is in progress.
//Pitch and roll program happen before T + 25.

//Display loop could continue on with a PRESERVE command after throttleback.
UNTIL MISSIONTIME > 25 {
  IF(SRB:MAXTHRUST > 0) { //Prevent NAN
    LaunchDisplay(1,2,Outboard:THRUST/Outboard:MAXTHRUST,SRB:THRUST/SRB:MAXTHRUST).
  }
  WAIT 0.01.
}


//Adjust heading to meet propulsion stack inclination (or desired inclination).  Could have this able to be set as input prior to launch.

CLEARSCREEN.

LOCK THROTTLE to 0.01. //F-1A throttle to 60% for max Q

//check dyn pressure change
//if ddyn < -0.004kPa/0.01s or so, throttle to 85% (was -0.04kPa/0.1s)

UNTIL ddyn <= -0.004 {
  LaunchDisplay(2,0,Outboard:THRUST/Outboard:MAXTHRUST,SRB:Thrust/SRB:MAXTHRUST).
  SET ddyn TO (SHIP:Q*constant:ATMtokPa) - dynzero. //units are kPa
  SET dynzero TO (SHIP:Q*constant:ATMtokPa).
  WAIT 0.01. //change to 0.1?
}

LOCK THROTTLE to 0.63. //F-1A throttle to 85%

CLEARSCREEN.

//4+Gs before SRB tail-off.

//Stage SRBs and throttle to 100% when SRB thrust < 10%
UNTIL SRB:THRUST/SRB:MAXTHRUST < .1 {
  LaunchDisplay(3,1,Outboard:THRUST/Outboard:MAXTHRUST,SRB:Thrust/SRB:MAXTHRUST).
  WAIT 0.01.
}

STAGE. //SRB jettison

LOCK THROTTLE to 1.0. //F-1A throttle to 100%

//Center engine shutdown at 26s before MS-IC burnout (G >= 3.8g)

CLEARSCREEN.

UNTIL (MSIC:MASS - MSIC:DRYMASS)/(Outboard:FUELFLOW * 5) < 26 {
  LaunchDisplay(4,2,Outboard:THRUST/Outboard:MAXTHRUST).
  WAIT 0.01.
}

Inboard:SHUTDOWN. //Inboard cut-off.

CLEARSCREEN.

//Manage g-forces here?

//Stage MS-IC
UNTIL Outboard:FLAMEOUT = TRUE {
  IF Outboard:MAXTHRUST > 0 {//Prevent NAN
    LaunchDisplay(5,2,Outboard:Thrust/Outboard:MAXTHRUST).
  }
  WAIT 0.01.
}

PRINT "Main Engine Cut-off"
WAIT 1.

STAGE. //MS-IC staging.

//Ignite MS-II

CLEARSCREEN.

WAIT 3.
STAGE. //MS-II ignition.
PRINT "Second stage ignition.".

//Skirt seperation
WAIT 30.
STAGE.
PRINT "Skirt separation.".

//LES Tower jettison
WAIT 6.
AG27 on.
PRINT "Launch escape tower jettison.".

//Ignite MS-II and develop guidance to achieve circular orbit at ~200 km - 250 km
//Code should monitor vert vel and time to AP, but code should find optimal pitch profile for MS-II flight and orbital insertion (lowest possible dV usage)

There has been no changes to the Ares Launch Display program, so I'm not reposting it.  I may bring the list definitions to the main program to help it run faster.  I also might need to remove some WAIT statements in loops that might be causing performance issues and are potentially unnecessary.

I still have to write the display code for the second stage, but I'm going to switch focus first on potentially the most difficult part of this code, which is guidance.

Link to comment
Share on other sites

Been working on the steering portions of the autopilot.  Oh boy is this fun. :P  Seriously, though, this has been a lot of fun to learn, but it's not without stress and frustration.

I've had to teach myself KSP and Unity's co-ordinate system since my first guesses at proper rotation and steering vectors led to wild and unpredictable rocket behavior, or so I thought.  Anyway, I opened up GIMP and made myself a pic to visualize what I think KSP's co-ordinate system is like:

SLFx0bA.png 

I had also started doing a body diagram for the rocket during ascent beforehand to see what I would need to do to make kOS command a proper gravity turn for the rocket.

9jMDaVy.png

Forgive me for any mathematical or physical errors in this diagram.  There might be a few (like angle of attack might not be between v and a).  This is all just in case I need to use kOS to model an equation for the pitch profile.  Can you say differential equations?  I'm excited. :D  Haven't done those in a while.

I decided to debug my steering issues by just having the rocket perform turns in one direction, starting with a roll maneuver.  I wrote in the following line:

  LOCK STEERING to Up + R(0,0,90).

and the rocket did roll clockwise to try to face East, but then overshot by 90 degrees before turning back and overshooting again by 90 degrees, and so on...  Looks like the cooked steering doesn't like my craft.  After trying a few things with the Steering Manager, I unfortunately concluded that I needed to do PID tuning, which is something I have never done before.  Nonetheless, it's not something I can't try to figure out, and after examining some of kOS's documentation on PID controllers along with some documentation online, I think I can tune this controller.  I already created a smaller script for recording the rocket's bearing deviations from the commanded roll heading versus time so I can plot that in Google Sheets and start to get a handle on the oversteer.  I could also just guess some Kd values, but I figure this might be more accurate in the end.

All this code does is fly the rocket straight up, perform the roll maneuver, and record the deviation.

//Saturn VB PID Tuning

RUNPATH("AresLaunchDisplay.ks").

//SET Inboard to SHIP:PARTSTAGGED("F1AInboard")[0].
SET Outboard to SHIP:PARTSTAGGED("F1AOutboard1")[0].
SET SRB to SHIP:PARTSTAGGED("SRB1")[0].

//SET STEERINGMANAGER:ROLLPID:KP to 0.
SET STEERINGMANAGER:ROLLPID:KI to 0.
SET STEERINGMANAGER:ROLLPID:KD to 0.

CLEARSCREEN.


SAS ON.
LOCK THROTTLE to 1.0.

STAGE. //F-1A ignition

UNTIL (Outboard:THRUST/Outboard:MAXTHRUST) > 0.88 {
  IF(Outboard:MAXTHRUST > 0) {  //Prevent NAN
    LaunchDisplay(0,2,Outboard:THRUST/Outboard:MAXTHRUST,0).
  }
}

STAGE.  //SRB ignition and liftoff
CLEARSCREEN.

LOG "Roll PID Tuning" TO Roll_Log.txt.
LOG "Kp: " + STEERINGMANAGER:ROLLPID:KP TO Roll_Log.txt.
Log "t,Roll Deviation" TO Roll_Log.txt.

//Execute 90-degree roll.
SET roll to 180 - 90.
LOCK STEERING to Up + R(0,0,roll).

//Print deviation from desired roll vs time.
UNTIL MISSIONTIME > 90 {

  SET r to (SHIP:BEARING) - (-roll + 180).
  LOG MISSIONTIME + "," + r TO Roll_Log.txt.
}

Hopefully, this won't take too long to do, and it should be fun to do something new.  I assume I might have to tune the pitch script as well, but it should be easier once I get a handle on tuning in general.

Link to comment
Share on other sites

  I spent all day yesterday trying to tune the proportional parameter of kOS's PID controller.  I first had to debug my tuning script.  Here was the final script I used:

//Saturn VB PID Tuning
DECLARE PARAMETER Kp.

RUNPATH("AresLaunchDisplay.ks").

//SET Inboard to SHIP:PARTSTAGGED("F1AInboard")[0].
SET Outboard to SHIP:PARTSTAGGED("F1AOutboard1")[0].
SET SRB to SHIP:PARTSTAGGED("SRB1")[0].

SET STEERINGMANAGER:ROLLPID:KP to Kp. //Wrong parameters?
SET STEERINGMANAGER:ROLLPID:KI to 0.
SET STEERINGMANAGER:ROLLPID:KD to 0.

CLEARSCREEN.


SAS ON.
LOCK THROTTLE to 1.0.

STAGE. //F-1A ignition

UNTIL (Outboard:THRUST/Outboard:MAXTHRUST) > 0.88 {
  IF(Outboard:MAXTHRUST > 0) {  //Prevent NAN
    LaunchDisplay(0,2,Outboard:THRUST/Outboard:MAXTHRUST,0).
  }
}

STAGE.  //SRB ignition and liftoff
CLEARSCREEN.

LOG "Roll PID Tuning" TO Roll_Log.txt.
LOG "Kp: " + STEERINGMANAGER:ROLLPID:KP TO Roll_Log.txt.
Log "t,Roll Deviation (Kp = " + Kp +")" TO Roll_Log.txt.

//Execute 90-degree roll.
SET roll to 180 - 90.
LOCK STEERING to Up + R(0,0,roll). //rotation not affected by PID settings because not cooked?

//Print deviation from desired roll vs time.
UNTIL MISSIONTIME > 90 {

  SET r to (SHIP:BEARING) - (-roll + 180).
  LOG MISSIONTIME + "," + r TO Roll_Log.txt.
  WAIT 0.001.
}

  You might be able to notice some commenting I did as I ran the rocket launch with different Kp setting.  This is because varying Kp seemed to do nothing to my roll behavior.

k6Z4fvT.png

  So I varied Kp from 0.001 all the way to 2000, and little or no change in my roll behavior was observed.  Just for reference, Kp = 1 is the default Kp value, blue is Kp = 2000, purple is Kp = 0.001, and magenta is Kp = 100.

  I would think there would be some change with the roll behavior as Kp is varied, so I'm baffled as to what's going on, and even concerned I'm not commanding a roll properly in kOS.  I may also just be improperly tuning the controller, as I have no experience and no knowledge of PID controllers up until trying to implement this steering program.

  Nonetheless, all literature seems to point to varying Kd as what I should be doing to dampen the oscillations.  I will do this next instead of continuing to vary Kp to produce some sort of roll behavior different from what's observed above.  My only other solution to the oversteer is to dampen the gimballing of the first stage engines.  Hopefully varying Kd with Kp = 1 gives me some results.

  I'm welcome to advice or criticism of my tuning as I'm not familiar with PID tuning, and I'm just doing my best based on what I'm reading from Wikipedia and the kOS documentation.  Plus, I don't want the kOS script itself to take over the purpose of this Ares recreation project, and I do want to fly the mission soon. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...