Jump to content

PEGAS - Powered Explicit Guidance Ascent System - devlog


Reddy
 Share

Recommended Posts

Ok thank you very much ... i'm not a coder but i'm trying to understand ...

I am using the space shuttle system from spacedock:

https://spacedock.info/mod/1178/Space Shuttle System

I'm already trying to replace my 3 motors pointed towards the center of mass to have less torque, but apparently it's more complicated.

I found a program called Matlab, do you know?

 

Edited by La Piante
wrong language
Link to comment
Share on other sites

@La Piante I suggest you consider opening a separate thread, because your issue, as @Razgriz1 points out, is quite complicated and currently its solution lies outside the scope of what PEGAS is capable of. Usually I'm okay with providing help, but we're at a risk of drifting off-topic here.

Alternatively, you can open an issue (or even a pull request) on my github, if you feel a feature like this should make it into the program. If this is the case, I would rather we focused the conversation here on coming up with a general approach that would let users fly all kinds of weird spacecraft, not only the Shuttle. Perhaps I should add a sort of optional "steering intercept" function? Something like a delegate that the user could provide that would act like a sort of hook into the system, allowing any kind of transformation of the steering vector. By default it would be something like f(x)=x, but it could be overridden (e.g. in CONTROLS) with whatever (e.g. shuttleSteerDir). I'm not sure if I understand your approach @Razgriz1, I haven't had the time to review your code in detail -- would that work?

Edit: @La Piante Yes, I do know Matlab. I have programmed the entire prototype of PEGAS in Matlab. Please read this thread to gain some perspective :)

Edited by Reddy
Link to comment
Share on other sites

sorry for the inconvenience you did well to warn me.
 
When I read the different codes to try to understand, I realized that it is too much complicated for me. But I wanted to say congratulations to you for this script because it is very complicated. Well done.
But if you think that it is possible to add a function to calculate the steering vector then, I support you for that.
 
I'll post my issue on your github.
 
thank you
Link to comment
Share on other sites

@Reddy yeah, my function should work. I'm more than happy to try and adapt it for your script, though my understanding of delegates is somewhat lacking at the moment and I don't really understand the benefit of doing that over just a normal function call. I'd need to do a bit of learning on that subject before I'm able to help you with that.

But yes, generally what my function does is takes in an input direction, i.e. the normal direction you would use for steering, and outputs a transformed direction that you can lock your steering to. This transformed direction is the direction you need to point in order for your thrust vector to point through your center of mass in the original direction you input into the function. If your nominal thrust vector is already through your center of mass, then my function should just return the same direction (or near enough, due to floating point error) though I'll admit, I've never tested it on anything that didn't have offset thrust.

Edit: Scratch that, I think I get it now: you would do something like LOCK STEERING TO SteeringTransform(<target_direction>) and that SteeringTransform would be a delegate that defaults to just outputting the input with no transformation, but you could set that delegate to something else that does do a transformation instead of like say an if statement with a switch variable. I never really understood the benefit of delegates until just now... Most of my programming experience is just bespoke scripts for things at work or in KSP. I'm not used to generalizing my code.

If you come up with how you'd like to implement this on your end, I can see how I might hook my function into this and see how well it works.

Edited by Razgriz1
Link to comment
Share on other sites

7 hours ago, Razgriz1 said:

you would do something like LOCK STEERING TO SteeringTransform(<target_direction>) and that SteeringTransform would be a delegate that defaults to just outputting the input with no transformation, but you could set that delegate to something else that does do a transformation instead of like say an if statement with a switch variable.

