PX4开发环境搭建--模拟器编译及QGroundControl RC遥控模拟配置
PX4開發(fā)環(huán)境搭建--模擬器編譯
- 1. PX4開發(fā)環(huán)境介紹
- 2. PX4開發(fā)環(huán)境搭建
- 2.1代碼下載
- 2.2 國內(nèi)環(huán)境調(diào)整
- 2.3 建立ubuntu開發(fā)環(huán)境
- 2.4 構(gòu)建jMAVSim仿真
- 2.5 補充版本信息
- 3. jmavsim仿真環(huán)境
- 3.1 仿真命令集
- 3.2 命令實例
- 4. QGroundControl & RC遙控模擬配置
- 4.1 QGroundControl配置
- 4.2 RC遙控器配置
之前我們在做BetaFlight開源工程結(jié)構(gòu)簡明介紹的時候,有過一張開源飛控的介紹圖譜。
從這張圖譜我們看到基本上有5條軸線:
BaseFlight/CleanFlight/BetaFlight目前在穿越機上的應(yīng)用比較廣泛。穿越機通常是小型機,比如:5寸以下。且整體起飛重量都比較輕,置空時間通常也就10分鐘~30分鐘范圍。
航拍,無人巡航的角度,不是僅僅RC控制,更多功能需要通過地面站的接入處理。從這個角度來說,PX4就有很好的優(yōu)勢(這篇文章主要是介紹PX4,其他當然也有很好的Paparazzi等)。
1. PX4開發(fā)環(huán)境介紹
整個PX4開發(fā)環(huán)境可以用于非常多的實例:
- Pixhawk和NuttX-based硬件
- jMAVSim 仿真
- Gazebo 仿真
- Raspberry Pi
- ROS (Robotics Operating System)
- Fast DDS - Required for ROS2
注:這里主要介紹基于Ubuntu 20.04 LTS (Focal Fossa)的搭建。
2. PX4開發(fā)環(huán)境搭建
2.1代碼下載
$ git clone https://github.com/PX4/PX4-Autopilot.git --recursive2.2 國內(nèi)環(huán)境調(diào)整
這些東西都是國外的,國內(nèi)整體情況(比如:網(wǎng)絡(luò)等)不理想,因此需要做一些調(diào)整。
- 調(diào)整ubuntu本地apt升級路徑:aliyun
- 調(diào)整python3本地pip升級路徑:tsinghua
2.3 建立ubuntu開發(fā)環(huán)境
$ bash ./PX4-Autopilot/Tools/setup/ubuntu.sh注:如果缺少2.2步驟,將會遇到非常多莫名其妙的問題,大體還是網(wǎng)絡(luò)問題。
2.4 構(gòu)建jMAVSim仿真
$ make px4_sitl jmavsim2.5 補充版本信息
目前,使用git最新版本:
commit ffb0097052227e1b7dc2665463b6b9de33bbf835 (HEAD -> master, origin/master, origin/HEAD) Author: CR <christopher.ruwisch@tu-berlin.de> Date: Wed Jun 22 21:50:30 2022 +0200removed unused code - _constrainOneSide and _constrainAbs這個版本在實際使用過程存在一個問題,當2.4編譯成功后,無法看到模擬GUI界面,主要是缺少ant組件,導(dǎo)致腳本jmavsim_run.sh的73行代碼無法執(zhí)行。
PX4-Autopilot/Tools/jmavsim_run.sh +73ant create_run_jar copy_res所以請確認ant是否已經(jīng)安裝:
$ sudo apt-get install ant3. jmavsim仿真環(huán)境
3.1 仿真命令集
仿真環(huán)境下支持的命令列表如下:
pxh> help Builtin Commands:actuator_testairship_att_controlairspeed_selectorattitude_estimator_qbattery_simulatorcamera_feedbackcamera_triggercdev_testcommandercommander_testscontrol_allocatorcontrollib_testdatamandynekf2ex_fixedwing_controlfailurefake_gpsfake_imufake_magnetometerflight_mode_managerfw_att_controlfw_autotune_attitude_controlfw_pos_control_l1gimbalgpsgyro_calibrationgyro_ffthellohrt_testland_detectorlanding_target_estimatorled_controllist_fileslist_taskslistenerload_monlocal_position_estimatorloggermag_bias_estimatormanual_controlmavlinkmavlink_testsmc_att_controlmc_autotune_attitude_controlmc_hover_thrust_estimatormc_pos_controlmc_rate_controlmixermotor_testnavigatorparamperfpwmpwm_out_simpx4_mavlink_debugpx4_simple_apprc_testsrc_updatereplayrover_pos_controlrover_steering_controlrpm_simulatorsd_benchsend_eventsensor_baro_simsensor_gps_simsensor_mag_simsensorsshutdownsihsimulatorsleepsystem_timetemperature_compensationteststone_alarmtune_controluorbuorb_testsuuv_att_controluuv_example_appuuv_pos_controlvervtol_att_controlwork_item_examplework_queuewqueue_test3.2 命令實例
舉例:
commander takeoff //起飛
commander land //降落
注:由于我的遙控器距離有問題,去維修了(四軸飛控DIY集成FPV功能),有興趣的朋友可以跑下QGroundControl。后續(xù)有時間再做更新!!!
4. QGroundControl & RC遙控模擬配置
上次我們說過要做后續(xù)更新,更新就是如何基于模擬器來簡單實現(xiàn)一些基本飛控操作。這個主要還是在于PX4模塊設(shè)計之一:SITL & HITL模擬框架。這里主要還是基于SITL這個框架做了一個QGroundControl遠程連接,以及QGroundControl上連接一個模擬遙控器(采用BetaFlight KakuteF7 + ELRS遙控,真實設(shè)備)
注:BetaFlight固件(4.2.11)是支持作為模擬器輸入,便于更好的使用仿真軟件來學(xué)習(xí)手動飛行。
4.1 QGroundControl配置
新建一個連接,并將配置接到SITL的18570端口上。這樣PX4 SITL軟件可以跑在一臺電腦(通常大家習(xí)慣Windows系統(tǒng))上,而編譯系統(tǒng)(Ubuntu 20.4)編譯PX4 SITL跑在編譯機器上做仿真。
具體QGroundControl的配置如下,記得使用前一定要Connect哦!!!
注:QGroundControl使用
4.2 RC遙控器配置
首先,要根據(jù)4.1章節(jié),先Connect;這樣Vehicle Setup才會出來。出來以后接上自己的模擬遙控器咯,把USB插上去就OK了。
看到設(shè)備以后,第一次一定要校準。
總結(jié)
以上是生活随笔為你收集整理的PX4开发环境搭建--模拟器编译及QGroundControl RC遥控模拟配置的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 优秀的穿越机玩家们看过来,你们现在拥有进
- 下一篇: 从各方面比较一下各类电脑玩手游吃鸡安卓模