diff --git a/cartographer_ros/CMakeLists.txt b/cartographer_ros/CMakeLists.txt
index 6e9e1ce..f9875ff 100644
--- a/cartographer_ros/CMakeLists.txt
+++ b/cartographer_ros/CMakeLists.txt
@@ -21,11 +21,11 @@ set(PACKAGE_DEPENDENCIES
geometry_msgs
cartographer_ros_msgs
roscpp
- rviz
sensor_msgs
nav_msgs
tf2
tf2_eigen
+ tf2_ros
)
set(CMAKE_CXX_FLAGS "-pthread -std=c++11 -Wreorder")
@@ -70,18 +70,6 @@ link_directories(${CARTOGRAPHER_LIBRARY_DIRS})
find_package(ZLIB REQUIRED)
include_directories(${ZLIB_INCLUDE_DIRS})
-set(CMAKE_AUTOMOC ON)
-if(rviz_QT_VERSION VERSION_LESS "5")
- message(STATUS "Using Qt4 based on the rviz_QT_VERSION: ${rviz_QT_VERSION}")
- find_package(Qt4 ${rviz_QT_VERSION} EXACT REQUIRED QtCore QtGui)
- include(${QT_USE_FILE})
-else()
- message(STATUS "Using Qt5 based on the rviz_QT_VERSION: ${rviz_QT_VERSION}")
- find_package(Qt5 ${rviz_QT_VERSION} EXACT REQUIRED Core Widgets)
- set(QT_LIBRARIES Qt5::Widgets)
-endif()
-add_definitions(-DQT_NO_KEYWORDS)
-
find_package(Boost REQUIRED
COMPONENTS
system
@@ -95,7 +83,6 @@ add_executable(cartographer_node
src/cartographer_node_main.cc
src/msg_conversion.cc
src/msg_conversion.h
- src/node_constants.h
src/sensor_data.cc
src/sensor_data.h
src/sensor_data_producer.cc
@@ -105,45 +92,24 @@ add_executable(cartographer_node
)
target_link_libraries(cartographer_node
${CARTOGRAPHER_LIBRARIES}
- ${catkin_LIBRARIES}
${PCL_LIBRARIES}
- gflags # TODO(whess): Use or remove gflags_catkin.
+ ${catkin_LIBRARIES}
+ gflags # TODO(whess): CMake-ify?
)
add_dependencies(cartographer_node
${catkin_EXPORTED_TARGETS}
)
-add_library(cartographer_rviz_submaps_visualization
- src/drawable_submap.cc
- src/drawable_submap.h
- src/node_constants.h
- src/submaps_display.cc
- src/submaps_display.h
-)
-target_link_libraries(cartographer_rviz_submaps_visualization
- ${Boost_LIBRARIES}
- ${CARTOGRAPHER_LIBRARIES}
- ${catkin_LIBRARIES}
- ${QT_LIBRARIES}
- ${ZLIB_LIBRARIES}
-)
-
-add_dependencies(cartographer_rviz_submaps_visualization
- ${catkin_EXPORTED_TARGETS}
-)
-
catkin_add_gtest(time_conversion_test
src/time_conversion_test.cc
src/time_conversion.h
src/time_conversion.cc
)
-
target_link_libraries(time_conversion_test
- ${GTEST_BOTH_LIBRARIES}
${CARTOGRAPHER_LIBRARIES}
+ ${GTEST_BOTH_LIBRARIES}
${catkin_LIBRARIES}
)
-
add_dependencies(time_conversion_test
${catkin_EXPORTED_TARGETS}
)
@@ -160,18 +126,8 @@ install(DIRECTORY configuration_files/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/configuration_files/
)
-install(TARGETS
- cartographer_rviz_submaps_visualization cartographer_node
+install(TARGETS cartographer_node
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
-
-install(FILES
- rviz_plugin_description.xml
- DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
-)
-
-install(DIRECTORY ogre_media/
- DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/ogre_media
-)
diff --git a/cartographer_ros/package.xml b/cartographer_ros/package.xml
index ba8bfb7..059ae4b 100644
--- a/cartographer_ros/package.xml
+++ b/cartographer_ros/package.xml
@@ -45,22 +45,17 @@
rosbag
roscpp
roslib
- rviz
sensor_msgs
std_msgs
tf2
tf2_eigen
- visualization_msgs
+ tf2_ros
geometry_msgs
nav_msgs
libpcl-all-dev
pcl_conversions
eigen_conversions
message_runtime
- qtbase5-dev
- libqt5-core
- libqt5-gui
- libqt5-widgets
rosunit
diff --git a/cartographer_ros/src/cartographer_node_main.cc b/cartographer_ros/src/cartographer_node_main.cc
index b932572..a596b87 100644
--- a/cartographer_ros/src/cartographer_node_main.cc
+++ b/cartographer_ros/src/cartographer_node_main.cc
@@ -64,7 +64,6 @@
#include "tf2_ros/transform_listener.h"
#include "msg_conversion.h"
-#include "node_constants.h"
#include "sensor_data.h"
#include "sensor_data_producer.h"
#include "time_conversion.h"
@@ -99,6 +98,8 @@ constexpr char kImuTopic[] = "imu";
constexpr char kOdometryTopic[] = "odom";
constexpr char kOccupancyGridTopic[] = "map";
constexpr char kScanMatchedPointCloudTopic[] = "scan_matched_points2";
+constexpr char kSubmapListTopic[] = "submap_list";
+constexpr char kSubmapQueryServiceName[] = "submap_query";
struct NodeOptions {
carto::mapping::proto::MapBuilderOptions map_builder_options;
diff --git a/cartographer_ros/src/node_constants.h b/cartographer_ros/src/node_constants.h
deleted file mode 100644
index 1a77eba..0000000
--- a/cartographer_ros/src/node_constants.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2016 The Cartographer Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef CARTOGRAPHER_ROS_GOOGLE_CARTOGRAPHER_SRC_NODE_CONSTANTS_H_
-#define CARTOGRAPHER_ROS_GOOGLE_CARTOGRAPHER_SRC_NODE_CONSTANTS_H_
-
-namespace cartographer_ros {
-
-// The topic that the node will subscribe to.
-constexpr char kSubmapListTopic[] = "submap_list";
-
-// The service we serve in the Node and query in the RViz plugin for submap
-// which are used for visualization.
-constexpr char kSubmapQueryServiceName[] = "submap_query";
-
-} // namespace cartographer_ros
-
-#endif // CARTOGRAPHER_ROS_GOOGLE_CARTOGRAPHER_SRC_NODE_CONSTANTS_H_
diff --git a/cartographer_rviz/CMakeLists.txt b/cartographer_rviz/CMakeLists.txt
new file mode 100644
index 0000000..ba53817
--- /dev/null
+++ b/cartographer_rviz/CMakeLists.txt
@@ -0,0 +1,110 @@
+# Copyright 2016 The Cartographer Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+cmake_minimum_required(VERSION 2.8)
+
+project(cartographer_rviz)
+
+set(PACKAGE_DEPENDENCIES
+ cartographer_ros_msgs
+ eigen_conversions
+ roscpp
+ rviz
+)
+
+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(catkin REQUIRED COMPONENTS ${PACKAGE_DEPENDENCIES})
+include_directories(${catkin_INCLUDE_DIRS})
+
+catkin_package(
+ CATKIN_DEPENDS
+ message_runtime
+ ${PACKAGE_DEPENDENCIES}
+)
+
+find_package(cartographer REQUIRED)
+include_directories(${CARTOGRAPHER_INCLUDE_DIRS})
+link_directories(${CARTOGRAPHER_LIBRARY_DIRS})
+
+find_package(ZLIB REQUIRED)
+include_directories(${ZLIB_INCLUDE_DIRS})
+
+set(CMAKE_AUTOMOC ON)
+if(rviz_QT_VERSION VERSION_LESS "5")
+ message(STATUS "Using Qt4 based on the rviz_QT_VERSION: ${rviz_QT_VERSION}")
+ find_package(Qt4 ${rviz_QT_VERSION} EXACT REQUIRED QtCore QtGui)
+ include(${QT_USE_FILE})
+else()
+ message(STATUS "Using Qt5 based on the rviz_QT_VERSION: ${rviz_QT_VERSION}")
+ find_package(Qt5 ${rviz_QT_VERSION} EXACT REQUIRED Core Widgets)
+ set(QT_LIBRARIES Qt5::Widgets)
+endif()
+add_definitions(-DQT_NO_KEYWORDS)
+
+find_package(Boost REQUIRED
+ COMPONENTS
+ system
+ iostreams
+)
+add_definitions(${BOOST_DEFINITIONS})
+include_directories(${Boost_INCLUDE_DIRS})
+link_directories(${Boost_LIBRARY_DIRS})
+
+add_library(cartographer_rviz_submaps_visualization
+ src/drawable_submap.cc
+ src/drawable_submap.h
+ src/submaps_display.cc
+ src/submaps_display.h
+)
+target_link_libraries(cartographer_rviz_submaps_visualization
+ ${Boost_LIBRARIES}
+ ${CARTOGRAPHER_LIBRARIES}
+ ${QT_LIBRARIES}
+ ${ZLIB_LIBRARIES}
+ ${catkin_LIBRARIES}
+)
+add_dependencies(cartographer_rviz_submaps_visualization
+ ${catkin_EXPORTED_TARGETS}
+)
+
+install(TARGETS cartographer_rviz_submaps_visualization
+ ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
+ LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
+ RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
+)
+
+install(FILES rviz_plugin_description.xml
+ DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
+)
+
+install(DIRECTORY ogre_media/
+ DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/ogre_media
+)
diff --git a/cartographer_ros/ogre_media/materials/glsl120/glsl120.program b/cartographer_rviz/ogre_media/materials/glsl120/glsl120.program
similarity index 100%
rename from cartographer_ros/ogre_media/materials/glsl120/glsl120.program
rename to cartographer_rviz/ogre_media/materials/glsl120/glsl120.program
diff --git a/cartographer_ros/ogre_media/materials/glsl120/submap.frag b/cartographer_rviz/ogre_media/materials/glsl120/submap.frag
similarity index 100%
rename from cartographer_ros/ogre_media/materials/glsl120/submap.frag
rename to cartographer_rviz/ogre_media/materials/glsl120/submap.frag
diff --git a/cartographer_ros/ogre_media/materials/glsl120/submap.vert b/cartographer_rviz/ogre_media/materials/glsl120/submap.vert
similarity index 100%
rename from cartographer_ros/ogre_media/materials/glsl120/submap.vert
rename to cartographer_rviz/ogre_media/materials/glsl120/submap.vert
diff --git a/cartographer_ros/ogre_media/materials/scripts/submap.material b/cartographer_rviz/ogre_media/materials/scripts/submap.material
similarity index 100%
rename from cartographer_ros/ogre_media/materials/scripts/submap.material
rename to cartographer_rviz/ogre_media/materials/scripts/submap.material
diff --git a/cartographer_rviz/package.xml b/cartographer_rviz/package.xml
new file mode 100644
index 0000000..ffb2351
--- /dev/null
+++ b/cartographer_rviz/package.xml
@@ -0,0 +1,53 @@
+
+
+
+
+ cartographer_rviz
+ 1.0.0
+
+ Cartographer is a system that provides real-time simultaneous localization
+ and mapping SLAM across multiple platforms and sensor configurations. This
+ package provides Cartographer's RViz integration.
+
+
+ The Cartographer Authors
+
+ Apache 2.0
+
+ https://github.com/googlecartographer/cartographer_ros
+
+ catkin
+
+ g++-static
+
+ cartographer
+ cartographer_ros_msgs
+
+ eigen_conversions
+ libqt5-core
+ libqt5-gui
+ libqt5-widgets
+ message_runtime
+ qtbase5-dev
+ roscpp
+ roslib
+ rviz
+
+
+
+
+
diff --git a/cartographer_ros/rviz_plugin_description.xml b/cartographer_rviz/rviz_plugin_description.xml
similarity index 94%
rename from cartographer_ros/rviz_plugin_description.xml
rename to cartographer_rviz/rviz_plugin_description.xml
index f5c177c..6ad7179 100644
--- a/cartographer_ros/rviz_plugin_description.xml
+++ b/cartographer_rviz/rviz_plugin_description.xml
@@ -16,7 +16,7 @@
Displays submaps as a unified map in RViz.
diff --git a/cartographer_ros/src/drawable_submap.cc b/cartographer_rviz/src/drawable_submap.cc
similarity index 98%
rename from cartographer_ros/src/drawable_submap.cc
rename to cartographer_rviz/src/drawable_submap.cc
index 2a1618d..a840764 100644
--- a/cartographer_ros/src/drawable_submap.cc
+++ b/cartographer_rviz/src/drawable_submap.cc
@@ -30,8 +30,7 @@
#include
#include
-namespace cartographer_ros {
-namespace rviz {
+namespace cartographer_rviz {
namespace {
@@ -237,5 +236,4 @@ float DrawableSubmap::UpdateAlpha(const float target_alpha) {
return current_alpha_;
}
-} // namespace rviz
-} // namespace cartographer_ros
+} // namespace cartographer_rviz
diff --git a/cartographer_ros/src/drawable_submap.h b/cartographer_rviz/src/drawable_submap.h
similarity index 91%
rename from cartographer_ros/src/drawable_submap.h
rename to cartographer_rviz/src/drawable_submap.h
index 5fb3be0..0d26504 100644
--- a/cartographer_ros/src/drawable_submap.h
+++ b/cartographer_rviz/src/drawable_submap.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef CARTOGRAPHER_ROS_GOOGLE_CARTOGRAPHER_SRC_DRAWABLE_SUBMAP_H_
-#define CARTOGRAPHER_ROS_GOOGLE_CARTOGRAPHER_SRC_DRAWABLE_SUBMAP_H_
+#ifndef CARTOGRAPHER_RVIZ_SRC_DRAWABLE_SUBMAP_H_
+#define CARTOGRAPHER_RVIZ_SRC_DRAWABLE_SUBMAP_H_
#include
#include
@@ -35,8 +35,7 @@
#include
-namespace cartographer_ros {
-namespace rviz {
+namespace cartographer_rviz {
// Contains all the information needed to render a submap onto the final
// texture representing the whole map.
@@ -103,7 +102,6 @@ class DrawableSubmap : public QObject {
float current_alpha_ = 0.f;
};
-} // namespace rviz
-} // namespace cartographer_ros
+} // namespace cartographer_rviz
-#endif // CARTOGRAPHER_ROS_GOOGLE_CARTOGRAPHER_SRC_DRAWABLE_SUBMAP_H_
+#endif // CARTOGRAPHER_RVIZ_SRC_DRAWABLE_SUBMAP_H_
diff --git a/cartographer_ros/src/submaps_display.cc b/cartographer_rviz/src/submaps_display.cc
similarity index 95%
rename from cartographer_ros/src/submaps_display.cc
rename to cartographer_rviz/src/submaps_display.cc
index c1bd825..a35eb7b 100644
--- a/cartographer_ros/src/submaps_display.cc
+++ b/cartographer_rviz/src/submaps_display.cc
@@ -29,10 +29,7 @@
#include
#include
-#include "node_constants.h"
-
-namespace cartographer_ros {
-namespace rviz {
+namespace cartographer_rviz {
namespace {
@@ -42,12 +39,13 @@ constexpr char kGlsl120Directory[] = "/glsl120";
constexpr char kScriptsDirectory[] = "/scripts";
constexpr char kDefaultMapFrame[] = "map";
constexpr char kDefaultTrackingFrame[] = "base_link";
+constexpr char kDefaultSubmapQueryServiceName[] = "/submap_query";
} // namespace
SubmapsDisplay::SubmapsDisplay() : tf_listener_(tf_buffer_) {
submap_query_service_property_ = new ::rviz::StringProperty(
- "Submap query service", QString("/") + kSubmapQueryServiceName,
+ "Submap query service", kDefaultSubmapQueryServiceName,
"Submap query service to connect to.", this, SLOT(Reset()));
map_frame_property_ = new ::rviz::StringProperty(
"Map frame", kDefaultMapFrame, "Map frame, used for fading out submaps.",
@@ -149,7 +147,6 @@ void SubmapsDisplay::update(const float wall_dt, const float ros_dt) {
}
}
-} // namespace rviz
-} // namespace cartographer_ros
+} // namespace cartographer_rviz
-PLUGINLIB_EXPORT_CLASS(cartographer_ros::rviz::SubmapsDisplay, ::rviz::Display)
+PLUGINLIB_EXPORT_CLASS(cartographer_rviz::SubmapsDisplay, ::rviz::Display)
diff --git a/cartographer_ros/src/submaps_display.h b/cartographer_rviz/src/submaps_display.h
similarity index 87%
rename from cartographer_ros/src/submaps_display.h
rename to cartographer_rviz/src/submaps_display.h
index 8a8ad97..e25bd98 100644
--- a/cartographer_ros/src/submaps_display.h
+++ b/cartographer_rviz/src/submaps_display.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef CARTOGRAPHER_ROS_GOOGLE_CARTOGRAPHER_SRC_SUBMAPS_DISPLAY_H_
-#define CARTOGRAPHER_ROS_GOOGLE_CARTOGRAPHER_SRC_SUBMAPS_DISPLAY_H_
+#ifndef CARTOGRAPHER_RVIZ_SRC_SUBMAPS_DISPLAY_H_
+#define CARTOGRAPHER_RVIZ_SRC_SUBMAPS_DISPLAY_H_
#include
#include
@@ -29,8 +29,7 @@
#include "drawable_submap.h"
-namespace cartographer_ros {
-namespace rviz {
+namespace cartographer_rviz {
// RViz plugin used for displaying maps which are represented by a collection of
// submaps.
@@ -72,7 +71,6 @@ class SubmapsDisplay
::cartographer::common::Mutex mutex_;
};
-} // namespace rviz
-} // namespace cartographer_ros
+} // namespace cartographer_rviz
-#endif // CARTOGRAPHER_ROS_GOOGLE_CARTOGRAPHER_SRC_SUBMAPS_DISPLAY_H_
+#endif // CARTOGRAPHER_RVIZ_SRC_SUBMAPS_DISPLAY_H_