feat:更改ros目录

master
邱棚 2024-07-04 17:37:41 +08:00
parent efb5505fe2
commit 526770ff3e
18 changed files with 106 additions and 138 deletions

View File

@ -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
)
# opencvdbowros
# 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}
#)

View File

@ -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}
#)

View File

@ -3,7 +3,7 @@
#include <ros/ros.h>
#include <sensor_msgs/Image.h>
#include "../../../../include/System.h" // 确保路径正确
#include "../../include/System.h" // 确保路径正确
namespace autolabor
{

View File

@ -11,7 +11,6 @@
<param name="rescale_camera_info" value="false"/>
</node>
<!-- ORBSLAM3节点 -->
<node name="orb_slam3_mono" pkg="orb_slam3" type="Mono" output="screen">
<param name="image_topic" value="/camera/image_raw"/> <!-- 定义相机话题 -->

View File

@ -15,8 +15,6 @@
* You should have received a copy of the GNU General Public License along with ORB-SLAM3.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "ros_mono.h"
#include <iostream>
#include <fstream>