Browse Source

Use same layout as for cartographer_ros. (#26)

- Change building to use functions.cmake.
Holger Rapp 9 năm trước cách đây
mục cha
commit
1c0a188e22

+ 4 - 26
cartographer_turtlebot/CMakeLists.txt

@@ -21,37 +21,15 @@ set(PACKAGE_DEPENDENCIES
   sensor_msgs
 )
 
-set(CMAKE_CXX_FLAGS "-pthread -std=c++11 -Wreorder")
-
-if(NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "")
-  set(CMAKE_BUILD_TYPE Release)
-endif()
-
-if(CMAKE_BUILD_TYPE STREQUAL "Release")
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -DNDEBUG")
-elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -g -DNDEBUG")
-elseif(CMAKE_BUILD_TYPE STREQUAL "Debug")
-  message(FATAL_ERROR "Cartographer is too slow to be useful in debug mode.")
-else()
-  message(FATAL_ERROR "Unknown CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
-endif()
-
-message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
+find_package(cartographer REQUIRED)
+include("${CARTOGRAPHER_CMAKE_DIR}/functions.cmake")
+google_initialize_cartographer_project()
 
 find_package(catkin REQUIRED COMPONENTS ${PACKAGE_DEPENDENCIES})
 
 catkin_package(CATKIN_DEPENDS message_runtime ${PACKAGE_DEPENDENCIES})
 
-add_executable(flat_world_imu_node src/flat_world_imu_node_main.cc)
-target_link_libraries(flat_world_imu_node ${catkin_LIBRARIES})
-add_dependencies(flat_world_imu_node ${catkin_EXPORTED_TARGETS})
-
-install(TARGETS flat_world_imu_node
-  ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
-  LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
-  RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
-)
+add_subdirectory("cartographer_turtlebot")
 
 install(DIRECTORY launch configuration_files
   DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}

+ 11 - 0
cartographer_turtlebot/cartographer_turtlebot/CMakeLists.txt

@@ -0,0 +1,11 @@
+google_binary(cartographer_flat_world_imu_node
+  USES_ROS
+  SRCS
+    flat_world_imu_node_main.cc
+)
+
+install(TARGETS cartographer_flat_world_imu_node
+  ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
+  LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
+  RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
+)

+ 0 - 0
cartographer_turtlebot/src/flat_world_imu_node_main.cc → cartographer_turtlebot/cartographer_turtlebot/flat_world_imu_node_main.cc


+ 1 - 1
cartographer_turtlebot/launch/demo_depth_camera_2d.launch

@@ -25,7 +25,7 @@
       output="screen" />
 
   <node name="flat_world_imu_node" pkg="cartographer_turtlebot"
-      type="flat_world_imu_node" output="screen">
+      type="cartographer_flat_world_imu_node" output="screen">
     <remap from="imu_in" to="/mobile_base/sensors/imu_data_raw" />
     <remap from="imu_out" to="/imu" />
   </node>

+ 1 - 1
cartographer_turtlebot/launch/demo_depth_camera_3d.launch

@@ -25,7 +25,7 @@
       output="screen" />
 
   <node name="flat_world_imu_node" pkg="cartographer_turtlebot"
-      type="flat_world_imu_node" output="screen">
+      type="cartographer_flat_world_imu_node" output="screen">
     <remap from="imu_in" to="/mobile_base/sensors/imu_data_raw" />
     <remap from="imu_out" to="/imu" />
   </node>

+ 1 - 1
cartographer_turtlebot/launch/demo_lidar_2d.launch

@@ -27,7 +27,7 @@
   </node>
 
   <node name="flat_world_imu_node" pkg="cartographer_turtlebot"
-      type="flat_world_imu_node" output="screen">
+      type="cartographer_flat_world_imu_node" output="screen">
     <remap from="imu_in" to="/mobile_base/sensors/imu_data_raw" />
     <remap from="imu_out" to="/imu" />
   </node>

+ 1 - 1
cartographer_turtlebot/launch/turtlebot.launch

@@ -29,7 +29,7 @@
   </node>
 
   <node name="flat_world_imu_node" pkg="cartographer_turtlebot"
-      type="flat_world_imu_node" output="screen">
+      type="cartographer_flat_world_imu_node" output="screen">
     <remap from="imu_in" to="/mobile_base/sensors/imu_data_raw" />
     <remap from="imu_out" to="/imu" />
   </node>

+ 1 - 0
docs/source/index.rst

@@ -55,6 +55,7 @@ using `Ninja <https://ninja-build.org>`_.
     wstool update -t src
 
     # Install deb dependencies.
+    rosdep init
     rosdep update
     rosdep install --from-paths src --ignore-src --rosdistro=${ROS_DISTRO} -y