基于gazebo的四旋翼无人机iris双目相机ORB_SLAM2

gazebo环境中的四旋翼双目ORB仿真

ORB SLAM2的编译

  • github project link
  • ORB-SLAM2的安装与运行

Build

cd ORB_SLAM2
chmod +x build.sh
./build.sh

Build in ROS

  • copy ORB_SLAM2 to catkin_ws/src
  • add Path, export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:~/catkin_ws/src/ORB_SLAM2/Examples/ROS to .bashrc
  • source ~/.bashrc

in file catkin_ws/src/ORB_SLAM2

chmod +x build_ros.sh
./build_ros.sh

遇到的BUG基本上找关键词然后在网上可以解决,也可以参考ORB SLAM2 configuration(with bugs fixed),我应该是遇到了比较多的bug

gazebo中world的搭建

  • gazebo_model_design

双目相机的搭建

  • px4/launch中找mavros_posix_sitl.launch
  • 拷贝一份作备份
  • 修改如下
    
    <arg name="est" default="ekf2"/>
    <arg name="vehicle" default="iris"/>
    
    <arg name="my_camera" default="iris_stereo_camera"/>
    <arg name="world" default="$(find mavlink_sitl_gazebo)/worlds/empty.world"/>
    
    <arg name="sdf" default="$(find mavlink_sitl_gazebo)/models/$(arg my_camera)/$(arg my_camera).sdf"/>
    
  • .gazebo/models中删除stereo_camera,因为默认先选这个,这里要用px4/tools/sitl_gazebo/models里面的

运行

我在launch了mavros_posix_sitl.launch后,使用rostopic list命令,发现有:

/stereo/left/camera_info
/stereo/left/image_raw
/stereo/left/image_raw/compressed
/stereo/left/image_raw/compressed/parameter_descriptions
/stereo/left/image_raw/compressed/parameter_updates
/stereo/left/image_raw/compressedDepth
/stereo/left/image_raw/compressedDepth/parameter_descriptions
/stereo/left/image_raw/compressedDepth/parameter_updates
/stereo/left/image_raw/theora
/stereo/left/image_raw/theora/parameter_descriptions
/stereo/left/image_raw/theora/parameter_updates
/stereo/left/parameter_descriptions
/stereo/left/parameter_updates
/stereo/right/camera_info
/stereo/right/image_raw
/stereo/right/image_raw/compressed
/stereo/right/image_raw/compressed/parameter_descriptions
/stereo/right/image_raw/compressed/parameter_updates
/stereo/right/image_raw/compressedDepth
/stereo/right/image_raw/compressedDepth/parameter_descriptions
/stereo/right/image_raw/compressedDepth/parameter_updates
/stereo/right/image_raw/theora
/stereo/right/image_raw/theora/parameter_descriptions
/stereo/right/image_raw/theora/parameter_updates
/stereo/right/parameter_descriptions
/stereo/right/parameter_updates

存在,于是构建对应的.sh文件

rosrun ORB_SLAM2 Stereo ~/catkin_ws/src/ORB_SLAM2/Vocabulary/ORBvoc.txt ~/catkin_ws/src/ORB_SLAM2/Examples/Stereo/px4_sitl.yaml true /camera/left/image_raw:=/stereo/left/image_raw /camera/right/image_raw:=/stereo/right/image_raw /orbslam2/vision_pose/pose:=/mavros/vision_pose/pose

结果如下:

基于gazebo的四旋翼无人机iris双目相机ORB_SLAM2_第1张图片

你可能感兴趣的:(开源SLAM学习,自动驾驶,人工智能,opencv)