摄影作品欣赏网站,公众号如何导入wordpress,简单的网页设计模板,logo设计说明怎么写事情起因
主要想对无人机APM固件进行仿真的算法验证#xff0c;因实际飞行的过程实际验证太浪费飞机了#xff0c;所以就先试用仿真对算法进行仿真开发。
一#xff0c;环境搭建
环境搭建我建议参考官方英文教程#xff0c;英文教程写的比较全#xff0c;不懂可以自己使…事情起因
主要想对无人机APM固件进行仿真的算法验证因实际飞行的过程实际验证太浪费飞机了所以就先试用仿真对算法进行仿真开发。
一环境搭建
环境搭建我建议参考官方英文教程英文教程写的比较全不懂可以自己使用软件翻译。
#安装git工具和相关依赖项
sudo apt-get updatesudo apt-get install gitsudo apt-get install gitk git-gui2下载官方源码
git clone https://github.com/ArduPilot/ardupilot.git
cd ardupilot
git submodule init
git submodule update(3)安装编译环境源码里面提供了脚本运行脚本即可安装好编译环境
Tools/environment_install/install-prereqs-ubuntu.sh -y执行完结果如下所示 接着运行
. ~/.profile情况提示这里建议使用最新版的apm固件的环境安装脚本因为旧版固件的安装脚本安装完环境后能编译旧版固件但不一定能编译新版固件 ---------------------------------分界线----------------------------------------------------------------------------------------------------- 到这里我直接按照README.md进行运行
./waf configure --board sitl
./waf copter #编译的是四旋翼你也可以选择固定翼直接给我报错我也不知道什么原因找了很多博客没有找到解决办法。报错如下:
Caught exception! dict object has no attribute unknownScriptName
Caught exception! dict object has no attribute unknownScriptName
.................此处省略很多字
Traceback (most recent call last):File /home/mawei/ardupilot/modules/DroneCAN/dronecan_dsdlc/dronecan_dsdlc.py, line 195, in moduleassert not buildlist-builtlist, %s not built % (buildlist-builtlist,)
AssertionError: {uavcan.tunnel.Protocol, uavcan.equipment.hardpoint.Status, com.hobbywing.esc.StatusMsg2, uavcan.equipment.gnss.Auxiliary, uavcan.protocol.NodeStatus, uavcan.equipment.camera_gimbal.GEOPOICommand, uavcan.equipment.air_data.AngleOfAttack, uavcan.equipment.air_data.Sideslip, ardupilot.gnss
dr
.................此处省略很多字
onecangen returned 1 error code
Waf: Leaving directory /home/mawei/ardupilot/build/sitl
Build failed- task in dronecan failed (exit status 1): {task 140138241604968: dronecangen .github,ardupilot,com,cuav,dronecan,mppt,tests,uavcan - }(run with -v to display more information)
gitcheckout Copter-4.1 切换分支 git submodule update --init --recursive 再运行就可以
编译对应飞机的固件代码
./waf copter
开始正式仿真
前面都是对仿真环境的配置接下来就是我们真正的仿真环境因为我们需要使用gazebo仿真平台所以打开终端在下面运行如下语句。
#联合gazebo仿真的环境如果你不使用gazebo可以不需要
../Tools/autotest/sim_vehicle.py -f gazebo-iris --console --map不用gazebo仿真一样可以完成仿真因为你的数据会在QGC地面站实时显示如下方式 打开了仿真之后我们换一个终端打开gazebo的仿真地图。 gazebo --verbose worlds/iris_arducopter_runwayorld输入起飞指令
mode guided # 引导模式
arm throttle # 解锁油门
takeoff 10 #起飞至10m高度
Land #降落