《一》实现步骤: (1)启动 Gazebo 模拟器; (2)起飞无人机并开始录制一个 rosbag; (3)控制无人机围绕建筑物绕圆周飞行一圈; (4)停止 rosbag 录制并使用提供的脚本提取图片; (5)使用提供的网站构建模型 前期准备: (1)更新GAAS 1)改变路径到GAAS 所在的路径或者在GAAS 打开终端
cd /home/yyl/catkin_ws/GAAS
2)更新
git pull origin master
3)将 Gazebo 仿真用到的文件拷贝到 PX4 文件所在目录中
cp -r /home/yyl/catkin_ws/GAAS/simulator/launch/* ~/catkin_ws/src/Firmware/launch/
cp -r /home/yyl/catkin_ws/GAAS/simulator/models/* ~/catkin_ws/src/Firmware/Tools/sitl_gazebo/models/
cp -r /home/yyl/catkin_ws/GAAS/simulator/worlds/* ~/catkin_ws/src/Firmware/Tools/sitl_gazebo/worlds/
cp -r /home/yyl/catkin_ws/GAAS/simulator/posix-config/* ~/catkin_ws/src/Firmware/posix-configs/SITL/init/ekf2/
《二》启动仿真
roslaunch px4 sfm.launch
检查MAVROS 的连接情况:
rostopic echo /mavros/state
通过 Rviz 来查看发布出来的摄像头图片:
rviz
选择 “Add”->“by topic”->”/gi/simulation/left/image_raw“ 订阅并存储左目摄像头的信息:
rosbag record /gi/simulation/left/image_raw -O sfm.bag
起飞无人机:
python /home/yyl/catkin_ws/GAAS/demo/tutorial_2/2_Struction_from_Motion/px4_mavros_run.py
脚本控制无人机围绕圆形飞行:
python /home/yyl/catkin_ws/GAAS/demo/tutorial_2/fly_circle.py
将 rosbag 中的图片信息提取出来
python /home/yyl/catkin_ws/GAAS/demo/tutorial_2/2_Struction_from_Motion/bag2image.py --bag /home/yyl/sfm.bag --output_path /home/yyl/picture --image_topic /gi/simulation/left/image_raw
选择图片并上传
aviation.giai.tech
即可构建模型 具体教程见:https://gaas.gitbook.io/guide/software-realization-build-your-own-autonomous-drone/wu-ren-ji-zi-dong-jia-shi-xi-lie-tong-guo-wu-ren-ji-ji-zai-she-xiang-tou-gou-jian-jian-zhu-wu-3d-mo 我实现的效果: