Jump to content
Sign in to follow this  
phjvh

Setting and Activating VS

Recommended Posts

I'm programming a simple, 2-axis autopilot that has only ALT HOLD (capture and hold).It also has a VS function, whereby you can "dial in" the desired VS (plus or minus) and then "activate" it such that the a/c ascends or descends accordingly.What key_event is used to enable the VS HOLD (that works, that is...)This doesn't seem to work: if ( mode == 3 || mode == 5 ) { if ( AUTOPILOT_VERTICAL_HOLDvar.var_value.n == 0) { trigger_key_event(KEY_AP_VS_ON,0); } else { trigger_key_event(KEY_AP_VS_OFF,0); } }neither does KEY_AP_VS_HOLD...


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites

Bill,Have you tried settingdefault_pitch_mode = 2in the autopilot section of aircraft.cfg?Doug

Share this post


Link to post
Share on other sites

Hi Bill, Doug,As far as I know, the events AP_PANEL_VS_HOLD and AP_VS_HOLD, and related variable AUTOPILOT VERTICAL HOLD are a thing of FS2000 and older, and are not implemented in FS2002/FS2004 anymore.(either deliberately or "bug" :-) )Or have never been implemented att all.Which also explains why they are not described in the panel SDK.Another "proof" of this: the only default aircraft that has a seperate VS Hold button in the AP (the default B747-400), doesn't use it as well: see AutopilotVSSwitch.xml from gauge Boeing747-400.cab.(instead it set/follows the ALtitudeHold).The Assignments menu in FS2004 still has a function "Autopilot vertical speed on/off", but that also does nothing.In other words: the FS2004 AP functions don't have a real V/S Hold function seperately from AltHold, just an AltitudeHold with embedded V/S Hold (when actual Alt deviates too much from set Altitude).The only way to "simulate" a real V/S hold function, is to set an extreme high or low target Altitude, and then activate AltHold (so now the AP maintains the set V/S to reach the new Altitude. I used this "trick" in a FlightLevelChange gauge I created a while ago.The line default_pitch_mode = 2 in the aircraft.cfg has little to do with this. This just means that if you switch on the AP Master, FS automatically switches on AltitudeHold.Also, the decription of default_pitch_mode in the AircraftContainer SDK suggests that the FS2004 AP has a "PitchHold" function (value 1: maintain current pitch). IMO this is not implemented too.If you DO add "default_pitch_mode=1" to the aircraft.cfg file, FS also switches on AltHold when you activate the AP Master. (so there's no difference between value 1 and 2).Of course, I could be wrong. But I think not :-) Cheers, Rob Barendregt

Share this post


Link to post
Share on other sites

Thanks, Doug and Rob, for the replies. I guess I'll have to explore the option of a "rediculously fake altitude change" to implement this feature then... Why can't anything ever be easy? ;)This is the "features list" for this unit:Fits Standard 2.25" Round Insturment Hole Built-in Digital Slaved Directional Gyro Digital Track Selector GPS Nav Mode GPS Steering Altitude Hold Simple Intuitive User Interface All Solid-State Sensors Climb and Descend on Vertical Speed Trim Sensing Pitch Servo that Annunciates for Trim. True Control Wheel Steering* The item in red is the only feature not yet programmed... ;)


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites

>> Why can't anything ever be easy? :-)Because us addon designers obviously try to stretch the limit of what is possible in any FS version, or have to live with the limitations of any version.Be glad ..If it would be that easy, anyone could do it ...LOLAnd actually, usually the "trick" is very simple once you know which "trick" to apply. And you do now :-)Cheers, Rob

Share this post


Link to post
Share on other sites
Guest adameke777

Another way to do this would be to simply override the default AP completely and make a feedback loop on the vertical speed using stabilizer trim as the control variable.Adam

Share this post


Link to post
Share on other sites

Hi Adam,Obviously you are right..But we were talking about easy solutions :-)And I know by experiance that outperforming the standard FS2004 algoritme for ALtHold/ V/S Hold is not an easy thing :-)Cheers, Rob

Share this post


Link to post
Share on other sites
Guest iholrf

I love this. Most of the time all I have to do is wait and my answers come to me. Why couldn't Linux be this way? (Oh right...egos).Shad

Share this post


Link to post
Share on other sites

>Also, the decription of default_pitch_mode in the>AircraftContainer SDK suggests that the FS2004 AP has a>"PitchHold" function (value 1: maintain current pitch). IMO>this is not implemented too.Oddly enough, while experimenting this afternoon, I did find that at least in C, the AP ATT HOLD does work... ;)if ( mode == 3 || mode == 5 ){ if ( AUTOPILOT_ATTITUDE_HOLDvar.var_value.n == 0) { trigger_key_event(KEY_AP_PITCH_REF_SELECT,0); trigger_key_event(KEY_AP_ATT_HOLD_ON,0) ; } else { trigger_key_event(KEY_AP_PITCH_REF_SELECT,0); trigger_key_event(KEY_AP_ATT_HOLD_OFF,0) ; }}Note however that the key_event AP_PITCH_REF_SELECT must be sent first, followed by the AP_ATT_HOLD_ON command. This will enable the trigger_key_event(KEY_AP_PITCH_REF_INC_UP,0);andtrigger_key_event(KEY_AP_PITCH_REF_INC_DN,0);mouse events to function. Unfortunately, there's no corresponding "display variable" equivalent to V/S... Ah well, I'll keep playing around with it awhile... ;)


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites

MS keeps surprising me :-)Since you tested it:1. Does AttitudeHold maintains both pitch AND bank angle ??2. What happens if AttitudeHold is activated and then you activate AltitudeHold ?? Because these two functions obviously conflict.E.g. when the aircraft is climbing on AP with AltHold (and VS Hold) On, and you change the V/S dial, obviously the pitch must change to hold the new VS; which conflicts with AttitudeHold :-)Rob

Share this post


Link to post
Share on other sites

>MS keeps surprising me :-)>>Since you tested it:>>1. Does AttitudeHold maintains both pitch AND bank angle ??ATT_HOLD activates both pitch and bank angle (wing-leveler). So, for my purposes I would simply need to add the command to turn wing leveler back off again... ;)>2. What happens if AttitudeHold is activated and then you>activate AltitudeHold ?? Because these two functions obviously>conflict.Setting any of the several ALT Hold functions will cancel ATT_HOLD immediately. When approaching the desired altitude, simply select KEY_AP_ALT_HOLD (or the XML equivalent) to "capture and hold current altitude."Conversely, if you are already at ALT_HOLD, selecting ATT_HOLD will cancel the ALT_HOLD automatically.>E.g. when the aircraft is climbing on AP with AltHold (and VS>Hold) On, and you change the V/S dial, obviously the pitch>must change to hold the new VS; which conflicts with>AttitudeHold :-)I don't know... I haven't tried that one yet! I'll let you know... :)


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites

Hi,A bit off the record, but i use ATT hold also for the autoland function:Until 70 ft radio height APPR HOLD, then between 30 and 70 ft ALT HOLD and THROTTLE CUT.These actions automatically increases pitch and when it reaches + 1 degrees ATT HOLD comes on until the plane touches down.In most weather conditions and plane configurations it gives a smooth landing with a realistic 3-4 degrees pos pitch.When SIM ON GROUND reverse power, speedbrakes, autobrakes etc.I think there are more indications to use ATT HOLD.Still exploring..Jan"Beatus Ille Procul Negotiis"

Share this post


Link to post
Share on other sites

FWIW, this seems to work in the "UP" direction, so I'll simply need to add some additional code to make it do what I want in "either" direction... ;)if (mode == 3 || mode == 5 ){ trigger_key_event(KEY_AP_VS_VAR_SET_ENGLISH, 500); trigger_key_event(KEY_AP_ALT_VAR_SET_ENGLISH, 10000); trigger_key_event(KEY_AP_PANEL_VS_ON, 0); trigger_key_event(KEY_AP_PANEL_ALTITUDE_ON, 0);}else{ trigger_key_event(KEY_AP_PANEL_VS_OFF, 0); trigger_key_event(KEY_AP_PANEL_ALTITUDE_OFF, 0);}By replacing the two passed values to UINT32 variables, I should be able to achieve my goal without too much more bother... :)


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites
Guest bones

I've been scratching my head on this problem too for the Aztec panel.The old Piper Altimatic X autopilot has an ALT button but this isn't the normal FS pre-selector for a dialled height. Hit the Alt button and the aircraft will hold current height. I have modelled this in the FS panel without problem.The VS selector on the Altimatic is a rocker switch for UP/DOWN. Press UP and the aircraft will start a climb - further presses increase the rate. The aircraft will happily continue to climb forever (air density permitting) unless you interrupt this by selecting ALT.I tried AP_VS_VAR_INC but this doesn't work as it only pre selects a climb rate - it doesn't engage the climb. Do I have to deviate from the original autopilot and add a VS button as well?

Share this post


Link to post
Share on other sites

Hi,You could try:(L:RATE,number) 50 - 0 max (>L:RATE,number) (L:RATE,number) (>K:AP_VS_VAR_SET_ENGLISH) (L:RATE,number) 50 + 2000 min (>L:RATE,number) (L:RATE,number) (>K:AP_VS_VAR_SET_ENGLISH) or something . Jan"Beatus Ille Procul Negotiis"

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...