采集Android手机摄像头运行ORB_SLAM2(ubuntu16.04+ROS kinetic)

本地编译的工程已上传git/ORB_SLAM2, Android_apk      https://github.com/Donottakenleeplease

1.首先下载相关文件,其中APK应用到手机安装。

git clone https://github.com/hitcm/Android_Camera-IMU.git 

2.安装IMU_TOOLS

sudo apt-get install ros-kinetic-imu-tools

中间的版本号可以变更,比如indigo

3.连接手机和ROS

新开终端启动roscore

打开手机APK,确保手机和ubuntu系统连接同一个wifi

使用ifconfig查看本机IP地址,并在手机APK中输入  例如   http://192.168.111.10:11311/  点击连接 若正常连接即启动android相机应用。

4.运行launch文件

进入刚才的git目录,运行android_cam-imu.launch文件

roslaunch android_cam-imu.launch

则会弹出rviz文件相关窗口  点击下方add键  选择By topic

添加imu  添加/camera/image_raw image  若正常 则应显示imu指标和相机图像

5.添加node节点至ORB_SLAM2中

将工作空间中的ORB_SLAM2/src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/src中的ros_mono.cc

ros::Subscriber sub = nodeHandler.subscribe("/camera/image_raw", 1, &ImageGrabber::GrabImage,&igb);

改为自己运行rosnode list命令查询到的Android相机发布的节点。一般这里是不需要改的,假如之前你运用过USB_CAM,那是需要更该然后重新编译的。

6.运行ORB_SLAM2

运行命令,注意更改路径。

rosrun ORB_SLAM2 Mono /home/lee/SLAM/src/ORB_SLAM2/Vocabulary/ORBvoc.txt /home/lee/SLAM/src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/mycam.yaml

相关源码见博客 https://www.cnblogs.com/hitcm/p/5616364.html 

猜你喜欢

转载自blog.csdn.net/qq_36122936/article/details/88556428