Project Multistage2015 - Development Thread

fred18

Addon Developer
Addon Developer
Donator
Joined
Feb 2, 2012
Messages
1,639
Reaction score
43
Points
63
Hi guys,

I'm not far from the end of the default Vinka implementation, complete with autoguidance etc.

I'm finishing the autoguidance implementation and I wonder if the following command are actually used or not (never saw them in use):

spin, AoA, target, Attitude

as well as Disable(pitch) and Disable(roll).

As far as disable I've used only "jettison" up to now, never saw a Disable pitch or disable roll call.

About the other I can actually implement them, but I have to figure out how to do it properly.

What are your thoughts about this?

cheers guys

Fred
 

kerlix

Donator
Donator
Joined
Mar 28, 2010
Messages
291
Reaction score
43
Points
43
Hi guys,
...as well as Disable(pitch) and Disable(roll).

As far as disable I've used only "jettison" up to now, never saw a Disable pitch or disable roll call.


What are your thoughts about this?

cheers guys

Fred


First off, awesome job. I'm no programmer. At all. But having this "modernized" is such a great idea. Thank you for your time in doing this.

As for the "disable" calls: (Not knowing a thing about programming or how the module(s) work) Does this module support failures? For example, it could be used to disable certain parts of the ascent programming in the event of an engine failure, etc. to enable realistic abort procedures. Or something along those lines if a dev decided to get that detailed in their work.

That's the only thing that I could think of. But again, I have no knowledge on the subject and what the modules are able to do/handle.


If this offered no help at all, I apologize. I'm just grateful to you for your work on this, as well as to all the others here that are offering their assistance.
 

boogabooga

Bug Crusher
Joined
Apr 16, 2011
Messages
3,002
Reaction score
0
Points
0
I used spin when I upgraded the New Horizons launch.
http://www.orbiter-forum.com/showthread.php?p=508421&postcount=20

The target apoapsis (?) which was supposedly a command for the multistage guidance WOULD have been very useful, but IFAIK it didn't work.

I have seen a bug in the multistage guidance where the pitch gets stuck after the routine ends, and you end up spinning around endlessly with no way to control your attitude. Perhaps Disable(pitch, etc.) was meant to prevent the bug from occurring?

Disable(pitch) WAS used by the Neptune-1 add-on.
 

fred18

Addon Developer
Addon Developer
Donator
Joined
Feb 2, 2012
Messages
1,639
Reaction score
43
Points
63
First off, awesome job. I'm no programmer. At all. But having this "modernized" is such a great idea. Thank you for your time in doing this.
:tiphat:

Does this module support failures?
Will do. Once finished it will have a customizable probability for failures of engines or for rocket explosion. I will implement this at the very end anyway, I want to concentrate first on the more common operations.
If this offered no help at all, I apologize. I'm just grateful to you for your work on this, as well as to all the others here that are offering their assistance.
Comments and suggestions are always helpful :thumbup:

I used spin when I upgraded the New Horizons launch.
Noted, I'll check because I found some buggy behaviour of vinka on that, I'll fix it

The target apoapsis (?) which was supposedly a command for the multistage guidance WOULD have been very useful, but IFAIK it didn't work.
I'll see if I can make it work, think so

I have seen a bug in the multistage guidance where the pitch gets stuck after the routine ends, and you end up spinning around endlessly with no way to control your attitude. Perhaps Disable(pitch, etc.) was meant to prevent the bug from occurring?

Disable(pitch) WAS used by the Neptune-1 add-on.

Could be, I'll see how to manage to avoid the same situation killing the autopilot with all the relevant thrusters at the end of the guidance program. Anyway to obtain disable pitch and roll I'll simply lock the relevant thruster to level 0 and see if this works!

Thanks guys!

---------- Post added at 20:40 ---------- Previous post was at 19:32 ----------

I used spin when I upgraded the New Horizons launch.
http://www.orbiter-forum.com/showthread.php?p=508421&postcount=20

I see this in the guidance file, no spin call:

