XP11 ZIBOにRevsim TQを接続する その4 [X-Plane]
OCUSBMapperもシリーズその4になりましたが、今度はトリムインジケーターとトリムホイールを動作させます。
トリムはシム上のデータを取得してモーターを駆動するだけなのでシンプルです。
1.ZIBO→デバイス
①シム上のトリムインジケーター位置を読み取る。
②Revsim上のインジケーター位置と異なる場合はモーターを前後に駆動させる。
③トリム調整中はトリムホイールのモーターを前後に駆動させる。
2.デバイス→ZIBO
①YOKEのトリムスイッチが押されたらシム上のZIBOにインプット
動作状況はこちら↓
次回はシリーズ最後でスピードブレーキです。
トリムはシム上のデータを取得してモーターを駆動するだけなのでシンプルです。
1.ZIBO→デバイス
①シム上のトリムインジケーター位置を読み取る。
②Revsim上のインジケーター位置と異なる場合はモーターを前後に駆動させる。
③トリム調整中はトリムホイールのモーターを前後に駆動させる。
2.デバイス→ZIBO
①YOKEのトリムスイッチが押されたらシム上のZIBOにインプット
--*************************************************************************************-- --** CONSTANTS **-- --*************************************************************************************-- DCMOTORS_DEVICE = 0 --*************************************************************************************-- --** FIND X-PLANE DATAREFS **-- --*************************************************************************************-- --シム中のトリムインジケーターの位置とトリム操作状況を読み取る。 simDR_trim_ind = find_dataref("laminar/B738/flt_ctrls/trim_wheel") simDR_trim_up = find_dataref("sim/cockpit2/annunciators/autopilot_trim_up") simDR_trim_down = find_dataref("sim/cockpit2/annunciators/autopilot_trim_down") --*************************************************************************************-- --** FIND CUSTOM DATAREFS **-- --*************************************************************************************-- --opencockpitcardのデバイス設定 dcmDR_input_analog = find_dataref("pikitanga/ocusbmapper/dcm" .. DCMOTORS_DEVICE .. "/input/analog") dcmDR_output_motor = find_dataref("pikitanga/ocusbmapper/dcm" .. DCMOTORS_DEVICE .. "/output/motor") --*************************************************************************************-- --** SYSTEM FUNCTIONS **-- --*************************************************************************************-- function process_trim() -- trim position --revsimポテンショメーターとシム内の値の整合性を取る revsim_trim_pos = 2.4244 * dcmDR_input_analog[3] / 170 - 1.4244 --トリムインジケーターの前後位置セット trim_pos1 = simDR_trim_ind + 0.03 trim_pos2 = simDR_trim_ind - 0.03 --trim indicator -- trim up --revsimがシム位置より小さい場合はモーター前進回転。位置を超えたら停止。 if (trim_pos1 > revsim_trim_pos) then dcmDR_output_motor[5] = 10 if (trim_pos2 < revsim_trim_pos) then dcmDR_output_motor[5] = 0 end end --revsimがシム位置より大きい場合はモーター後進回転。位置を超えたら停止。 -- trim down if (trim_pos2 < revsim_trim_pos) then dcmDR_output_motor[5] = 150 if (trim_pos1 > revsim_trim_pos) then dcmDR_output_motor[5] = 0 end end -- trim wheel --トリム動作状況判断用変数セット trim_sit = simDR_trim_up + simDR_trim_down --トリムが動作中、かつdown方向ならモーターダウン方向へ回転。逆はアップ方向へ回転 if (trim_sit > 0) then if (simDR_trim_down == 1) then dcmDR_output_motor[3] = 124 end if (simDR_trim_up == 1) then dcmDR_output_motor[3] = 250 end end --トリムが動作が停止中の場合ホイールモーターは停止。 if (trim_sit == 0) then dcmDR_output_motor[3] = 0 end end --*************************************************************************************-- --** XLUA EVENT CALLBACKS **-- --*************************************************************************************-- function before_physics() process_trim() end
動作状況はこちら↓
次回はシリーズ最後でスピードブレーキです。
2020-01-06 22:05
nice!(0)
コメント(0)
コメント 0