You get it right @Razgriz1, this is exactly what delegates (aka function pointers - I'm more used to this term due to my extensive C/C++ background) are for!

Such a modification should be very easy to implement. I'll I've put it on the list of things to think about (link below). The only difficulty I see about this is testing. If you could help with this (since you've got a craft and transform function at hand), that would take a lot of hassle off my back :) 

@La Piante you can join the discussion I've opened myself: https://github.com/Noiredd/PEGAS/issues/38

Edited by Reddy
issue opened
Link to comment
Share on other sites

@ReddyI'm gonna need to do more testing anyway just to make sure it's doing exactly what I think it should. I've only ever really used it on one vehicle, though I have used it in two separate stages of the vehicle, where the offset is different (i.e. Shuttle+ET vs shuttle alone with OMS).

I'm happy to help you flesh this out some and to add my function as an example of something you can do with it. We can continue this discussion on the issue over on Github.

Link to comment
Share on other sites

1 minute ago, Razgriz1 said:

I have used it in two separate stages of the vehicle, where the offset is different

This is an extremely important piece of information! Thanks for mentioning it - we'll have to figure out a way to let this handle such cases as well. Since I saw you both post under the issue, let's move further discussion on this particular subject there :)

Link to comment
Share on other sites

  • 3 months later...
  • 5 months later...

Hi, what does it mean when it says UPFG status: Converging...?
I'm flying an Atlas B from Cape Canaveral and I followed all the steps of the tutorial and read every document that's in Github, and I haven't found anything on "converging", I only found where you explain what it is.
I must've overlooked it, but how can I fix it?

Link to comment
Share on other sites

4 hours ago, ElAlien859 said:

Hi, what does it mean when it says UPFG status: Converging...?
I'm flying an Atlas B from Cape Canaveral and I followed all the steps of the tutorial and read every document that's in Github, and I haven't found anything on "converging", I only found where you explain what it is.
I must've overlooked it, but how can I fix it?

It means that the algorithm is searching for a valid guidance scheme to start following. See here. If the launch vehicle is sufficient to reach orbit, and the initial unguided trajectory is decent, then it should converge pretty quickly and begin active guidance. However, PEGAS is not magic and can't find a valid guidance scheme if one does not exist given current parameters.

Typically I have found this to happen if my vehicle is incorrectly defined in the PEGAS setup. Especially with a stage-and-a-half rocket like the Atlas B, you'll need to be very careful about defining the vehicle. Usually, you should set PEGAS to activate only after the booster skirt has jettisoned. (This is pretty historically accurate as well)

Link to comment
Share on other sites

  • 7 months later...

Hello!

I am examining your code, and I was wondering one thing: What is the purpose of the launch vehicle descriptor file, such as

PEGAS/kOS/boot/AtlasV-532.ks

It contains parameters (such as massTotal, massFuel, isp, thrust), that can surely be obtained from the vehicle itself, correct? 

It seems as if they are redundantly specified in there, unless I am missing somethng.

Thanks!

Link to comment
Share on other sites

9 hours ago, SpaceFlightNut said:

Hello!

I am examining your code, and I was wondering one thing: What is the purpose of the launch vehicle descriptor file, such as

PEGAS/kOS/boot/AtlasV-532.ks

It contains parameters (such as massTotal, massFuel, isp, thrust), that can surely be obtained from the vehicle itself, correct? 

It seems as if they are redundantly specified in there, unless I am missing somethng.

Thanks!

Programatically determining the staging for your rocket via kOS is not a trivial problem, and relies on various assumptions about how a user sets up staging. It also pretty much entirely breaks down in non-traditional staging cases like the booster skirt jettison for the Atlas rocket, which isn't reflected in the stock dV readout at all. You also can't assume any other parameters such as engine ullage requirements or hotstaging requirements (useful in RSS/RO) and so having the user define their vehicle parameters is a much cleaner way to do this.

Link to comment
Share on other sites

There's also the reason of my own laziness: I chose to do it this way (i.e. settle with having to manually describe each launch vehicle) rather than go through the effort of coding up a solution that would (attempt to) figure all those things out automatically. Due to reasons @Razgriz1 mentioned, I thought this effort would be simply immense, and would add a whole lot of extra failure modes (and worst of all, in order to solve those failures, we'd probably need a way to override the automatic discovery by inputting this data manually... so back to square one).

PS: Anyone still using PEGAS? I'm working on a v1.3 as we speak :) 

EDIT: @Razgriz1, that upcoming-events-ETA display that you asked for ages ago - I've got it done ;)

Edited by Reddy
Link to comment
Share on other sites

  • 4 weeks later...
Posted (edited)

PEGAS v1.3 "Olympus" is out now!

At this point I think it's safe to say that this project is complete, and it has all you might possibly use - hence the release name "Olympus" feels appropriate. Below is a short list of features v1.3 brings:

  • GUI overhaul: better reporting of the vehicle and guidance status, including an event-by-event flight plan display; made possible because...
  • ...UPFG is now aware of jettison and shutdown events before they happen (via a mechanism called virtual stages)
  • new passive guidance mode, pitchProgram, allows fine-tuning the ascent with a pitch-altitude schedule - contribution by Aram1d (thank you!)
  • new event type: shutdown, allows shutting down specific engines (by part tags), also during active guidance
  • new event type: action, allows execution of standard action groups
  • new ullage type: hot, allows hot-staging by reversing the jettison-ignition order
  • new staging option: postStageEvent, allows jettison after ignition (e.g. an interstage ring, Saturn-style)
  • addons: you can now create custom extensions to PEGAS; an addon sharing repository has also been started

Aside from those, there's over a dozen of other tweaks, fixes and under-the-hood improvements, making this the largest update to PEGAS yet. Read details on the release page.

Given how complete the program now is and how little free time I've got to work on it, I decided to call v1.3 the final major release of PEGAS. There might be a minor update, should anyone find some bug needing a hotfix (I've deliberately delayed this release to test it properly, and I'm fairly confident it's good, but I've been surprised in the past so...), but it's highly unlikely that I'll want to add more features or carry overhauls as large as this one ever again (and, with KSP2 around the corner, I don't think we'll even need any).

This has been a really long journey, with the project being alive (on and off, admittedly) for well over 6.5 years (initial commit in my repository dates back to 12th February 2016). Thank you all for following my work and your support <3

PS: Give me a holler when KSP2 is out and we have a stable Realism Overhaul & kOS in the new game ;)

EDIT: As always, I forgot to change the UI version number from "v1.3-alpha" to "v1.3" - the release has been updated :sealed:

Edited by Reddy
release version number fix
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.

 Share

×
×
  • Create New...