copter的throttle_loop()任務定義在任務串列中
1 //頻率 50 最大運行時間75us 2 SCHED_TASK(throttle_loop, 50, 75),
throttle_loop - 應該以50HZ運行
1 void Copter::throttle_loop() 2 { 3 //更新throttle_low_comp值(控制油門的優先級 VS 高度控制) 4 update_throttle_mix(); 5 6 //檢查自動armed狀態 7 update_auto_armed(); 8 9 10 //補償地面效應 11 update_ground_effect_detector(); 12 update_ekf_terrain_height_stable(); 13 }
update_throttle_mix
1 //根據vehicle狀態來設定電機throttle_low_comp值 2 //當油門高于懸停油門時,較低的值優先于飛行員/自動駕駛油門而不是姿態控制,而較高的值則優先于姿態控制而不是油門 3 void Copter::update_throttle_mix() 4 { 5 attitude_control->set_throttle_mix_man(); 6 }
AC_AttitudeControl_Multi
1 class AC_AttitudeControl_Multi 2 { 3 //設定所需的油門與姿態混合 (實際混合會在1到2秒內轉換為該值 ) 4 void set_throttle_mix_min() override { _throttle_rpy_mix_desired = _thr_mix_min}; 5 }
ap_t
1 typedef union 2 { 3 struct 4 { 5 uint8_t unused1 : 1; // 0 6 uint8_t unused_was_simple_mode : 2; // 1,2 7 uint8_t pre_arm_rc_check : 1; // 3 8 //當rc 輸入 pre-arm檢查已經完全成功時為真 9 uint8_t pre_arm_check : 1; // 4 10 //當所有的pre-arm檢查(rc,accel,calibration,gps,lock)已經被執行時,為真 11 uint8_t auto_armed : 1; // 5 12 //從開始停止自動執行,直到油門上升 13 uint8_t logging_started : 1; // 6 14 //日志記錄開始就為真 15 uint8_t land_complete : 1; // 7 16 //當探測到著陸就為真 17 uint8_t new_radio_frame : 1; // 8 18 //當來自radio的pwm資料來執行時,為真 19 uint8_t usb_connected_unused : 1; // 9 // UNUSED 20 uint8_t rc_receiver_present : 1; // 10 21 //有rc接識訓時為真 22 uint8_t compass_mot : 1; // 11 23 //正在進行羅盤校準為真 24 uint8_t motor_test : 1; // 12 25 //執行電機測驗時為真 26 uint8_t initialised : 1; // 13 27 //一旦init_ardupilot函式完成,就為真,到gps的擴展狀態不發送,直到這個完成 28 uint8_t land_complete_maybe : 1; // 14 29 //如果已經著陸就為真 30 uint8_t throttle_zero : 1; // 15 31 // 如果油門桿為零且反跳,則為true,它確定飛行員是否在不使用電動機互鎖時打算關閉 32 uint8_t system_time_set_unused : 1; // 16 33 //系統時間已經從cps設定,為真 34 uint8_t gps_glitching : 1; // 17 35 //GPS錯誤影響導航準確度 36 uint8_t using_interlock : 1; // 20 37 // aux switch motor interlock function is in use 38 //輔助開關電機互鎖功能在使用 39 uint8_t land_repo_active : 1; // 21 40 // 如果飛行員超越著陸位置,則為true 41 uint8_t motor_interlock_switch : 1; // 22 42 // 如果飛行員請求啟用電機互鎖,則為true 43 uint8_t in_arming_delay : 1; // 23 44 // 當我們武裝但正在等待旋轉電機時為真 45 uint8_t initialised_params : 1; // 24 46 // true when the all parameters have been initialised. we cannot send parameters to the GCS until this is done 47 //當所有引數已經初始化,我們不能發送引數到GPS,直到這個完成 48 uint8_t unused3 : 1; // 25 49 50 //當指南針的初始化位置已經設定為真, 51 uint8_t unused2 : 1; // 26 52 //輔助開關rc_override是允許的 53 uint8_t armed_with_switch : 1; // 27 54 //使用arm開關來armed 55 }; 56 uint32_t value; 57 } ap_t;
update_auto_armed
1 //更新auto_armed標志的狀態 2 void Copter::update_auto_armed() 3 { 4 if(ap.auto_armed) 5 { 6 } 7 }
baro_ground_effect.cpp
1 void update_ground_effect_detector(void);
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/265533.html
標籤:C++
上一篇:實作楊輝三角的幾種方法
下一篇:4.qml-Item元素學習
