feat:更改ros目录
parent
efb5505fe2
commit
526770ff3e
|
@ -1,134 +0,0 @@
|
||||||
cmake_minimum_required(VERSION 3.15)
|
|
||||||
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
|
|
||||||
|
|
||||||
rosbuild_init()
|
|
||||||
|
|
||||||
IF(NOT ROS_BUILD_TYPE)
|
|
||||||
SET(ROS_BUILD_TYPE Release)
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
MESSAGE("Build type: " ${ROS_BUILD_TYPE})
|
|
||||||
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -O3 -march=native ")
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O3 -march=native")
|
|
||||||
add_definitions(-w)
|
|
||||||
# Check C++11 or C++0x support
|
|
||||||
include(CheckCXXCompilerFlag)
|
|
||||||
CHECK_CXX_COMPILER_FLAG("-std=c++14" COMPILER_SUPPORTS_CXX14)
|
|
||||||
if(COMPILER_SUPPORTS_CXX14)
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
|
|
||||||
add_definitions(-DCOMPILEDWITHC11)
|
|
||||||
message(STATUS "Using flag -std=c++14.")
|
|
||||||
else()
|
|
||||||
message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
LIST(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../../../cmake_modules)
|
|
||||||
|
|
||||||
find_package(catkin REQUIRED COMPONENTS
|
|
||||||
roscpp
|
|
||||||
cv_bridge
|
|
||||||
image_transport
|
|
||||||
)
|
|
||||||
|
|
||||||
# 要保证整个工程的opencv版本一致,包括dbow,源码以及ros相关的
|
|
||||||
# 3 4 都可以正常运行
|
|
||||||
find_package(OpenCV 4.2)
|
|
||||||
if(NOT OpenCV_FOUND)
|
|
||||||
message(FATAL_ERROR "OpenCV > 4.2 not found.")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
find_package(Eigen3 3.1.0 REQUIRED)
|
|
||||||
find_package(Pangolin REQUIRED)
|
|
||||||
|
|
||||||
catkin_package(
|
|
||||||
INCLUDE_DIRS include
|
|
||||||
LIBRARIES ${PROJECT_NAME}
|
|
||||||
CATKIN_DEPENDS roscpp cv_bridge image_transport
|
|
||||||
DEPENDS OpenCV EIGEN3 Pangolin
|
|
||||||
)
|
|
||||||
|
|
||||||
include_directories(
|
|
||||||
include
|
|
||||||
${catkin_INCLUDE_DIRS}
|
|
||||||
${PROJECT_SOURCE_DIR}
|
|
||||||
${PROJECT_SOURCE_DIR}/../../../
|
|
||||||
${PROJECT_SOURCE_DIR}/../../../include
|
|
||||||
${PROJECT_SOURCE_DIR}/../../../include/CameraModels
|
|
||||||
${PROJECT_SOURCE_DIR}/../../../Thirdparty/Sophus
|
|
||||||
${Pangolin_INCLUDE_DIRS}
|
|
||||||
)
|
|
||||||
|
|
||||||
set(LIBS
|
|
||||||
${OpenCV_LIBS}
|
|
||||||
${EIGEN3_LIBS}
|
|
||||||
${Pangolin_LIBRARIES}
|
|
||||||
${PROJECT_SOURCE_DIR}/../../../Thirdparty/DBoW2/lib/libDBoW2.so
|
|
||||||
${PROJECT_SOURCE_DIR}/../../../Thirdparty/g2o/lib/libg2o.so
|
|
||||||
${PROJECT_SOURCE_DIR}/../../../lib/libORB_SLAM3.so
|
|
||||||
-lboost_system
|
|
||||||
)
|
|
||||||
|
|
||||||
# Node for monocular camera
|
|
||||||
add_executable(Mono src/ros_mono.cc)
|
|
||||||
target_link_libraries(Mono
|
|
||||||
${LIBS}
|
|
||||||
${catkin_LIBRARIES}
|
|
||||||
)
|
|
||||||
|
|
||||||
## Node for monocular camera
|
|
||||||
#rosbuild_add_executable(Mono
|
|
||||||
#src/ros_mono.cc
|
|
||||||
#)
|
|
||||||
#
|
|
||||||
#target_link_libraries(Mono
|
|
||||||
#${LIBS}
|
|
||||||
#)
|
|
||||||
|
|
||||||
# Node for monocular camera (Augmented Reality Demo)
|
|
||||||
# 由于里面代码没有将cv::mat 改成 SOPUS的暂时注释掉,不然会报错
|
|
||||||
# rosbuild_add_executable(MonoAR
|
|
||||||
# src/AR/ros_mono_ar.cc
|
|
||||||
# src/AR/ViewerAR.h
|
|
||||||
# src/AR/ViewerAR.cc
|
|
||||||
# )
|
|
||||||
|
|
||||||
# target_link_libraries(MonoAR
|
|
||||||
# ${LIBS}
|
|
||||||
# )
|
|
||||||
|
|
||||||
# Node for stereo camera
|
|
||||||
#rosbuild_add_executable(Stereo
|
|
||||||
#src/ros_stereo.cc
|
|
||||||
#)
|
|
||||||
#
|
|
||||||
#target_link_libraries(Stereo
|
|
||||||
#${LIBS}
|
|
||||||
#)
|
|
||||||
#
|
|
||||||
## Node for RGB-D camera
|
|
||||||
#rosbuild_add_executable(RGBD
|
|
||||||
#src/ros_rgbd.cc
|
|
||||||
#)
|
|
||||||
#
|
|
||||||
#target_link_libraries(RGBD
|
|
||||||
#${LIBS}
|
|
||||||
#)
|
|
||||||
#
|
|
||||||
## Node for monocular-inertial camera
|
|
||||||
#rosbuild_add_executable(Mono_Inertial
|
|
||||||
#src/ros_mono_inertial.cc
|
|
||||||
#)
|
|
||||||
#
|
|
||||||
#target_link_libraries(Mono_Inertial
|
|
||||||
#${LIBS}
|
|
||||||
#)
|
|
||||||
#
|
|
||||||
## Node for stereo-inertial camera
|
|
||||||
#rosbuild_add_executable(Stereo_Inertial
|
|
||||||
#src/ros_stereo_inertial.cc
|
|
||||||
#)
|
|
||||||
#
|
|
||||||
#target_link_libraries(Stereo_Inertial
|
|
||||||
#${LIBS}
|
|
||||||
#)
|
|
|
@ -0,0 +1,105 @@
|
||||||
|
cmake_minimum_required(VERSION 3.15)
|
||||||
|
project(orb_slam3) # 替换为你的项目名称
|
||||||
|
|
||||||
|
find_package(catkin REQUIRED COMPONENTS
|
||||||
|
roscpp
|
||||||
|
cv_bridge
|
||||||
|
image_transport
|
||||||
|
)
|
||||||
|
|
||||||
|
find_package(OpenCV 4.2 REQUIRED)
|
||||||
|
find_package(Eigen3 3.1.0 REQUIRED)
|
||||||
|
find_package(Pangolin REQUIRED)
|
||||||
|
|
||||||
|
catkin_package(
|
||||||
|
INCLUDE_DIRS include
|
||||||
|
LIBRARIES ${PROJECT_NAME}
|
||||||
|
CATKIN_DEPENDS roscpp cv_bridge image_transport
|
||||||
|
DEPENDS OpenCV EIGEN3 Pangolin
|
||||||
|
)
|
||||||
|
|
||||||
|
include_directories(
|
||||||
|
include
|
||||||
|
${catkin_INCLUDE_DIRS}
|
||||||
|
${PROJECT_SOURCE_DIR}
|
||||||
|
${PROJECT_SOURCE_DIR}/../../
|
||||||
|
${PROJECT_SOURCE_DIR}/../../include
|
||||||
|
${PROJECT_SOURCE_DIR}/../../include/CameraModels
|
||||||
|
${PROJECT_SOURCE_DIR}/../../Thirdparty/Sophus
|
||||||
|
${PROJECT_SOURCE_DIR}/../../Thirdparty/DBoW2
|
||||||
|
${Pangolin_INCLUDE_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O3 -march=native -std=c++14")
|
||||||
|
|
||||||
|
set(LIBS
|
||||||
|
${OpenCV_LIBS}
|
||||||
|
${EIGEN3_LIBS}
|
||||||
|
${Pangolin_LIBRARIES}
|
||||||
|
${PROJECT_SOURCE_DIR}/../../Thirdparty/DBoW2/lib/libDBoW2.so
|
||||||
|
${PROJECT_SOURCE_DIR}/../../Thirdparty/g2o/lib/libg2o.so
|
||||||
|
${PROJECT_SOURCE_DIR}/../../lib/libORB_SLAM3.so
|
||||||
|
-lboost_system
|
||||||
|
${catkin_LIBRARIES}
|
||||||
|
)
|
||||||
|
|
||||||
|
# Node for monocular camera
|
||||||
|
add_executable(Mono src/ros_mono.cc)
|
||||||
|
target_link_libraries(Mono ${LIBS})
|
||||||
|
|
||||||
|
## Node for monocular camera
|
||||||
|
#rosbuild_add_executable(Mono
|
||||||
|
#src/ros_mono.cc
|
||||||
|
#)
|
||||||
|
#
|
||||||
|
#target_link_libraries(Mono
|
||||||
|
#${LIBS}
|
||||||
|
#)
|
||||||
|
|
||||||
|
# Node for monocular camera (Augmented Reality Demo)
|
||||||
|
# 由于里面代码没有将cv::mat 改成 SOPUS的暂时注释掉,不然会报错
|
||||||
|
# rosbuild_add_executable(MonoAR
|
||||||
|
# src/AR/ros_mono_ar.cc
|
||||||
|
# src/AR/ViewerAR.h
|
||||||
|
# src/AR/ViewerAR.cc
|
||||||
|
# )
|
||||||
|
|
||||||
|
# target_link_libraries(MonoAR
|
||||||
|
# ${LIBS}
|
||||||
|
# )
|
||||||
|
|
||||||
|
# Node for stereo camera
|
||||||
|
#rosbuild_add_executable(Stereo
|
||||||
|
#src/ros_stereo.cc
|
||||||
|
#)
|
||||||
|
#
|
||||||
|
#target_link_libraries(Stereo
|
||||||
|
#${LIBS}
|
||||||
|
#)
|
||||||
|
#
|
||||||
|
## Node for RGB-D camera
|
||||||
|
#rosbuild_add_executable(RGBD
|
||||||
|
#src/ros_rgbd.cc
|
||||||
|
#)
|
||||||
|
#
|
||||||
|
#target_link_libraries(RGBD
|
||||||
|
#${LIBS}
|
||||||
|
#)
|
||||||
|
#
|
||||||
|
## Node for monocular-inertial camera
|
||||||
|
#rosbuild_add_executable(Mono_Inertial
|
||||||
|
#src/ros_mono_inertial.cc
|
||||||
|
#)
|
||||||
|
#
|
||||||
|
#target_link_libraries(Mono_Inertial
|
||||||
|
#${LIBS}
|
||||||
|
#)
|
||||||
|
#
|
||||||
|
## Node for stereo-inertial camera
|
||||||
|
#rosbuild_add_executable(Stereo_Inertial
|
||||||
|
#src/ros_stereo_inertial.cc
|
||||||
|
#)
|
||||||
|
#
|
||||||
|
#target_link_libraries(Stereo_Inertial
|
||||||
|
#${LIBS}
|
||||||
|
#)
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include <ros/ros.h>
|
#include <ros/ros.h>
|
||||||
#include <sensor_msgs/Image.h>
|
#include <sensor_msgs/Image.h>
|
||||||
#include "../../../../include/System.h" // 确保路径正确
|
#include "../../include/System.h" // 确保路径正确
|
||||||
|
|
||||||
namespace autolabor
|
namespace autolabor
|
||||||
{
|
{
|
|
@ -11,7 +11,6 @@
|
||||||
<param name="rescale_camera_info" value="false"/>
|
<param name="rescale_camera_info" value="false"/>
|
||||||
</node>
|
</node>
|
||||||
|
|
||||||
|
|
||||||
<!-- ORBSLAM3节点 -->
|
<!-- ORBSLAM3节点 -->
|
||||||
<node name="orb_slam3_mono" pkg="orb_slam3" type="Mono" output="screen">
|
<node name="orb_slam3_mono" pkg="orb_slam3" type="Mono" output="screen">
|
||||||
<param name="image_topic" value="/camera/image_raw"/> <!-- 定义相机话题 -->
|
<param name="image_topic" value="/camera/image_raw"/> <!-- 定义相机话题 -->
|
|
@ -15,8 +15,6 @@
|
||||||
* You should have received a copy of the GNU General Public License along with ORB-SLAM3.
|
* You should have received a copy of the GNU General Public License along with ORB-SLAM3.
|
||||||
* If not, see <http://www.gnu.org/licenses/>.
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "ros_mono.h"
|
#include "ros_mono.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
Loading…
Reference in New Issue