Ubuntu下px4仿真平台的搭建(以无人机为例)

目录

依赖安装

ROS安装

Gazebo安装

Mavros安装

PX4配置

源码编译

键盘控制无人机飞行


依赖安装

sudo apt install ninja-build exiftool ninja-build protobuf-compiler libeigen3-dev genromfs xmlstarlet libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev python3-pip gawk
pip2 install pandas jinja2 pyserial cerberus pyulog==0.7.0 numpy toml pyquaternion empy pyyaml 
pip3 install packaging numpy empy toml pyyaml jinja2 pyargparse kconfiglib jsonschema future

如果出现下面情况的报错,可以更新setuptools和pip

Collecting pandas
  Using cached https://files.pythonhosted.org/packages/64/f1/8fdbd74edfc31625d597717be8c155c6226fc72a7c954c52583ab81a8614/pandas-1.1.2.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-qtvsjq8t/pandas/setup.py", line 349
        f"{extension}-source file '{sourcefile}' not found.\n"
                                                             ^
    SyntaxError: invalid syntax
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-qtvsjq8t/pandas/

下面是报错后进行安装的,没有报错不需要运行下面的命令:

pip install --upgrade setuptools
python -m pip install --upgrade pip

ROS安装

本仿真平台使用的为Ubuntu20.04,以前的版本不支持,如果你的电脑里已经配备了ros环境,那么就不要安装,如果没配备环境则需要安装ros环境,ros环境为ros1的Noetic,为了方便起,推荐使用小鱼一键安装脚本进行安装。

wget http://fishros.com/install -O fishros && . fishros  

如果之前没有catkin_ws,则需要新建工作空间,之后除去PX4仿真环境启动外,其余ROS相关工程在此工作空间下管理。

mkdir -p ~/catkin_ws/src
mkdir -p ~/catkin_ws/scripts
cd catkin_ws && catkin init # 使用catkin_make话,则为cd catkin_ws/src && catkin_init_workspace
catkin build # 使用catkin_make话,则为 cd .. && catkin_make 

catkin build需要先装catkin-tools(sudo apt install python3-catkin-tools),其与catkin_make的区别见Migrating fr

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值