Code:
-10=PlaySound(Sound\Vessel\countdown1.wav)
-5=engine(0,100,5)
0=engine(100,100,1)
2=roll(3, 75, 93.1, 65, 1)
20.0=pitch(65.43, 64.98, 5.0)
25.0=pitch(64.98, 61.39, 5.0)
25=engine(100,60,1)
26=engine(60,60,19)
30.0=pitch(61.39, 57.32, 5.0)
35.0=pitch(57.32, 53.49, 5.0)
40.0=pitch(53.49, 49.88, 5.0)
45.0=pitch(49.88, 46.53, 5.0)
45.01=engine(60,100,0.99)
46=engine(100,100,1)
50.0=pitch(46.53, 43.52, 5.0)
55.0=pitch(43.52, 40.82, 5.0)
60.0=pitch(40.82, 38.40, 5.0)
65.0=pitch(38.40, 36.24, 5.0)
70.0=pitch(36.24, 34.30, 5.0)
75.0=pitch(34.30, 32.56, 5.0)
80.0=pitch(32.56, 31.01, 5.0)
85.0=pitch(31.01, 29.61, 5.0)
90.0=pitch(29.61, 28.69, 5.0)
95.0=pitch(28.69, 4.1, 25)
120=pitch(4.1, 4.1, 80)
200=pitch(4.1, 4.1, 10)
203=fairing()
210=pitch(4.1, 1.0, 36)
210.01=engine(100, 60, 34)
246=pitch(1.0, 1.0, 10)
256=pitch(1.0, 0, 12)
268=pitch(0, 0, 224)
492=engine(100, 0, 1)
493=engine(0, 0, 2)

:hmm:
 

kerlix

Donator
Donator
Joined
Mar 28, 2010
Messages
291
Reaction score
43
Points
43
Could it be somewhere else in the scenario file? Spin-up during the EPO before the ejection burn?


EDIT: I'd download the referenced ZIP myself and look through the code myself but I'm currently at work. I may not be able to code, but I've got a partial idea of what the code means. I just don't think my employer would be too happy with me downloading Orbiter files............
 
Last edited:

boogabooga

Bug Crusher
Joined
Apr 16, 2011
Messages
3,002
Reaction score
0
Points
0
No, it is in the ini.

I thought you meant spin in general in multistage2. I didn't know spin could be implemented in the guidance, or that that was what you were talking about specifically.

Still, I recommend that you leave it, since it could be really useful.
I'm thinking of sounding rockets. I might have used it for NH, had I known about it.
 

Donamy

Addon Developer
Addon Developer
Donator
Beta Tester
Joined
Oct 16, 2007
Messages
6,832
Reaction score
87
Points
123
Location
Cape
Here's a shuttle guidance I did way back that uses the spin for the Roll to heads-up manuever.

Code:
-6=engine(0,100,6)
-5=PlaySound(sound\multistage\atlantis_launch.wav)
0=disable(jettison)
2=roll(2,86,43,78,-1)
6=PlaySound(sound\multistage\rollprogram.wav)
20=pitch(82,72,10)
30=pitch(76,70,20)
31=engine(100,65,6)
50=pitch(70,65,20)
61=engine(65,100,6)
68=PlaySound(sound\multistage\gothrottleup.wav)
70=pitch(65,60,20)
90=pitch(60,40,20)
110=pitch(40,40,20)
124=jettison()
130=pitch(40,32,10)
140=pitch(32,26,10)
150=pitch(26,20,30)
180=pitch(20,14,10)
190=pitch(14,10,10)
200=pitch(10,5,10)
210=pitch(5,3,40)
260=pitch(3,10,20)
280=pitch(10,20,300)
300=spin(5)
335=spin(3)
336=spin(1)
337=spin(0)
524=engine(100,0,1)
526=jetison()
 

fred18

Addon Developer
Addon Developer
Donator
Joined
Feb 2, 2012
Messages
1,639
Reaction score
43
Points
63
Here's a shuttle guidance I did way back that uses the spin for the Roll to heads-up manuever.

