Jump to content

Sign in to follow this  
pve

HDG bug and direction of turn

Recommended Posts

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

Share this post


Link to post
Share on other sites

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...

Share this post


Link to post
Share on other sites
Guest Patrick_Waugh

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

Share this post


Link to post
Share on other sites

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"

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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) }

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...