2、Ubuntu 22.04 安装px4 1.14:快速搭建

1、下载

使用git加速:https://gh-proxy.com/

bash 复制代码
# 下载
git clone https://github.com/PX4/PX4-Autopilot.git 

# 切换分支到v1.14.0
git checkout v1.14.0

# 校验:是否是1.14
git describe --tags --exact-match HEAD

2、替换链接

bash 复制代码
# 将所有 github.com 替换为 gh-proxy.org
git config --global url."https://gh-proxy.org/https://github.com/".insteadOf "https://github.com/"

# 然后更新子模块
git submodule sync --recursive
git submodule update --init --recursive
  • 也可以:手动自己去替换,建议用上面的命令,替换比较彻底。

3、设置 python 清华镜像

python 复制代码
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

pip config set global.trusted-host pypi.tuna.tsinghua.edu.cn

pip config list

4、执行

bash 复制代码
# 执行 px4 脚本
./Tools/setup/ubuntu.sh

5、执行过程中,卡在:下载

手动去下载:gcc-arm-none-eabi-9-2020-q2-update-x86_64-linux.tar.bz2

替换:ubuntu.sh 中的链接

  • 移动下载好的文件:
bash 复制代码
mv gcc-arm-none-eabi-9-2020-q2-update-x86_64-linux.tar.bz2 \
   gcc-arm-none-eabi-9-2020-q2-update-linux.tar.bz2

修改 ubuntu.sh 脚本, 找到

bash 复制代码
else
    echo "Installing arm-none-eabi-gcc-${NUTTX_GCC_VERSION}";
    wget -O /tmp/gcc-arm-none-eabi-${NUTTX_GCC_VERSION}-linux.tar.bz2 https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/${NUTTX_GCC_VERSION_SHORT}/gcc-arm-none-eabi-${NUTTX_GCC_VERSION}-${INSTALL_ARCH}-linux.tar.bz2 && \
        sudo tar -jxf /tmp/gcc-arm-none-eabi-${NUTTX_GCC_VERSION}-linux.tar.bz2 -C /opt/;
  • 替换为(注释掉 wget,改用本地文件):
bash 复制代码
else
    echo "Installing arm-none-eabi-gcc-${NUTTX_GCC_VERSION} from local file";
    LOCAL_TARBALL="${DIR}/gcc-arm-none-eabi-${NUTTX_GCC_VERSION}-linux.tar.bz2"
    if [ ! -f "$LOCAL_TARBALL" ]; then
        echo "ERROR: Local toolchain tarball not found at $LOCAL_TARBALL"
        echo "Please place the file in the same directory as ubuntu.sh"
        exit 1
    fi
    sudo tar -jxf "$LOCAL_TARBALL" -C /opt/

6、再次执行

bash 复制代码
./Tools/setup/ubuntu.sh

8、运行 jmavsim

bash 复制代码
	xcd ~/projects/PX4-Autopilotmake px4_sitl jmavsimbash
  • 进入px4命令行窗口后:可以执行如下测试命令
bash 复制代码
# 解锁(让电机可以转动)
commander unlock

# 上锁(停止电机)
commander lock

# 切换到位置控制模式(需 GPS 有效,在 jmavsim 中默认有 GPS)
# 自动起飞(如果已解锁且处于 position 模式)
commander takeoff      

# 触发自动降落
commander land         

9、运行gazebo

bash 复制代码
cd ~/projects/PX4-Autopilot

make px4_sitl gz_x500

10、安装QGC

游览器安装:https://d176tv9ibo4jno.cloudfront.net/latest/QGroundControl-x86_64.AppImage

bash 复制代码
# 授权
chmod +x QGroundControl-x86_64.AppImage

# 执行
./QGroundControl-x86_64.AppImage
相关推荐
Lsir10110_几秒前
【Linux】进程信号(下半)
linux·运维·服务器
liuniu0818几秒前
VMware虚拟机安装ubuntu2022
ubuntu·ros
skywalk816316 分钟前
unbound dns解析出现问题,寻求解决之道
运维·服务器·dns·unbound
酉鬼女又兒18 分钟前
零基础入门Linux指南:每天一个Linux命令_pwd
linux·运维·服务器
云飞云共享云桌面20 分钟前
高性能图形工作站的资源如何共享给10个SolidWorks研发设计用
linux·运维·服务器·前端·网络·数据库·人工智能
skywalk816322 分钟前
走近科学:unbound dns域名服务器自己本地解析出现问题,寻求解决之道
运维·服务器·dns·unbound
zl_dfq22 分钟前
Linux 之 【多线程】(pthread_xxx、轻量级进程、原生线程库、线程ID、__thread、线程栈、线程与信号、线程与程序替换)
linux
choke23322 分钟前
Python 基础语法精讲:数据类型、运算符与输入输出
java·linux·服务器
袁煦丞 cpolar内网穿透实验室26 分钟前
远程调试内网 Kafka 不再求运维!cpolar 内网穿透实验室第 791 个成功挑战
运维·分布式·kafka·远程工作·内网穿透·cpolar
AZ996ZA36 分钟前
自学linux的第二十一天【DHCP 服务从入门到实战】
linux·运维·服务器·php