Code:
-6=engine(0,100,6)
-5=PlaySound(sound\multistage\atlantis_launch.wav)
0=disable(jettison)
2=roll(2,86,43,78,-1)
6=PlaySound(sound\multistage\rollprogram.wav)
20=pitch(82,72,10)
30=pitch(76,70,20)
31=engine(100,65,6)
50=pitch(70,65,20)
61=engine(65,100,6)
68=PlaySound(sound\multistage\gothrottleup.wav)
70=pitch(65,60,20)
90=pitch(60,40,20)
110=pitch(40,40,20)
124=jettison()
130=pitch(40,32,10)
140=pitch(32,26,10)
150=pitch(26,20,30)
180=pitch(20,14,10)
190=pitch(14,10,10)
200=pitch(10,5,10)
210=pitch(5,3,40)
260=pitch(3,10,20)
280=pitch(10,20,300)
300=spin(5)
335=spin(3)
336=spin(1)
337=spin(0)
524=engine(100,0,1)
526=jetison()

Thanks!

I finished the full vinka implementation and it seems to work, i'm just setting up the save/restore parameters.

Now all the autopilot modes described in the vinka documentation (should) work: roll, pitch, spin, attitude, target.

I just needed some other examples to try and this is very useful!

Cheers!
 

Donamy

Addon Developer
Addon Developer
Donator
Beta Tester
Joined
Oct 16, 2007
Messages
6,832
Reaction score
87
Points
123
Location
Cape
This Guidance file is for the Hll-B launch, which I am doing an update for the near HTV-5 mission.

Will this be ready to test soon ?

old release :
[ame="http://orbithangar.com/searchid.php?ID=4197"]H-IIB HTV[/ame]

Code:
 -10=PlaySound(sound\JAXA\H2Blaunch.wav)
-3=engine(0,100,3)
0=disable(jettison)
2=roll(2,78,136.5,65,1)
20=pitch(65,45,10)
30=pitch(45,40,20)
50=pitch(40,38,60)
110=pitch(38,35,8)
118=pitch(35,35,6)
124=pitch(35,30,16)
127=jettison()
131=jettison()
138=pitch(30,25,22)
150=pitch(25,20,50)
200=pitch(20,17,30)
230=pitch(17,12,50)
240=pitch(12,7,50)
244=fairing()
280=pitch(7,5,90)
390=pitch(5,5,20)
396=engine(0,0,1)
400=jettison()
406=engine(0,100,7)
412=pitch(5,10,20)
432=pitch(10,10,500)
944=engine(100,-0,0)
945=engine(0,0,0)
 

fred18

Addon Developer
Addon Developer
Donator
Joined
Feb 2, 2012
Messages
1,639
Reaction score
43
Points
63
Will this be ready to test soon ?

tonight or tomorrow if everything goes fine :coffee:

---------- Post added at 17:59 ---------- Previous post was at 06:13 ----------

Currently working on 2 issues I've discovered (thanks to Donamy):

1) in the guidance at the moment my pitch program controls also the roll (keeping it at 0 or at 180) so spin command doesn't work if a pitch program is running, I'm correcting it in order to make it possible to use them also combined (I'll put a control on the roll to check whether a spin call is running)
2) Booster composition: I've made a lot of testing up to now and the way I was adding the booster meshes has always worked, even with the delta 2 which has many boosters, but the way the jaxa boosters are defined are different than the usual way, so I have to figure out how to make all the options working at the same time. It's more a math problem than a programming problem, I'm confident to find the way to solve it soon.

---------- Post added at 19:41 ---------- Previous post was at 17:59 ----------

@Donamy: please note that in the .ini file of the Jaxa rocket the rotation speed of the booster is marked as
Code:
ROT_SPEED=250

according to vinka's documentation:
Code:
ROT_SPEED : rotation speed of 1st booster jettison (in rad/s), for other boosters, the
rotation speed vector is also rotated.

so it should be a vector and not a number, and 250 rad/s of course it's a crazy rotation. Actually many things in vinka didn't work perfectly and this problem didn't show, while with the new module the boosters separate with a crazy rotation around the X axis.
 

Donamy

Addon Developer
Addon Developer
Donator
Beta Tester
Joined
Oct 16, 2007
Messages
6,832
Reaction score
87
Points
123
Location
Cape
Understood, I'll look at it when you finish.
 

fred18

Addon Developer
Addon Developer
Donator
Joined
Feb 2, 2012
Messages
1,639
Reaction score
43
Points
63
This Guidance file is for the Hll-B launch, which I am doing an update for the near HTV-5 mission.


