# Vega autopilot

#### ksc_houston

##### New member
I'm trying to make an autopilot for the Vega rocket (plugin [ame="http://www.orbithangar.com/searchid.php?ID=2546"]Vega launcher[/ame] ) because the one that came with the plugin cannot achieve my desired orbit. I had also removed the rocket's fourth stage because is not needed for my desired orbit (300x300 LEO circular).
I encounter problems with the giudance txt file, after the rocket is about 100km altitude and at an angle of 10 degrees, it starts to roll/pitch/way uncontrollable.
Any help is appreciated.
Vega.ini :
[MISC]
COG=3
FOCUS=1

[TEXTURE_LIST]
TEX_1=Exhaust2

[PARTICLESTREAM_1]
NAME=etapa1
SRCSIZE=0.6
SRCRATE=5000
V0=100
GROWTHRATE=12
ATMSLOWDOWN=0
LTYPE=EMISSIVE
LEVELMAP=LVL_PSQRT
LMIN=0
LMAX=1
ATMSMAP=ATM_PLOG
AMIN=1e-4
AMAX=1
TEX=Contrail2

[STAGE_1]
MESHNAME="vega\vega_1"
OFF=(0,0,0)
HEIGHT=11.65
DIAMETER=3
THRUST=2261000
EMPTYMASS=7431
FUELMASS=88365
BURNTIME=106
SPEED=(0,0,-2)
ENG_1=(0,0,-5.3)
ENG_DIAMETER=1.2
ENG_TEX=Exhaust2
ENG_PSTREAM1=etapa1

[STAGE_2]
MESHNAME="vega\vega_2"
OFF=(0,0,6.8)
HEIGHT=8.44
DIAMETER=1.9
THRUST=1196000
EMPTYMASS=1845
FUELMASS=23906
BURNTIME=72
SPEED=(0,0,-2)
IGNITE_DELAY=5
ENG_1=(0,0,-1.3)
ENG_DIAMETER=1
ENG_TEX=Exhaust2

[STAGE_3]
MESHNAME="vega\vega_3"
OFF=(0,0,15.8)
HEIGHT=4.36
DIAMETER=1.9
THRUST=225000
EMPTYMASS=833
FUELMASS=10115
BURNTIME=110
SPEED=(0,0,-2)
IGNITE_DELAY=250
ENG_1=(0,0,-2.8)
ENG_DIAMETER=0.7
ENG_TEX=Exhaust2

[FAIRING]
N=2
MESHNAME="vega\vega_fairing"
OFF=(0,0,17.7)
ANGLE=90 ;due to the fairing rotated with Shipedit.exe
HEIGHT=7.88
DIAMETER=2.6
EMPTYMASS=490
SPEED=2

MESHNAME="hispasetisat01"
OFF=(0,0,18.6)
HEIGHT=5.06
DIAMETER=2.62
MASS=700
ROT_SPEED=150

MODULE=spacecraft\spacecraft3
NAME=hispasetisat01
Guidance txt :
0=engine(0,120,0.5)
7=roll(90,80,50)
30=roll(80,70,50)
45=roll(70,60,50)
60=roll(60,50,50)
75=roll(50,45,50)
90=roll(45,25,50)
120=roll(25,15,50)
125=roll(15,10,50)
135=roll(10,10,50)
145=roll(10,10,50)
155=roll(10,10,50)
165=roll(10,10,50)
175=roll(10,10,50)
185=roll(10,10,50)
195=roll(10,10,50)
200=fairing()
205=roll(10,10,50)
215=roll(10,10,50)
225=roll(10,10,50)
235=roll(10,10,50)
245=roll(10,10,50)

#### Urwumpe

##### Not funny anymore
Donator
Why do you only roll?

#### Zatnikitelman

I think the problem is that if you still have fuel in whatever stage you're using after the guidance program ends, then the guidance system will start an uncontrollable roll or pitch that I've found no workaround for.

#### astrosammy

