版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
3.0.1*
*SpecialThanksforContributors(inalphabeticalorderbyfirstname):
*
*AdamMRivera:AutoCompassDeclination
*AmilcarLucas:Cameramountlibrary
*AndrewTridgell:Generaldevelopment,MavlinkSupport
*AngelFernandez:Alphatesting
*DougWeibel:Libraries
*ChristofSchmid:Alphatesting
*DaniSaez:VOctoSupport
*GregoryFletcher:Cameramountorientationmath
*Guntars:Armingsafetysuggestion
*HappyKillmore:MavlinkGCS
*HeinHollander:OctoSupport
*IgorvanAirde:ControlLawoptimization
*LeonardHall:FlightDynamics,Throttle,LoiterandNavigationControllers
*JonathanChallingerInertialNavigation
*Jean-LouisNaudin:AutoLanding
*MaxLevine:TriSupport,Graphics
*JackDunkle:Alphatesting
*JamesGoppert:MavlinkSupport
*JaniHiriven:Testingfeedback
*JohnArneBirkeland:PPMEncoder
*JoseJulio:StabilizationControllaws
*MarcoRobustini:Leadtester
*MichaelOborne:MissionPlannerGCS
*MikeSmith:Libraries,Codingsupport
*Oliver:Piezosupport
*OlivierAdler:PPMEncoder
*RobertLefebvre:HeliSupport&LEDs
*SandroBenigno:Camerasupport
*
*AndmuchmoresoPLEASEPMmeonDIYDRONEStoaddyourcontributiontotheList
*
*RequiresmodifiednmrelaxnversionofArduino,whichcanbefoundhere:
**
*/
Itmay
staticAP_HAL::BetterStream*cliSerial;
weneedtokeepastaticdeclarationwhichisn'tguardedbymacros
Realsensorsareused.
Mostsensorsaredisabled,astheHIL
Syntheticsensorsareconfiguredthat
staticGPS*g_gps;
2C2c#endif
#endif
#ifCONFIG_HAL_BOARD=HAL_BOARD_PX4
staticAP_Compass_PX4compass;
#else
staticAP_Compass_HMC5843compass;
#endif
#endif
19g#endif#endif*Seelibraries/RC_Channel/formoreinformation
*/
It'scurrentlytherawIMUrates
3flcm;
usedtopointthenoseofthecopteratthenextwaypoint
staticint32_toriginal_wp_bearing;
staticuint32_twp_distance;
Thesevaluesaregenerated
Theyareusedthroughoutthecodewherecosandsin
Thisvalueisresetateacharming
20mstaticint32_tinitial_simple_bearing;
3fx二lat,y=Ion
Incrementedatcircle_rate/second
staticfloatcircle_angle;
1.05fstaticintl6_tsonar_alt;
staticuint8_tsonar_alt_health;staticint32_tnav_roll;
negativePitchmeansgoforward.
staticint32_tnav_pitch;
staticint32_toLroll;
negativePitchmeansgoforward.
staticint32_to匚pitch;
staticintl6_tnav_throttle;staticint32_tnav_yaw;
staticuint8_tyaw_timer;
3f
staticuint32_tcondition_start;
Usedforperformancemonitoringandfailsafeprocessing
staticuintl6_tmainLoop_count;
staticAP_HAL::AnalogSource*rssi_analog_source;
=false;
Log_Write_Event(DATA_EXIT_FLIP);
)
)
get_look_ahead_yawbreak;
#ifTOY_LOOKUP==TOY_EXTERNAL_MIXER
caseYAW_TOY:
controller_desired_alt=get_initial_alt_hold,climb_rate);
return;
//donotrunthrottlecontrollersifmotorsdisarmed
if(!()){
set_throttle_out(0,false);
throttle_accel_deactivate();//donotallowtheaccelbasedthrottletooverrideour
command
set_target_alt_for_reporting(0);
return;
)
#ifFRAME_CONFIG==HELI_FRAME
if(control_mode==STABILIZE)(
=true;
}else{
=false;
)
#endif//HELI_FRAME
switch(throttle_mode){
caseTHROTTLE_MANUAL:
//completelymanualthrottle
if<=0){
set_throttle_out(0,false);
}else{
//sendpilot'soutputdirectlytomotors
pilot_throttle_scaled=get_pilot_desired_throttle
set_throttle_out(pilot_throttle_scaled,false);
//updateestimateofthrottlecruise
#ifFRAME_CONFIG==HELI_FRAME
update_throttle_cruise;
#else
update_throttle_cruise(pilot_throttle_scaled);
#endif//HELI_FRAME
//checkifwe*vetakenoffyet
if(!&&()){
if(pilot_throttle_scaled>{
//wemustbeintheairbynow
set_takeoffLcomplete(true);
)
)
)
set_target_alt_for_reporting(0);
break;
caseTHROTTLE_MANUAL_TILT_COMPENSATED:
//manualthrottlebutwithangleboost
if<=0){
set_throttle_out(0,false);//noneedforangleboostwithzerothrottle
}else{
pilot_throttle_scaled=get_pilot_desired_throttle
set_throttle_out(pilot_throttle_scaled,true);
//updateestimateofthrottlecruise
#ifFRAME_CONHG==HELI_FRAME
update_throttle_cruise;
#else
update_throttle_cruise(pilot_throttle_scaled);
#endif//HELI_FRAME
ifC&&()){
if(pilot_throttle_scaled>{
//wemustbeintheairbynow
set_takeoff_complete(true);
)
)
set_target_alt_for_reporting(0);
break;
caseTHROTTLE_HOLD:
if{
//altholdpluspilotinputofclimbrate
pilot_climb_rate=get_pilot_desired_climb_rate
if(sonar_alt_health>=SONAR_ALT_HEALTH_MAX){
//ifsonarisok,usesurfacetracking
get_throttle_surface_tracking(pilot_climb_rate);//thisfunctioncalls
set_target_alt_for_reportingforus
}else{
//ifnosonarfallbackstabilizeratecontroller
get_throttle_rate_stabilized(pilot_climb_rate);//thisfunctioncalls
set_target_alt_for_reportingforus
)
}else{
//pilotsthrottlemustbeatzerosokeepmotorsoff
set_throttle_out(0,false);
set_target_alt_fdr_reporting(0);
)
break;
caseTHROTTLE_AUTO:
//autopilotaltitudecontrollerwithtargetaltitudeheldin()
if{
get_throttle_althold_with_slew(),(),());
set_target_alt_fdr_reporting());//To-Do:returnget_destination_altifweareflying
toawaypoint
}else{
//pilot'sthrottlemustbeatzerosokeepmotorsoff
set_throttle_out(0,false);
set_target_alt_for_reporting(0);
)
break;
caseTHROTTLE_LAND:
//landingthrottlecontroller
get_throttle_land();
set_target_alt_for_reporting(0);
break;
)
//set_target_alt_fbr_reporting-settargetaltitudeincmforreportingpurposes(logsandgcs)
staticvoidset_target_alt_for_reporting(floatalt_cm)
target_alt_for_reporting=alt_cm;
)
//get_target_alt_for_reporting-returnstargetaltitudeincmforreportingpurposes(logsandgcs)
staticfloatget_target_alt_for_reporting()
(
returntarget_alt_for_reporting;
)
staticvoidread_AHRS(void)
(
//PerformIMUcalculationsandgetattitudeinfo
//-------------------------------------------------
#ifHIL_MODE!=HIL_MODE_DISABLED
//updatehilbeforeahrsupdate
gcs_check_input();
#endif
0;
omega=();
#ifSECONDARY_DMP_ENABLED二二ENABLED
0;
#endif
)
staticvoidupdate_trig(void){
Vector2fyawvector;
constMatrix3f&temp=();
=//sin
=//cos
0;
cos_pitch_x=safe_sqrt(l-*//level=1
cos_roll_x=/cos_pitch_x;//level=1
cos_pitch_x=constrain_float(cos_pitch_x,0,;
//thisreliesonconstrain_float()ofinfinitydoingtherightthing,
//whichitdoesdoinavr-libc
cos_roll_x=constrain_float(cos_roll_x,,;
sin_yaw=constrain_float,,;
cos_yaw=constrain_float,,;
//addedtoconvertearthframetobodyframeforratecontrollers
sin_pitch=sin_roll=/cos_pitch_x;
//updatewp_navcontrollerwithtrigvalues
(cos_yaw,sin_yaw,cos_pitch_x);
//flat:
//0°=cos_yaw:,sin_yaw:,
//90°=cos_yaw:,sin_yaw:,
II180=cos_yaw:,sin_yaw:,
〃270=cos_yaw:,sin_yaw:,
)
//readbaroandsonaraltitudeat20hz
staticvoidupdate_altitude()
(
#ifHIL_MODE==HIL_MODE_ATTITUDE
//weareintheSIM,fakeoutthebaroandSonar
baro_alt=g_gps->altitude_cm-gps_base_alt;
if{
sonar_alt=baro_alt;
)
#else
//readinbaroaltitude
baro_alt=read_barometer();
//readinsonaraltitude
sonar_alt=read_sonar();
#endif//HIL_MODE==HIL_MODE_ATTITUDE
//writealtitudeinfotodataflashlogs
if(&MASK_LOG_CTUN)&&()){
Log_Write_Control_Tuning();
staticvoidtuning(){
tuning_value=(float)/;
//Oto1
switch{
//Roll,Pitchtuning
caseCH6_STABILIZE_ROLL_PITCH_KP:
break;
caseCH6_RATE_ROLL_PITCH_KP:
break;
caseCH6_RATE_ROLL_PITCH_KI:
break;
caseCH6_RATE_R0LL_PITCH_KD:
break;
//Yawtuning
caseCH6_STABILIZE_YAW_KP:
break;
caseCH6_YAW_RATE_KP:
break;
caseCH6_YAW_RATE_KD:
break;
//Altitudeandthrottletuning
caseCH6_ALTITUDE_H0LD_KP:
break;
caseCH6_THROTTLE_RATE_KP:
break;
caseCH6_THROTTLE_RATE_KD:
break;
caseCH6_THROTTLE_ACCEL_KP:
break;
caseCH6_THROTTLE_ACCEL_KI:
break;
caseCH6_THROTTLE_ACCEL_KD:
break;
//Loiterandnavigationtuning
caseCH6_LOITER_POSITION_KP:
break;
caseCH6_LOITER_RATE_KP:
break;
caseCH6_LOITER_RATE_KI:
break;
caseCH6_LOITER_RATE_KD:
break;
caseCH6_WP_SPEED:
//setwaypointnavigationhorizontalspeedto0?1000cm/s
break;
//Aeroandothertuning
caseCH6_ACRO_KP:
=tuning_value;
break;
caseCH6_RELA
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 武漢紡織大學(xué)《醫(yī)藥企業(yè)管理》2023-2024學(xué)年第一學(xué)期期末試卷
- 二零二五年教育輔助機(jī)構(gòu)勞動(dòng)合同及教學(xué)質(zhì)量協(xié)議3篇
- 二零二五年環(huán)保產(chǎn)品生產(chǎn)加工合作合同范本2篇
- 二零二五年度塑料加工工廠承包生產(chǎn)與環(huán)保責(zé)任合同3篇
- 濰坊護(hù)理職業(yè)學(xué)院《學(xué)習(xí)科學(xué)與技術(shù)》2023-2024學(xué)年第一學(xué)期期末試卷
- 天津藝術(shù)職業(yè)學(xué)院《燈光照明基礎(chǔ)》2023-2024學(xué)年第一學(xué)期期末試卷
- 二零二五年度高科技設(shè)備租賃擔(dān)保服務(wù)合同3篇
- 2024民間借貸合同(自動(dòng)放棄利息)
- 二零二五年影視制作項(xiàng)目投資合同正本3篇
- 二零二五版影視制作借款合同示范文本2篇
- 基因突變和基因重組(第1課時(shí))高一下學(xué)期生物人教版(2019)必修2
- 天津市八校2023-2024學(xué)年高三年級(jí)下冊(cè)聯(lián)合模擬考試數(shù)學(xué)試題(二)(含答案解析)
- 納米技術(shù)增強(qiáng)早期疾病生物標(biāo)志物的檢測(cè)
- 產(chǎn)品銷量分析表折線圖excel模板
- 辦公設(shè)備(電腦、一體機(jī)、投影機(jī)等)采購(gòu) 投標(biāo)方案(技術(shù)方案)
- 【真題】2023年南京市中考語(yǔ)文試卷(含答案解析)
- 功率模塊可靠性壽命評(píng)估與預(yù)測(cè)
- 案卷評(píng)查培訓(xùn)課件模板
- 湘教版七年級(jí)地理第一學(xué)期期末試卷分析
- 上海春季高考英語(yǔ)真題試題word精校版(含答案)
- “數(shù)”我精彩-“學(xué)”有特色-小學(xué)六年級(jí)數(shù)學(xué)寒假特色作業(yè)展示
評(píng)論
0/150
提交評(píng)論