日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

PX4开发环境搭建--模拟器编译及QGroundControl RC遥控模拟配置

發布時間:2023/12/2 编程问答 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 PX4开发环境搭建--模拟器编译及QGroundControl RC遥控模拟配置 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

PX4開發環境搭建--模擬器編譯

  • 1. PX4開發環境介紹
  • 2. PX4開發環境搭建
    • 2.1代碼下載
    • 2.2 國內環境調整
    • 2.3 建立ubuntu開發環境
    • 2.4 構建jMAVSim仿真
    • 2.5 補充版本信息
  • 3. jmavsim仿真環境
    • 3.1 仿真命令集
    • 3.2 命令實例
  • 4. QGroundControl & RC遙控模擬配置
    • 4.1 QGroundControl配置
    • 4.2 RC遙控器配置

之前我們在做BetaFlight開源工程結構簡明介紹的時候,有過一張開源飛控的介紹圖譜。

從這張圖譜我們看到基本上有5條軸線:

  • Pixhawk // PX4
  • Ardupilot
  • OpenPilot
  • MultiWii // baseflight/cleanflight/betaflight
  • Paparazzi
  • BaseFlight/CleanFlight/BetaFlight目前在穿越機上的應用比較廣泛。穿越機通常是小型機,比如:5寸以下。且整體起飛重量都比較輕,置空時間通常也就10分鐘~30分鐘范圍。

    航拍,無人巡航的角度,不是僅僅RC控制,更多功能需要通過地面站的接入處理。從這個角度來說,PX4就有很好的優勢(這篇文章主要是介紹PX4,其他當然也有很好的Paparazzi等)。

    1. PX4開發環境介紹

    整個PX4開發環境可以用于非常多的實例:

    • Pixhawk和NuttX-based硬件
    • jMAVSim 仿真
    • Gazebo 仿真
    • Raspberry Pi
    • ROS (Robotics Operating System)
    • Fast DDS - Required for ROS2

    注:這里主要介紹基于Ubuntu 20.04 LTS (Focal Fossa)的搭建。

    2. PX4開發環境搭建

    2.1代碼下載

    $ git clone https://github.com/PX4/PX4-Autopilot.git --recursive

    2.2 國內環境調整

    這些東西都是國外的,國內整體情況(比如:網絡等)不理想,因此需要做一些調整。

    • 調整ubuntu本地apt升級路徑:aliyun
    $ sudo vi /etc/apt/sources.list # deb cdrom:[Ubuntu 20.04.2.0 LTS _Focal Fossa_ - Release amd64 (20210209.1)]/ focal main restricted# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution. deb http://mirrors.aliyun.com/ubuntu/ focal main restricted## Major bug fix updates produced after the final release of the ## distribution. deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team. Also, please note that software in universe WILL NOT receive any ## review or updates from the Ubuntu security team. deb http://mirrors.aliyun.com/ubuntu/ focal universe # deb-src http://hk.archive.ubuntu.com/ubuntu/ focal universe deb http://mirrors.aliyun.com/ubuntu/ focal-updates universe # deb-src http://hk.archive.ubuntu.com/ubuntu/ focal-updates universe## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team, and may not be under a free licence. Please satisfy yourself as to ## your rights to use the software. Also, please note that software in ## multiverse WILL NOT receive any review or updates from the Ubuntu ## security team. # deb-src http://hk.archive.ubuntu.com/ubuntu/ focal multiverse # deb-src http://hk.archive.ubuntu.com/ubuntu/ focal-updates multiverse## N.B. software from this repository may not have been tested as ## extensively as that contained in the main release, although it includes ## newer versions of some applications which may provide useful features. ## Also, please note that software in backports WILL NOT receive any review ## or updates from the Ubuntu security team. deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe## Uncomment the following two lines to add software from Canonical's ## 'partner' repository. ## This software is not part of Ubuntu, but is offered by Canonical and the ## respective vendors as a service to Ubuntu users. # deb http://archive.canonical.com/ubuntu focal partner # deb-src http://archive.canonical.com/ubuntu focal partnerdeb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted deb http://mirrors.aliyun.com/ubuntu/ focal-security universe # deb-src http://security.ubuntu.com/ubuntu focal-security universe # deb-src http://security.ubuntu.com/ubuntu focal-security multiverse# This system was installed using small removable media # (e.g. netinst, live or single CD). The matching "deb cdrom" # entries were disabled at the end of the installation process. # For information about how to configure apt package sources, # see the sources.list(5) manual.
    • 調整python3本地pip升級路徑:tsinghua
    diff --git a/Tools/setup/ubuntu.sh b/Tools/setup/ubuntu.sh index 25c12cb170..8bdc7ae910 100755 --- a/Tools/setup/ubuntu.sh +++ b/Tools/setup/ubuntu.sh @@ -105,10 +105,10 @@ echoecho "Installing PX4 Python3 dependencies"if [ -n "$VIRTUAL_ENV" ]; then# virtual envrionments don't allow --user option - python -m pip install -r ${DIR}/requirements.txt + python -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r ${DIR}/requirements.txtelse# older versions of Ubuntu require --user option - python3 -m pip install --user -r ${DIR}/requirements.txt + python3 -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --user -r ${DIR}/requirements.txtfi# NuttX toolchain (arm-none-eabi-gcc)

    2.3 建立ubuntu開發環境

    $ bash ./PX4-Autopilot/Tools/setup/ubuntu.sh

    注:如果缺少2.2步驟,將會遇到非常多莫名其妙的問題,大體還是網絡問題。

    2.4 構建jMAVSim仿真

    $ make px4_sitl jmavsim

    2.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組件,導致腳本jmavsim_run.sh的73行代碼無法執行。

    PX4-Autopilot/Tools/jmavsim_run.sh +73ant create_run_jar copy_res

    所以請確認ant是否已經安裝:

    $ sudo apt-get install ant

    3. jmavsim仿真環境

    3.1 仿真命令集

    仿真環境下支持的命令列表如下:

    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_test

    3.2 命令實例

    舉例:
    commander takeoff //起飛
    commander land //降落

    注:由于我的遙控器距離有問題,去維修了(四軸飛控DIY集成FPV功能),有興趣的朋友可以跑下QGroundControl。后續有時間再做更新!!!

    4. QGroundControl & RC遙控模擬配置

    上次我們說過要做后續更新,更新就是如何基于模擬器來簡單實現一些基本飛控操作。這個主要還是在于PX4模塊設計之一:SITL & HITL模擬框架。這里主要還是基于SITL這個框架做了一個QGroundControl遠程連接,以及QGroundControl上連接一個模擬遙控器(采用BetaFlight KakuteF7 + ELRS遙控,真實設備)

    注:BetaFlight固件(4.2.11)是支持作為模擬器輸入,便于更好的使用仿真軟件來學習手動飛行。

    4.1 QGroundControl配置

    新建一個連接,并將配置接到SITL的18570端口上。這樣PX4 SITL軟件可以跑在一臺電腦(通常大家習慣Windows系統)上,而編譯系統(Ubuntu 20.4)編譯PX4 SITL跑在編譯機器上做仿真。
    具體QGroundControl的配置如下,記得使用前一定要Connect哦!!!
    注:QGroundControl使用

    4.2 RC遙控器配置

    首先,要根據4.1章節,先Connect;這樣Vehicle Setup才會出來。出來以后接上自己的模擬遙控器咯,把USB插上去就OK了。
    看到設備以后,第一次一定要校準。

    總結

    以上是生活随笔為你收集整理的PX4开发环境搭建--模拟器编译及QGroundControl RC遥控模拟配置的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。