B-95B Cockroach

View previous topic View next topic Go down

B-95B Cockroach

Post by Echo_Delta_Oscar on Sun May 27, 2012 8:39 am



This Aircraft is probaply a little underpowered for its role, but I crafted it specifically to use a CCIP, as suggested by RA2Lover.
It is analog controlled and the other commands are the same as on my latest models, plud letter C to toggle bomb safety, thus activate the CCIP itself.
It is designed to be used with Ctrl+F10 view; here is what it looks like:



Code:


Val
{
   RollE(default=0,min=-25,max=25,step=4)
   RollW(default=0,min=-25,max=25,step=4)
   ViewA(default=0,min=-150,max=150)
   ViewB(default=0,min=-20,max=15)
   PBar(default=-4,min=-30,max=30,step=4)
   Pitch(default=-4,min=-30,max=30)
   Yaw(default=0, min=-20, max=20, step=2)
   Rudd(default=0, min=-20, max=20, step=0)
   Ster(default=0, min=-20, max=20)
   Trim(default=0, min=-360, max=360, step=0)
   Throttle(default=0, min=0, max=198000, step=0)
   Engine1(default=0, min=0, max=200000, step=0)
   Chocke1(default=0, min=0, max=2000, step=0)
   Prop1(default=45, min=45, max=90)
   Feat1(default=45, min=0, max=45)
   SO1(default=0)
   Gear(default=0, min=0, max=1, step=0)
   Gear1(default=-30, min=-30, max=0)
   Gear2(default=0, min=0, max=180)
   Gear3(default=120, min=0, max=120)
   Gear4(default=15, min=5, max=15)
   Gear5(default=20)
   Flap(default=0)
   FLP(default=155, min=155, max=180)
   ALVL(default=0, min=0, max=1, step=0)
   AALT(default=0, min=0, max=1, step=0)
   EB1(max=100, step=100)
   Ypar(default=0)
   BRK(default=0, min=0, max=200, step=200)
   ABR(default=180, min=135, max=180, step=3)
   EX1(default=0, min=0, max=20000)
   Smoke(default=1, min=1, max=4)
   Col1(default=#505050)
   Col1C(default=#707070)
   Col2(default=#202020)
   Col2C(default=#303030)
   Combat()
   Fuse()

   
}

Key
{

   7:Yaw(step=-2)
   9:Yaw(step=2)
   2:ViewA(step=5)
   3:ViewA(step=-5)
   0:ViewB(step=-1)
   1:ViewB(step=1)
   16:BRK(step=10), ABR(step=-15)
   
   
   
   
   
}

Body {
   Core(){

      N:Frame(angle=ViewB, option=1){S:RudderF(angle=ViewA, option=1){
      S:Frame(angle=160, option=1){S:Weight(name=Nose, angle=-160, color=Col1C){

      N:Cowl(effect=#ffff){N:Cowl(effect=#ffff){
      N:Cowl(angle=-150, effect=#a000){E:Cowl(angle=-92, option=4, effect=#a000){}W:Cowl(angle=-92, option=3, effect=#a000){}
      N:Cowl(angle=-30, effect=#a000){E:Cowl(angle=-90, effect=#a000){}W:Cowl(angle=-90, effect=#a000){}
      N:Cowl(effect=#a000){E:Cowl(angle=-90, effect=#a000){}W:Cowl(angle=-90, effect=#a000){}
      N:Cowl(color=Col2){E:Cowl(angle=-90, color=Col2){}W:Cowl(angle=-90, color=Col2){}
      N:Cowl(angle=-30, color=Col2){E:Cowl(angle=-92, option=3, color=Col2){}W:Cowl(angle=-92, option=4, color=Col2){}}}}}}
      N:Cowl(angle=150, effect=#a000){E:Cowl(angle=92, option=4, effect=#a000){}W:Cowl(angle=92, option=3, effect=#a000){}
      N:Cowl(angle=30, effect=#a000){N:Cowl(color=Col2){
      N:Cowl(color=Col2){N:Cowl(angle=30, color=Col2){E:Cowl(angle=92, option=3, color=Col2){}W:Cowl(angle=92, option=4, color=Col2){}}}}}}}}

      E:Frame(angle=-5, option=1){E:Trim(angle=-Pitch, color=Col2C){W:Chip(color=Col2C){}}}
      W:Frame(angle=-5, option=1){W:Trim(angle=Pitch, color=Col2C){E:Chip(color=Col2C){}}}
      S:Weight(color=Col1C){N:TrimF(angle=90, option=1){
      S:Weight(name=Bomb, color=Col1C){N:Arm(power=Fuse, option=2500000, color=Col2C){}
      S:Frame(color=Col1C){S:Chip(color=Col1C){}S:Trim(angle=90, color=Col1C){}}}
      E:RudderF(angle=Gear2, option=1){W:TrimF(angle=Ster, option=1){E:Wheel(brake=Gear, effect=2){}}}}
      S:Weight(color=Col1C){

      S:Cowl(option=5, color=Col1){}
      S:Cowl(angle=30, color=Col2){E:Cowl(angle=-92, option=3, color=Col2){}W:Cowl(angle=-92, option=4, color=Col2){}
      S:Cowl(angle=-30, color=Col2){}
      S:Cowl(angle=-120, option=1){S:Cowl(angle=90, color=Col2){E:Cowl(angle=90, color=Col2){}W:Cowl(angle=90, color=Col2){}
      N:Cowl(angle=15, color=Col2){E:Cowl(angle=92, option=3, color=Col2){}W:Cowl(angle=92, option=4, color=Col2){}}}}}

      S:Frame(name=Tail, option=1){
      S:Frame(angle=30, option=1){
      S:Jet(angle=-120, power=EX1, effect=Smoke){}
      S:RLW(name=ENG11, angle=-120, power=Engine1, effect=2){

      N:Cowl(angle=100, option=5, color=#000000){}
      S:Cowl(angle=100, option=5, color=#000000){}
      E:Cowl(angle=100, option=5, color=#aaaa00){}
      W:Cowl(angle=100, option=5, color=#aaaa00){}

      N:Trim(angle=-Prop1, color=Col2C){}S:Trim(angle=-Prop1, color=Col2C){}}
      S:RLW(name=ENG12, angle=-120, power=-Engine1, effect=2){

      N:Cowl(angle=110, option=5, color=#aaaa00){}
      S:Cowl(angle=110, option=5, color=#aaaa00){}
      E:Cowl(angle=110, option=5, color=#000000){}
      W:Cowl(angle=110, option=5, color=#000000){}

      N:Trim(angle=Prop1, color=Col2C){}S:Trim(angle=Prop1, color=Col2C){}}}
      E:Chip(color=Col1C){N:Frame(color=Col1C){N:Chip(angle=FLP, color=Col1C){}}
      E:Frame(angle=-75, option=1){S:Chip(angle=Yaw, color=Col2C){}}
      E:Chip(color=Col1C){N:Frame(color=Col1C){N:Chip(angle=FLP, color=Col1C){}}
      W:Frame(angle=Gear3, option=1){W:Wheel(angle=Gear1, brake=BRK, effect=2){}

      E:Cowl(angle=179, option=5, color=Col2){}}

      E:Chip(color=Col1C){

      N:Cowl(color=Col1){E:Cowl(option=3, color=Col1){}}
      S:Cowl(option=4, color=Col1){}

      E:Chip(color=Col1C){

      E:Cowl(option=3, color=Col1){}

      S:Chip(angle=RollE, color=Col2C){E:Chip(color=Col2C){}}}}}}
      W:Chip(color=Col1C){N:Frame(color=Col1C){N:Chip(angle=FLP, color=Col1C){}}
      W:Frame(angle=-75, option=1){S:Chip(angle=-Yaw, color=Col2C){}}
      W:Chip(color=Col1C){N:Frame(color=Col1C){N:Chip(angle=FLP, color=Col1C){}}
      E:Frame(angle=Gear3, option=1){E:Wheel(angle=Gear1, brake=BRK, effect=2){}

      W:Cowl(angle=179, option=5, color=#000000){}}

      W:Chip(color=Col1C){

      N:Cowl(color=Col1){W:Cowl(option=4, color=Col1){}}
      S:Cowl(option=3, color=Col1){}

      W:Chip(color=Col1C){

      W:Cowl(option=4, color=Col1){}

      S:Chip(angle=RollW, color=Col2C){W:Chip(color=Col2C){}}}}}}
      
}}}
}}}}
}}

Script(){

   print 0,"Cleared to Proceed"
   print 2,"Power at ", (Throttle+Chocke1)/2000,"%"
   print 1,"Speed: ", _VEL()*3600/1852," knots, ",_VEL()," m/s"
   print 3,"RPM 1: ", _ABS(_WY(ENG11)-_WY(ENG12))*5
   print 4,"Head, L/R: ",ViewA," , U/D: ",ViewB
   print 6,"Mass: ", _WEIGHT()," kg, Fuel:",_FUEL()
   print 7,"Fuel LVL: ",_FUEL()/550000,"%"
   print 8,"Heading: ",_TODEG(_AY())

   print 16,"Route Home: ",90-_TODEG(_ATAN2(_Z(), _X()))
   print 17,"Distance Home: ", _LEN2(_Z(),_X()), " m"
   print 9,"Trim: ",Trim,", Rudd: ",Rudd

   RollE=_ANALOG(0)/40
   RollW=-_ANALOG(0)/40
   Pbar=-4+_ANALOG(1)/40
   Throttle=(_ANALOG(2)+1000)*99

   SO1=_MOD(SO1+_KEYDOWN(4),2)
   Prop1=45+_VEL()/(9-Gear-Flap)*2+Feat1

   if SO1=(1){
   Chocke1=2000
   Engine1=Throttle+Chocke1
   Feat1=Feat1-1/3
   Ex1=60+(Throttle+Chocke1)/(10+_ABS(80-_VEL())/10*_ABS(200-_Y()))}

   if SO1=(0){
   Chocke1=0
   Engine1=0
   Feat1=Feat1+1/3
   EB1=EB1+1
   Ex1=0}

   ALVL=_MOD(ALVL+_KEYDOWN(13),2)
   AALT=_MOD(AALT+_KEYDOWN(11),2)

   if ALVL=(0){
   Pitch=Pbar
   Trim=_TODEG(_AX(Nose))}

   Flap=_MOD(Flap+_KEYDOWN(10),2)

   if Flap=(0){
   FLP=FLP-1/2
   print 11,"Flaps Extended!"}

   if Flap=(1){
   FLP=FLP+1/2
   print 11,"Flaps Retracted!"}

   Gear=_MOD(Gear+_KEYDOWN(12),2)

   if Gear=(0){
   Gear1=Gear1-1
   Gear2=Gear2-1
   Gear3=Gear3+1
   Gear4=Gear4+1/3
   Ster=-Yaw
   print 10,"Gear Down!"}

   if Gear=(1){
   Gear1=Gear1+1
   Gear2=Gear2+1
   Gear3=Gear3-1
   Gear4=Gear4-1/3
   Ster=0
   BRK=BRK+1
   print 10,"Gear Up!"}

   Gear5=5+Gear4

   if ALVL=(1) & AALT=(0){
   Pitch=-Trim+_TODEG(_AX(Nose))
   print 12,"AUTO LEVEL ON"}

   if AALT=(0){
   Ypar=_Y(Control)}

   if ALVL=(1){
   Yaw=Rudd
   RollE=-_TODEG(_AZ(Nose))-Yaw*2-_VY(EW)
   RollW=_TODEG(_AZ(Nose))+Yaw*2-_VY(WW)
   print 12,"AUTO LEVEL ON"}

   if ALVL=(1) & AALT=(1) & _ABS(Ypar-_Y())<20{
   Ypar=Ypar+Trim/100
   Pitch=((_Y())-(Ypar+5))+_TODEG(_AX(Nose))+(_VY(Nose)-_VY(Tail))
   print 13,"AUTO ALTITUDE ON, FL: ", Ypar," m"}

   if ALVL=(1) & AALT=(1) & Ypar-_Y()>20{
   Ypar=Ypar+Trim/100
   Pitch=-25+_TODEG(_AX(Nose))+(_VY(Nose)-_VY(Tail))
   print 13,"AUTO ALTITUDE ON, FL: ", Ypar," m"}

   if ALVL=(1) & AALT=(1) & Ypar-_Y()<(-20){
   Ypar=Ypar+Trim/100
   Pitch=15+_TODEG(_AX(Nose))+(_VY(Nose)-_VY(Tail))
   print 13,"AUTO ALTITUDE ON, FL: ", Ypar," m"}
   if ALVL=(1) & _KEY(9)>0{
   Rudd=Rudd+1/4}

   if ALVL=(1) & _KEY(7)>0{
   Rudd=Rudd-1/4}

   if ALVL=(1) & _KEY(15)>0{
   Trim=Trim-1/2}

   if ALVL=(1) & _KEY(8)>0{
   Trim=Trim+1/2}

   if ALVL=(0){
   Rudd=0
   print 12,"AUTO LEVEL OFF"}

   if Throttle>(0){
   Smoke=1}

   if Throttle>(100000){
   Smoke=2}

   if Throttle>(150000){
   Smoke=3}

   if Throttle>(180000){
   Smoke=4}

   if _KEY(11)>(0){
   Trim=0}

   if _KEY(14)>(0){
   _BYE(Tank)}

   if Throttle>(178000) & SO1=(1){
   Timer=Timer+1/2}

   if Throttle>(182000) & SO1=(1){
   Timer=Timer+1}

   if Throttle>(190000) & SO1=(1){
   Timer=Timer+2}

   if Throttle<(178000){
   Timer=0}

   if Timer>(21){
   print 15,"POSSIBLE PROPELLER FAILURE!!!"}

   if Timer<(21) & Timer >(0){
   print 14,"CAUTION!!! ENGINE OVERHEATING!!!"}

   if Timer>=(41){
   Timer=1}

   if _ABS(_WY(ENG11)-_WY(ENG12))>=(160) & SO1=(1){
   Timer=0
   print 14\,"ENGINE FAILURE DETECTED!"
   print 15,"ENGINE FAILURE DETECTED!"}

   if _KEY(11)>(0){
   Trim=0}

   if Feat1>(0){
   print 18,"Propeller 1, Feather Position! Caution!"}

   Combat=_MOD(Combat+_KEYDOWN(6),2)

   if _KEY(14)>(0) & Combat=(1){
   _SPLIT(Bomb)}

   if _H(Bomb)>(0) & _Y()-_Y(Bomb)>(20){
   Fuse=20000000}

   Blerf=_SETCOLOR(#5000aa)
   Blerf=_MOVE2D(-1/5,0)
   Blerf=_LINE2D(-1/40,0)
   Blerf=_MOVE2D(1/5,0)
   Blerf=_LINE2D(1/40,0)
   Blerf=_MOVE2D(-1/40,0)
   Blerf=_LINE2D(-1/40,-2/3)
   Blerf=_MOVE2D(1/40,0)
   Blerf=_LINE2D(1/40,-2/3)
   Blerf=_MOVE2D(-1/10,-1/2)
   Blerf=_LINE2D(-1/40,-1/2)
   Blerf=_MOVE2D(1/10,-1/2)
   Blerf=_LINE2D(1/40,-1/2)
   Blerf=_MOVE2D(-1/2,1/40)
   Blerf=_LINE2D(1/2,1/40)

   if Combat=(0){
   print 20,"Bomb Safety ON"}

   if Combat=(1){
   print 20,"Bomb Safety OFF"
   blerf=_SETCOLOR(#aa0050)
   ParP=_Y()+_VEL()*_SIN(_AX())
   Den=_VEL()*_SQRT(200/981*ParP)
   H=-5*_SIN(_AX()+_ATAN2(_Y(),Den))
   blerf=_MOVE2D(0,0)
   blerf=_LINE2D(H*_SIN(_AZ()),H*_COS(_AZ()))
   blerf=_MOVE2D(H*_SIN(_AZ())+1/40,H*_COS(_AZ())+1/40)
   blerf=_LINE2D(H*_SIN(_AZ())-1/40,H*_COS(_AZ())+1/40)
   blerf=_MOVE2D(H*_SIN(_AZ())-1/40,H*_COS(_AZ())+1/40)
   blerf=_LINE2D(H*_SIN(_AZ())-1/40,H*_COS(_AZ())-1/40)
   blerf=_MOVE2D(H*_SIN(_AZ())-1/40,H*_COS(_AZ())-1/40)
   blerf=_LINE2D(H*_SIN(_AZ())+1/40,H*_COS(_AZ())-1/40)
   blerf=_MOVE2D(H*_SIN(_AZ())+1/40,H*_COS(_AZ())-1/40)
   blerf=_LINE2D(H*_SIN(_AZ())+1/40,H*_COS(_AZ())+1/40)}

}

avatar
Echo_Delta_Oscar
Hover
Hover

Posts : 105
Join date : 2011-03-24

View user profile

Back to top Go down

Re: B-95B Cockroach

Post by MrSparks on Sun May 27, 2012 11:34 am

I don't find that this actually works. The bomb always falls short of the mark. Even from only about 300 meters above it the difference is quite significant.

MrSparks
Tank
Tank

Posts : 73
Join date : 2012-01-05
Age : 27
Location : Michigan

View user profile

Back to top Go down

Re: B-95B Cockroach

Post by Echo_Delta_Oscar on Sun May 27, 2012 2:00 pm

I know, the system is not as accurate as I could have hoped, but consider this:
1 - flying above 200 m you should not be able to see the collimator, even if looking down.
2 - the system is not "terrain sensitive", which means it aims always to sea level
3 - to keep thing simple I had to operate some approximation, discarding a term in the equation that could have some contribution
4 - the system is designed to work at his best when the altitude hold autopilot is ON
avatar
Echo_Delta_Oscar
Hover
Hover

Posts : 105
Join date : 2011-03-24

View user profile

Back to top Go down

Re: B-95B Cockroach

Post by RA2lover on Mon May 28, 2012 11:00 am

i'd usually either:

-use a really long invisible cowl string just to be able to use _H properly in order to get terrain height
-draw the bomb's trajectory using 3d lines which get intercepted by the terrain
-end up with a stupid, ridiculously large heightmap out of the map's .x file

i'd say it's easier to get CCIP done on LB though.
avatar
RA2lover
Walker
Walker

Posts : 382
Join date : 2010-10-11
Age : 22
Location : Brazil

View user profile

Back to top Go down

Re: B-95B Cockroach

Post by Echo_Delta_Oscar on Mon May 28, 2012 2:23 pm

Right now I'm testing the Linear Fall Bombs, as suggested by MrSparks in his post about the B-09G; the offset will remain, but the proble would be linear, thus easier to trim.

Furthermore, I notice some mistakes I made during the implementation of CCIP equations;
I scripted:

Code:

  ParP=_Y()+_VEL()*_SIN(_AX())
  Den=_VEL()*_SQRT(200/981*ParP)
  H=-5*_SIN(_AX()+_ATAN2(_Y(),Den))

I should have scripted:
Code:

   ParP=_Y()
   Den=_VEL()*_SQRT(200/981*ParP)
   H=-5*_TAN(_AX()+_ATAN2(_Y(),Den))

because the former was a partial model for a CCIP capable of aiming a bomb regardless of the attitude of the aircraft; I decided it was too complicated and, since I always fly with A/P ON, it would have been useless.
The latter is the one I wanted equip the B-95 with.
Notice the "5" multiplying the exspression for H; that is a constant I found empirically. It should represent the distance between the HUD and the eyes of the pilot. Any suggestion on how to find analitically a better constant would be welcome.
In the meantime I'll be testing.
<<For Science. You Monster.>> [cit. GLaDOS]
avatar
Echo_Delta_Oscar
Hover
Hover

Posts : 105
Join date : 2011-03-24

View user profile

Back to top Go down

Re: B-95B Cockroach

Post by RA2lover on Mon May 28, 2012 2:27 pm

i'm pretty sure the ctrl+f10 camera lies about 0.75m behind the core. it's field of view can be read(and writeable to some extent) through the _ZOOM(angle in degrees) function.
avatar
RA2lover
Walker
Walker

Posts : 382
Join date : 2010-10-11
Age : 22
Location : Brazil

View user profile

Back to top Go down

Re: B-95B Cockroach

Post by MrSparks on Mon May 28, 2012 3:41 pm

I don't remember suggesting linear fall bombs but ok.

Also, In order to make the collimator visible at ~300m above my target(~630m above sealevel) I was dive bombing from ~1km. So the discrepancy might also be related to using it in a manner for which it was not intended.

And now I will science out the viewpoint.

MrSparks
Tank
Tank

Posts : 73
Join date : 2012-01-05
Age : 27
Location : Michigan

View user profile

Back to top Go down

Re: B-95B Cockroach

Post by Echo_Delta_Oscar on Mon May 28, 2012 4:03 pm

Well, that's correct: you actually suggested guided bombs; linear fall bombs are the approximation of my interpretation of the concept (a sort of feed-forward guidance system)

To dive-bomb, we could try to re-arrange the equation in the HUD section.

Code:

g=981/100
Den=_SQRT(_VEL()*_SIN(_AX(Nose))+2*g*_Y())-_VEL()*_SIN(_AX(Nose))
Num=g*_Y()
H=-Xhud*_TAN((_AX()-_AX(Nose))+_ATAN2(Num,Den))

Since it's nearly midnight here, I beg your pardon in case I wrote any mistakes; I'll work on it when I'm awake and sound.
However I can point out some weaknesses right now: I used _AX(Nose) to approximate the real climb (or dive) angle; this could mean lack of precision, but the difference becomes negligible the steeper the dive is.
avatar
Echo_Delta_Oscar
Hover
Hover

Posts : 105
Join date : 2011-03-24

View user profile

Back to top Go down

Re: B-95B Cockroach

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum