September 17, 201015 yr Commercial Member Can anyone tell me what the expected parameter is to KEY_AP_PITCH_REF_UP and KEY_AP_PITCH_REF_DN? I've tried single digits (1,2, etc) but the following code doesn't seem to do anything (control speed by pitch). I've searched the forum but (possibly because of the hack) a lot of the topics quite literally only have half-messages in - or even just a few words!I've been the elevator trim route and couldn't get it to damp satisfactorily.Or (and it has just occurred to me), maybe I'm not allowing time for the new pitch reference to take?-Dai if(!simPaused){// Limit pitch excursion to five degrees// Damping time (i.e. rechecking the current airspeed) is three seconds// cap_ias is the airspeed at the time of pitch mode selection// Pitch up if(((int)getPitch()>-5 || (int)getPitch()>=0) && cap_ias<(int)getASInd()) { trigger_key_event(KEY_AP_ATT_HOLD_OFF,0); trigger_key_event(KEY_AP_PITCH_REF_INC_UP,1); trigger_key_event(KEY_AP_ATT_HOLD_ON,0); trigger_key_event(KEY_AP_WING_LEVELER_OFF,0); }// Pitch down else if(((int)getPitch()<5 || (int)getPitch()<=0)&& cap_ias>(int)getASInd()) { trigger_key_event(KEY_AP_ATT_HOLD_OFF,0); trigger_key_event(KEY_AP_PITCH_REF_INC_DN,1); trigger_key_event(KEY_AP_ATT_HOLD_ON,0); trigger_key_event(KEY_AP_WING_LEVELER_OFF,0); } cap_ias_timer=currtick18.var_value.n+54;}if(currtick18.var_value.n>=cap_ias_timer && cap_ias_timer!=-1)cap_ias_timer=-1;
September 17, 201015 yr Hi,The commands AP_PITCH_REF_INC_UP and AP_PITCH_REF_INC_DN change the pitch with about 0.2 degreesYou need (>K:AP_PITCH_REF_SELECT) and (>K:SYNC_FLIGHT_DIRECTOR_PITCH) to get them to work.Jan Jan "Beatus ille qui procul negotiis..."
September 17, 201015 yr Moderator I've searched the forum but (possibly because of the hack) a lot of the topics quite literally only have half-messages in - or even just a few words!The new forum software has "hidden" a lot of previous code and/or script examples because of the changes to the [tags].To "recover" the hidden text, simply "Reply" to the post in question, then add the appropriate [tags] to reformat them... :) Fr. Bill AOPA Member: 07141481 AARP Member: 3209010556 Avsim Board of Directors | Avsim Forums Moderator
September 17, 201015 yr Author Commercial Member @ BillI really do mean part-replies and half-sentences, not just missing code examples :( Doug Maher sometimes only gets one word in!@ JanCan you elaborate on needing to use _SELECT and _DIRECTOR_PITCH please? One of those chopped threads I'm complaining about (started by Bert Pierke(??sp.)) discussed just this problem but a lot of the information is missing.Thank you.-Dai
September 18, 201015 yr Dai,In the past i experimented with the pitch commands to get a proper vnav, flch and autoland.After clicking SELECT and FLIGHTDIRECTOR (synchronisezes the FD pitch bars) with AP on, the commands PITCH UP and DN change the pitch with about 0.2 degrees per click, range 26 clicks min-max(?).(For instance in autoland when pitch is < 1 degrees, then PITCH etc. on, pitch up, pitch up etc. and when pitch reaches 5 degrees then ATT ON, which stops SELECT etc. and keeps the plane in the desired attitude.)Now i only use the standard fs autopilot and handflying................Btw. only xml.Jan Jan "Beatus ille qui procul negotiis..."
September 18, 201015 yr Author Commercial Member Hi JanI went back to using the elevator trim to control pitch and this time got it to work (almost) satisfactorily. The airspeed excursion around the reference speed is about five knots; I'm working on getting that down to about three knots and then I'll leave it. Two seconds wait and three seconds damping works for me but it may not work for anyone else as the model's MOI will affect the damping to some degree. I couldn't use the FS hold airspeed function as that appears to use thrust and not pitch; this aircraft also has a separate IAS target controlled by autothrust.-Dai[Edit: redundant code] // Control airspeed by pitchvoid airspeedPitchControl(int ias, int pitchlimit, int wait, int damping){ static double damping_timer=-1; static double wait_timer=-1; static int check=0; if(!simPaused && !check) { trigger_key_event(KEY_AP_ATT_HOLD_OFF,0);//Pitch up if(((int)getPitch()>-pitchlimit || (int)getPitch()>=0) && ias<(int)getASInd()) trigger_key_event(KEY_ELEV_TRIM_UP,0);//Pitch down else if(((int)getPitch()<pitchlimit || (int)getPitch()<=0)&& ias>(int)getASInd()) trigger_key_event(KEY_ELEV_TRIM_DN,0); wait_timer=getTick()+wait; //Wait to allow pitch to take effect check=1; } if(wait_timer==getTick()) { wait_timer=-1; damping_timer=getTick()+damping; // Wait before re-checking the current situation trigger_key_event(KEY_AP_ATT_HOLD_ON,0); trigger_key_event(KEY_AP_WING_LEVELER_OFF,0); } if(damping_timer==getTick())damping_timer=-1,check=0; return;}
Create an account or sign in to comment