##### Dash!
Donator
I recommend using
246=disable(pitch)
247=disable(yaw)
also you only have to put roll once directly after "engine", the rest has to be pitch.

#### ksc_houston

##### New member
I tried the following but with no luck:
0=engine(0,120,0.5)
7=roll(90,80,50)
30=pitch(80,70,50)
45=pitch(70,60,50)
60=pitch(60,50,50)
75=pitch(50,45,50)
90=pitch(45,25,50)
120=pitch(25,15,50)
125=pitch(15,10,50)
200=fairing()
205=pitch(10,10,50)
250=pitch(10,10,50)
300=pitch(10,0,50)
350=pitch(0,0,50)
400=pitch(0,0,50)
450=pitch(0,0,50)
500=pitch(0,0,50)
549=disable(pitch)
550=disable(yaw)

The rocket remains at an angle of 80 (because of roll comand;thats why I used only roll for angle control) and at 50 km altitude its becoming uncontrollable.
Can someone make for me a guidance txt using the data from vega.iti (from my first post in the thread) ? Please.

#### Urwumpe

##### Not funny anymore
Donator
I tried the following but with no luck:

The rocket remains at an angle of 80 (because of roll comand;thats why I used only roll for angle control) and at 50 km altitude its becoming uncontrollable.
Can someone make for me a guidance txt using the data from vega.iti (from my first post in the thread) ? Please.

Your guidance txt makes no sense to me. Have you read about the lines before you started it? Or just read the examples of other guidance txt files?

#### ksc_houston

##### New member
I have read a bit. I told you that using roll instead pitch(with the same parameters) the rocket is pitching correctly (90->10 degrees). But just before the third stage ignition it starts to roll/pitch/yaw crazy .
If you can build me a guidance txt, I will remain thankful.

#### Urwumpe

##### Not funny anymore
Donator
Wait a minute... can it be that the coordinate system of your rocket is completely ruined? If it pitches as intended, if you roll, it looks like your rocket is rotated by 90°.

EDIT: No, makes no sense, the ini file is not having any evidence for rotations.

#### ksc_houston

##### New member
You may be very right. Any idea?
EDIT: Maybe in the scenario txt ?
BEGIN_DESC
Vega in the Kourou ELA 1 Launch Complex with the fictional Hispasetisat 01 to be launched to an eliptic orbit. Press P for an automatic launch.
END_DESC

BEGIN_ENVIRONMENT
System Sol
Date MJD 54311.5
END_ENVIRONMENT

BEGIN_FOCUS
Ship Vega
END_FOCUS

BEGIN_CAMERA
TARGET Vega
MODE Extern
POS 2.89 0.74 -110.96
TRACKMODE TargetRelative
FOV 60.00
END_CAMERA

BEGIN_HUD
TYPE Surface
END_HUD

BEGIN_MFD Left
TYPE Surface
SPDMODE 1
END_MFD

BEGIN_MFD Right
TYPE Orbit
END_MFD

BEGIN_STATIONS
END_STATIONS

BEGIN_SHIPS
Vega:VegaVega
STATUS Landed Earth
POS -52.5647293 5.0566391
FUEL 1
CONFIG_FILE ConfigVegaVega.ini
CONFIGURATION 0
CURRENT_STAGE 1
FAIRING 1
GUIDANCE_file ConfigVegaVega_guidance_eliptic.txt
END
END_SHIPS

#### Urwumpe

##### Not funny anymore
Donator
Lets go all your instructions step by step.

Code:
0=engine(0,120,0.5)
7=roll(90,80,50)
30=pitch(80,70,50)
45=pitch(70,60,50)
60=pitch(60,50,50)
75=pitch(50,45,50)
90=pitch(45,25,50)
120=pitch(25,15,50)
125=pitch(15,10,50)
200=fairing()
205=pitch(10,10,50)
250=pitch(10,10,50)
300=pitch(10,0,50)
350=pitch(0,0,50)
400=pitch(0,0,50)
450=pitch(0,0,50)
500=pitch(0,0,50)
549=disable(pitch)
550=disable(yaw)

