安装必要工具
开发代码
上传代码至云服务器
~/PX4-Workspace。首次配置(如未完成)
安装 PX4 工具链及依赖:
bashsudo apt update && sudo apt upgrade -y
sudo apt install git cmake build-essential genromfs ninja-build -y
bash ~/PX4-Autopilot/Tools/setup/ubuntu.sh
确保 SSH 和 FTP 服务可用:
bashsudo apt install openssh-server vsftpd -y
sudo systemctl enable ssh
sudo systemctl start ssh
sudo systemctl enable vsftpd
sudo systemctl start vsftpd
代码接收与更新
bashssh <your-user>@<server-ip>
bashcd ~/PX4-Workspace
ls -la
~/PX4-Autopilot):bashrm -rf ~/PX4-Autopilot/*
mv ~/PX4-Workspace/* ~/PX4-Autopilot/
编译 PX4
bashcd ~/PX4-Autopilot
make clean
bashmake px4_sitl gazebo
启动模拟器
bashmake px4_sitl gazebo
bashmake px4_sitl jmavsim
连接地面站软件(QGroundControl)
14560)。监控飞行状态
保存运行日志
bashmake px4_sitl gazebo > simulation_log.txt 2>&1
分析日志
bashscp <your-user>@<server-ip>:~/PX4-Autopilot/simulation_log.txt .
本地开发设备(Windows)
云服务器(Ubuntu)
地面站监控(Windows)
使用 rsync 替代 FTP
bashrsync -avz ~/PX4-Workspace/ <your-user>@<server-ip>:~/PX4-Autopilot/
自动化脚本
bash# 自动同步、编译和启动模拟器
rsync -avz ~/PX4-Workspace/ <your-user>@<server-ip>:~/PX4-Autopilot/
ssh <your-user>@<server-ip> << EOF
cd ~/PX4-Autopilot
make clean
make px4_sitl gazebo
EOF
| 工具 | 用途 | 安装命令 |
|---|---|---|
vsftpd | 配置云服务器 FTP 服务 | sudo apt install vsftpd |
rsync | 高效同步文件 | sudo apt install rsync |
gazebo | 3D 模拟器 | 官方文档:PX4 Setup Script |
jmavsim | 轻量模拟器 | 默认包含在 PX4 构建环境中 |
QGroundControl | 地面站监控模拟器 | 下载地址:QGroundControl |
通过以上流程,您可以充分利用本地和云端的硬件资源,实现高效的 PX4 无人机开发与测试工作流。
0 评论