old release :
H-IIB HTV

Code:
 -10=PlaySound(sound\JAXA\H2Blaunch.wav)
-3=engine(0,100,3)
0=disable(jettison)
2=roll(2,78,136.5,65,1)
20=pitch(65,45,10)
30=pitch(45,40,20)
50=pitch(40,38,60)
110=pitch(38,35,8)
118=pitch(35,35,6)
124=pitch(35,30,16)
127=jettison()
131=jettison()
138=pitch(30,25,22)
150=pitch(25,20,50)
200=pitch(20,17,30)
230=pitch(17,12,50)
240=pitch(12,7,50)
244=fairing()
280=pitch(7,5,90)
390=pitch(5,5,20)
396=engine(0,0,1)
400=jettison()
406=engine(0,100,7)
412=pitch(5,10,20)
432=pitch(10,10,500)
[B]944=engine(100,-0,0)
945=engine(0,0,0)[/B]

Hi Don, I'm almost finished and everything seems to be working fine.

I have a doubt on your guidance file, which is not working also with the vinka's module: the last two lines at T+945 are far too late, the HTV is already in an iperbolic orbit when engine is cutting off. Also, the third digit of the engine call should not be 0, because it is the duration of the step.

I have been thinking a bit about this, do you agree with me? :sos:
 

Donamy

Addon Developer
Addon Developer
Donator
Beta Tester
Joined
Oct 16, 2007
Messages
6,832
Reaction score
87
Points
123
Location
Cape
Hi Fred,

That file as done a long time ago. I don't doubt it has errors. It may have been a borrowed one.
 

kuddel

Donator
Donator
Joined
Apr 1, 2008
Messages
1,627
Reaction score
151
Points
63
... Also, the third digit of the engine call should not be 0, because it is the duration of the step.

When I read the documentation right, a duration of 0 is perfectly sane.
The line:
944=engine(100,-0,0)
likes to kill thrust immediately (from 100% to 0% in 0 seconds),
while the next line is kind of redundant in this case, I agree:
945=engine(0,0,0)

A duration of 0 just means immediately, I would say.
 

fred18

Addon Developer
Addon Developer
Donator
Joined
Feb 2, 2012
Messages
1,639
Reaction score
43
Points
63
When I read the documentation right, a duration of 0 is perfectly sane.
The line:
944=engine(100,-0,0)
likes to kill thrust immediately (from 100% to 0% in 0 seconds),
while the next line is kind of redundant in this case, I agree:
945=engine(0,0,0)

A duration of 0 just means immediately, I would say.




Vinka's documentation says:
engine(starting_thrust, final_thrust, thrusting_time)
This will control the thrust of the main engine varying it from the value indicated in
“starting_thrust” to the value indicated in “final_thrust” in a time duration defined in
“thrusting_time”
. Thrust is indicated in percent and must be between 0 and 100.

a time duration of 0 actually it's not correct, also in general. An event which has a time duration of 0 would lead to have the pre-event status and the post-event status at the same time instant.

Anyway by reading this I am pretty sure that what Vinka was meaning was the same that I am thinking about: between time start and time finish there will be linear interpolation of the values, therefore to have an immediate event you can simply put a very very short duration with a third digit like 0.01, and it will work.
 

BrianJ

Addon Developer
Addon Developer
Joined
Apr 19, 2008
Messages
1,304
Reaction score
173
Points
63
Location
Code 347
When I read the documentation right, a duration of 0 is perfectly sane.
The line:
944=engine(100,-0,0)
likes to kill thrust immediately (from 100% to 0% in 0 seconds),
while the next line is kind of redundant in this case, I agree:
945=engine(0,0,0)

A duration of 0 just means immediately, I would say.
I kind of agree - a duration of 0 means immediately or by the end of the current simulation time-step.

The redundant line 945=engine(0,0,0)is there because there was a bug where the engine sometimes does not shut-down completely by the end of the command sequence time (I think, due to the linear interpolation not matching the number/size of time-steps).

Also, there was a bug: if the guidance file is commanding RCS to fire when the guidance file ends, the RCS is locked ON.

Would be good to fix these bugs.

Good luck and best regards,
Brian
 

fred18

