Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

HDG bug and direction of turn

Featured Replies

Hi Guys,I want to move the HDG bug in, say, the clockwise direction, and have the aircraft turn in the same direction. If the HDG bug is moved more than 180

  • Moderator

Nick, the only way you could accomplish that would be to write your code such that if the target heading is > 180 from your current heading, then subtract 180 from it and then continue to subtract 1 to the result until your target is reached...IOW, you would loop until your current heading matches your target heading...

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

You sure you want it to work that way anyway? Try this sometime in a real plane and see what happens.

It's exactly how a 737-400 works.. But anyway Bill was right. 1st you have to tell how the knob was turned, how far turned etc....Here's some FS2002 code that worked like a charm, there's extra stuff in there but may give you an idea on how it works. I couldn't help you --- THATS 6 years ago !!!! (*************** HDG SEL **************)(* Initial turn direct *)(G:Var3) 0 == (L:LATmode, enum) 1.5 == & if{ (A:Plane heading degrees gyro, degrees) (L:HSEL, enum) - dnor 180 > (A:Plane heading degrees gyro, degrees) (L:HSEL, enum) - dnor 359.99 < & if{ 2 (>G:Var3) } els{ 1 (>G:Var3) } }(* Initialize *)(L:LATmode, enum) 1.5 == if{ 1 (>L:LATmode, enum) + (>K:AP_PANEL_HEADING_ON) + (>K:AP_NAV1_HOLD_OFF) + (>K:AP_LOC_HOLD_OFF) + (>K:AP_APR_HOLD_OFF) + (A:GPS DRIVES NAV1, bool) 1 == if{ (>K:TOGGLE_GPS_DRIVES_NAV1) } } (* Cancel *)(L:LATmode, enum) 1 == ! if{ (>K:AP_PANEL_HEADING_OFF) } (* Cancel Bank *)(G:Var4) s3 0 == if{ 15 s4 } l3 1 == if{ 12.5 s4 } l3 2 == if{ 10 s4 } l3 3 == if{ 7.5 s4 } l3 4 == if{ 5 s4 }(* Cancel Bank *)(A:Sim on ground, bool) 1 == (A:Plane heading degrees gyro, degrees) s1 l4 + dnor (L:HSEL, enum) > l1 l4 - dnor (L:HSEL, enum) < & || if{ (L:HSEL, enum) (>G:Var5) + 0 (>G:Var3) }(* bank 30 *) (G:Var4) 0 == (G:Var3) 0 > & if{ (G:Var3) 1 == if{ (A:Plane heading degrees gyro, degrees) 40 - dnor (>G:Var5) } els{ (A:Plane heading degrees gyro, degrees) 40 + dnor (>G:Var5) } }(* bank 25 *) (G:Var4) 1 == (G:Var3) 0 > & if{ (G:Var3) 1 == if{ (A:Plane heading degrees gyro, degrees) 25 - dnor (>G:Var5) } els{ (A:Plane heading degrees gyro, degrees) 25 + dnor (>G:Var5) } }(* bank 20 *)(G:Var4) 2 == (G:Var3) 0 > & if{ (G:Var3) 1 == if{ (A:Plane heading degrees gyro, degrees) 20 - dnor (>G:Var5) } els{ (A:Plane heading degrees gyro, degrees) 20 + dnor (>G:Var5) } } (* bank 15 *)(G:Var4) 3 == (G:Var3) 0 > & if{ (G:Var3) 1 == if{ (A:Plane heading degrees gyro, degrees) 15 - dnor (>G:Var5) } els{ (A:Plane heading degrees gyro, degrees) 15 + dnor (>G:Var5) } } (* bank 10 *)(G:Var4) 4 == (G:Var3) 0 > & if{ (G:Var3) 1 == if{ (A:Plane heading degrees gyro, degrees) 10 - dnor (>G:Var5) } els{ (A:Plane heading degrees gyro, degrees) 10 + dnor (>G:Var5) } }(* send to AP *) (G:Var5) (>K:HEADING_BUG_SET) RomanFS9, AMD 1800+, ECS K7S5a, 1 gig, 100 & 60 Gig 7200rpm HD, ASUS/NVidia 64mb AGP on 21", NVidia FX5500 vivo 256mb on 18", Savage4 32mb on 15"

20AUG21_Avsim_Sig.png?dl=1  FS RTWR   SHRS F-111   JoinFS   Little Navmap 
 

 

Thanks guys, I'll check your ideas and code.This aircraft does work this way.

I achieved what I wanted with the following code.I'm wondering if it can be simplified or whether the method is too complex.Basically, if the difference is greater than 180

The above has faults, so still working on this.cheers,nick

  • Author

Nick I use for right turns in holding entry logic (gives smooth turns to desired headings over 180 from inbound track) All turns right have increasing numbers and left decreasing. (L:SetHoldTrack, degrees) 90 + d360 (>L:HoldTrack, degrees) } (L:HoldTrack, degrees) (A:GPS GROUND MAGNETIC TRACK,degrees) 30 + - abs 5 < if{ (L:SetHoldTrack, degrees) 180 + d360 (>L:HoldTrack, degrees) } Code starts turn to 90 deg. right then is interecepted after turning 30 deg to continue the turn past 180. SetHoldTrack is the hold inbound track to reverse 180 SetHoldTrack value to your heading K var. And left turns are (L:SetHoldTrack, degrees) 90 - d360 (>L:HoldTrack, degrees) } (L:HoldTrack, degrees) (A:GPS GROUND MAGNETIC TRACK,degrees) 30 - - abs 5 < if{ (L:SetHoldTrack, degrees) 180 + d360 (>L:HoldTrack, degrees) }

Paul EGLD

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.