0: The engine instruction has three parameters. You want to go from 0% thrust to 120% thrust in 0.5 seconds. Makes no sense to me.

7: Wrong roll program. You have not read the manual. Roll looks like that:

30: Pitch down from 80° to 70° in 50 seconds. As you should be still flying at about 90° then, causing a strange behavior.

etc...

Now, tell me. Have you really read the manual and looked at other examples of a guidance.txt?

For example:

Code:
-6=engine(0,100,6)
-5=PlaySound(soundmultistageatlantis_launch.wav)
0=disable(jettison)
2=roll(2,86,43,78,-1)
6=PlaySound(soundmultistagerollprogram.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(soundmultistagegothrottleup.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=jettison()

#### ksc_houston

##### New member
I have read the instructions from the manual but I told you that I encounter problems before the third stage burn (up to this point all is nominal, even with the wrong parameters for the roll instruction).
Can we speak on MSN/Skype/ICQ ?

#### Urwumpe

##### Not funny anymore
Donator
I have read the instructions from the manual but I told you that I encounter problems before the third stage burn (up to this point all is nominal, even with the wrong parameters for the roll instruction).
Can we speak on MSN/Skype/ICQ ?

No, you can find me in the IRC chat, but I doubt that I will have to tell you more than: Do what the manual says and follow it accurately.

It makes no sense using only three wrong parameters on the roll program, if it expects five. If multistage follows the classic dogma of "garbage in - garbage out", you just defined only the following parameters for the combined roll/pitch program:

When to start pitching (90 seconds after lift-off)
Initial pitch angle (80° - not 90°)
Where to roll to (50° heading)

Undefined and thus potentially random is:
Where to stop the pitch motion.
How the roll/pitch program should behave?

And when the manual tells you, that you should not use more than 100% thrust in engine instructions, this should be a law for you.

#### ksc_houston

##### New member
Tell me the IRC server and channel name.
EDIT: This is the original guidance program for polar orbit
0=engine(0,120,0.5)
12=roll(6,90,2,87,1)
35=pitch(87,40,115)
150=pitch(40,0,20)
170=pitch(0,0,10)
188=engine(0,0,335)
194=fairing()
445=pitch(0,0,6)
451=pitch(0,0,500)
453=engine(0,120,1)
607=engine(100,-10,1)

#### Urwumpe

##### Not funny anymore
Donator
Yes. Replace the 2 in the roll command by 90 and you will fly straight east.

#### ksc_houston

##### New member
Seems to work. Some minor tweaks (I want 3rd stage burn to last exactly to the point when orbit ecc is 0,00xx). Later I will post the final guidance txt so you can give me other advices, if I need.

#### Urwumpe

##### Not funny anymore
Donator
Seems to work. Some minor tweaks (I want 3rd stage burn to last exactly to the point when orbit ecc is 0,00xx). Later I will post the final guidance txt so you can give me other advices, if I need.

Read the multistage manual... I can only recommend this as there is THE instruction for guidance txt which can minimize ecc....

#### ksc_houston

##### New member
You reffer to target(target_apogee) ? THis will not work because I get into orbit using 2 burns (1st stage+2nd stage then coasting period then 3rd stage burn).

#### ksc_houston

##### New member
I've managed to use all 4 stages. With 1+2+3 i get into a 250x280 orbit. Now I must use the fourth stage to circularize it up to 350x350 using a Hohmann method. After the 3rd stage burnout & jettison I ignite the fourth stage. At this point, in the guidance file I have target(350). The problem is that when I get at T+the_time_I_used_for_target , Orbiter crashes to desktop. Any help will be appreciated.

Replies
8
Views
2K
Replies
5
Views
1K
Replies
14
Views
4K
Replies
1
Views
1K
Replies
2
Views
1K