Howto:Carrier Landing Assistant in HUD: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
(added templates)
Line 15: Line 15:
* It is based on having a valid TACAN signal and a carrier in range and also that the carrier is "'''/ai/models/carrier[0]'''".  It does NOT do any error-checking to see if this is the case and so this would need to be done for your own implementation in an aircraft.
* It is based on having a valid TACAN signal and a carrier in range and also that the carrier is "'''/ai/models/carrier[0]'''".  It does NOT do any error-checking to see if this is the case and so this would need to be done for your own implementation in an aircraft.
* It was done as a quick fix, just to see if it was possible. Consequently it is not particularly elegant or well-commented. Hopefully it will be improved in time.
* It was done as a quick fix, just to see if it was possible. Consequently it is not particularly elegant or well-commented. Hopefully it will be improved in time.
* The heading needle is really only there to get within the last few hundred metres as it points towards the centre of the carrier model rather than the arrester cables.
* It is based on an offset angle of 8 degrees for the landing deck from the ship's heading and a 3 degree glideslope.  These may need to be changed.


== The Canvas graphics elements ==
== The Canvas graphics elements ==

Revision as of 18:03, 30 December 2015

This article is a stub. You can help the wiki by expanding it.
Nimitz Almeria.

This Howto Details modifications to the Canvas-based ILS_in_HUD Wiki. It deals specifically with modifying an SU-37, though the principle should be applicable to any carrier-capable aircraft. The properties used are:

  • /ai/models/carrier[%d]/controls/flols/angle-degs
  • /ai/models/carrier[%d]/orientation/true-heading-deg
  • /instrumentation/tacan/indicated-bearing-true-deg
  • /orientation/heading-deg

Although a carrier would not be based on this data, in real life, this method has the advantage of being "generic".

Warnings and Limitations

  • This HowTo builds on the ILS_in_HUD Wiki. If you haven't fully read and understood that then you probably should not read any further. Just take the video as inspiration for what you may one day achieve and go back a stage.
  • It is based on having a valid TACAN signal and a carrier in range and also that the carrier is "/ai/models/carrier[0]". It does NOT do any error-checking to see if this is the case and so this would need to be done for your own implementation in an aircraft.
  • It was done as a quick fix, just to see if it was possible. Consequently it is not particularly elegant or well-commented. Hopefully it will be improved in time.
  • The heading needle is really only there to get within the last few hundred metres as it points towards the centre of the carrier model rather than the arrester cables.
  • It is based on an offset angle of 8 degrees for the landing deck from the ship's heading and a 3 degree glideslope. These may need to be changed.

The Canvas graphics elements

Additions to the new: func(placement)

# ----------------------------------------------------------------- Carrier Landing System
# UP/DOWN:
   	# glide slope indicator for CARRIER
    m.gsiC = m.root.createChild("group", "GSI");
    m.gsiC.createChild("path")
         .moveTo(8, 0)
         .arcSmallCCW(8, 8, 0, -16, 0)
         .arcSmallCCW(8, 8, 0,  16, 0)
         .moveTo(-4, 0)
         .horiz(-150)
         .moveTo(4, 0)
         .horiz(150)
         .setStrokeLineWidth(2.0)
         .setColor(1,1,0);      
      # Slope to CARRIER vertical needle deflection text box (up/down)      
      m.STC =
      m.text.createChild("text")
      		.setFontSize(14, 0.9)
            .setDrawMode(3)
            .setPadding(2)
            .setAlignment("center-top")
            .setTranslation(180, -20)
            .setColor(1,1,0);     
# LEFT/RIGHT:
    # localiser beam indicator for CARRIER  
    m.lbiC = m.root.createChild("group", "GSI");
    m.lbiC.createChild("path")
         .moveTo(8, 0)
         .arcSmallCCW(8, 8, 0, -16, 0)
         .arcSmallCCW(8, 8, 0,  16, 0)
         .moveTo(0, -4)
         .vert(-40)
         .moveTo(0, 4)
         .vert(95)
         .setStrokeLineWidth(2.0)
         .setColor(1,1,0);
    # For Carrier LANDING DECK heading text box
    m.carrierHdgTxt =
      m.text.createChild("text")
      .setFontSize(16, 0.9)
            .setAlignment("right-top")
            .setTranslation(240, 105)
            .setColor(1,1,0); 
    # Bearing TO the carrier text box
    m.carrierBrgTxt =
      m.text.createChild("text")
      .setFontSize(16, 0.9)
            .setAlignment("right-top")
            .setTranslation(240, 90)
            .setColor(1,1,0); 
    # Carrier Offset text box 
    m.carrierOffTxt =
      m.text.createChild("text")
      .setFontSize(16, 0.9)
            .setAlignment("center-top")
            .setTranslation(0, 100)
            .setColor(1,1,0); 
    # Carrier pointer text box 
    m.carrierDiagramTxt =
      m.text.createChild("text")
      .setFontSize(24, 0.9)
            .setAlignment("center-top")
            .setTranslation(0, -70)
            .setColor(1,1,0)
            .setText('=>');
    # relativeDeckHeading text box 
       m.relativeDeckHeadingText =
      m.text.createChild("text")
      .setFontSize(12, 1.0)
            .setAlignment("center-top")
            .setTranslation(0, -55)
            .setColor(1,1,0); 
# ---------------------------------------------------------- end of Carrier Landing System

Drawing them on the HUD

Additions to the update: func()

	# The CARRIER Glide Slope Up/Down needle
	var closestCarrier = 0;
	var slopeToCarrierProp = sprintf("/ai/models/carrier[%d]/controls/flols/angle-degs", closestCarrier);
	var slopeToCarrier = getprop(slopeToCarrierProp);
	me.STC.setText(sprintf("%1.2f", -slopeToCarrier));
	me.STC.setTranslation(185, 20*(slopeToCarrier -3) -5 );
	me.gsiC.setTranslation(0, 20*(slopeToCarrier -3) );
	
	# The CARRIER approach heading Left/Right needle
	var carrierHdgProp = sprintf("/ai/models/carrier[%d]/orientation/true-heading-deg", closestCarrier); 
	var carrierHdg = getprop(carrierHdgProp); 
	me.carrierHdgTxt.setText(sprintf("DeckHdg: %1.0f", carrierHdg-8)); # allow for landing deck offset
	var carrierBrgTo = getprop("/instrumentation/tacan/indicated-bearing-true-deg");
	me.carrierBrgTxt.setText(sprintf("BrgTo: %1.0f", carrierBrgTo)); # heading TO the carrier
	var carrierOffset = carrierHdg - carrierBrgTo -8 ; # landing deck offset
	me.carrierOffTxt.setText(sprintf("%1.1f", -carrierOffset));
	me.carrierOffTxt.setTranslation(-10*(carrierOffset), 100 );
	me.lbiC.setTranslation(-10*(carrierOffset), 0 );
	var currentHeading = getprop("/orientation/heading-deg");
	var relativeDeckHeading = -(currentHeading - carrierHdg +8) ;
	me.relativeDeckHeadingText.setText(sprintf("RelHdg: %1.0f", relativeDeckHeading)); # landing deck offset
 	me.carrierDiagramTxt.setRotation( ((relativeDeckHeading -105 )* math.pi )/ 180);
 	var hdgOffsetToCarrier =  currentHeading - carrierBrgTo;
 	me.carrierDiagramTxt.setTranslation(-10*(hdgOffsetToCarrier), -90 );

Related Topics