Addon Developer
Addon Developer
Donator
Joined
Feb 2, 2012
Messages
1,639
Reaction score
43
Points
63
FIRST RELEASE!

So finally here we are!

Vinka's module re-implementation is finished!

From my tests it works, but for sure I need to gather your feedbacks before proceeding!

Things to know before installing:

- There is a document which rensemble the first few new features implemented.
- It will backup the multistage2.cfg and update it directly with the Multistage2015 call, so you will be able to test every scenario already written for the old Multistage2 by simply launching it. In case you would like to get back to the vinka's module, simpy restore the multistage2.cfg from the backed up one.
- code included, it's my first time!

I've inserted a couple of checks for engine calls in order to allow duration of call = 0 and to avoid the old vinka bug when shutting down the engine.

Also the killing of the autopilot ensures the shutdown of all the thrusters, so also the bug of the crazy rotating ship should be now only an old memory.

Credits and thanks inside documents.

Bug reports, comments, critics (and appreciation :lol:) awaited

Cheers!

Fred18
 

Attachments

  • Multistage2015.zip
    175.9 KB · Views: 24
Last edited:

fred18

Addon Developer
Addon Developer
Donator
Joined
Feb 2, 2012
Messages
1,639
Reaction score
43
Points
63
I updated it to GNU, GPL3.0 license included

Cheers
 

Attachments

  • Multistage2015.zip
    187 KB · Views: 33

Face

Addon Developer
Addon Developer
Beta Tester
Joined
Mar 18, 2008
Messages
4,221
Reaction score
173
Points
103
Location
Vienna
Quick feedback on the code before I get the chance to compile and test it here:

  1. Overall your code-base looks compact and clean. Well done! :thumbup: There was really no reason to fear embarrassment in the first place.
  2. In the Multistage2015.cpp, there is some code commented out at the end of the file. What is this?
  3. In the parser.cpp, there is the following sequence at the end of parseInterstages() and parseAdapter():
    Code:
        return;
        }else{
        return;
        }
        return;
    }
    Is there a reason for this not being simplified like the code below?
    Code:
        }
    }
  4. How do you want patches to be contributed?
 

fred18

Addon Developer
Addon Developer
Donator
Joined
Feb 2, 2012
Messages
1,639
Reaction score
43
Points
63
Quick feedback on the code before I get the chance to compile and test it here:

  1. Overall your code-base looks compact and clean. Well done! :thumbup: There was really no reason to fear embarrassment in the first place.

:tiphat: Thank you very much!

  • In the Multistage2015.cpp, there is some code commented out at the end of the file. What is this?

Since development is still ongoing I left it there: it's some code I used for getting information from default vinka module. I loaded the scenarios with both multistage2015 and multistage2 and with that code in postcreation I gathered some information from the vinka one. Also there is a start of initialization for the autopilot I will implement. Anyway, nothing to be considered, is there only because it's a preliminary release for beta testing.


  • In the parser.cpp, there is the following sequence at the end of parseInterstages() and parseAdapter():
    Code:
        return;
        }else{
        return;
        }
        return;
    }
    Is there a reason for this not being simplified like the code below?
    Code:
        }
    }

Sometimes I'm just afraid of loss of information or the computer that "looses the proper pattern" and I add some extra closing lines just to be sure that all the loop is closed and nothing is missing. For sure it's not necessary.

  • How do you want patches to be contributed?

Do you mean contribution to the code? Well for the time being I have this steps in my mind:

1) gather feedbacks from beta testers to see if the module is properly reproducing the vinka's one and correct eventual issues
2) finish the implementations I have in mind, especially the peg autopilot.
3) modify what is needed for orbiter2015.

Actually I let the code public so in the future, when the new "orbiter2028" will come out and I will be away or anything anybody can start from there and renew the multistage, for the moment I was not thinking of a repository or something "live" for multiple inputs.

Of course any help is appreciated and will be credited, if you check I also credited the functions and the inputs I had simply reading the forum in order not to disappoint anyone.

I know that relevant to programming I still have millions of Kilometers to do, but it's an hobby and I'm simply enjoying the learning curve :compbash: :lol:

PS: the dll included in the package is the exact compiled module of the code
 
Last edited:
Top