Add BUILD_GRPC CMake flag and ROS-gRPC binary. (#631)
parent
0eab6a150e
commit
abe4d10de3
|
@ -38,6 +38,7 @@ set(PACKAGE_DEPENDENCIES
|
||||||
find_package(cartographer REQUIRED)
|
find_package(cartographer REQUIRED)
|
||||||
include("${CARTOGRAPHER_CMAKE_DIR}/functions.cmake")
|
include("${CARTOGRAPHER_CMAKE_DIR}/functions.cmake")
|
||||||
set(BUILD_SHARED_LIBS OFF)
|
set(BUILD_SHARED_LIBS OFF)
|
||||||
|
option(BUILD_GRPC "build features that require Cartographer gRPC support" false)
|
||||||
google_initialize_cartographer_project()
|
google_initialize_cartographer_project()
|
||||||
google_enable_testing()
|
google_enable_testing()
|
||||||
|
|
||||||
|
@ -84,8 +85,14 @@ catkin_package(
|
||||||
file(GLOB_RECURSE ALL_SRCS "*.cc" "*.h")
|
file(GLOB_RECURSE ALL_SRCS "*.cc" "*.h")
|
||||||
file(GLOB_RECURSE ALL_TESTS "*_test.cc")
|
file(GLOB_RECURSE ALL_TESTS "*_test.cc")
|
||||||
file(GLOB_RECURSE ALL_EXECUTABLES "*_main.cc")
|
file(GLOB_RECURSE ALL_EXECUTABLES "*_main.cc")
|
||||||
|
file(GLOB_RECURSE ALL_GRPC_FILES "cartographer_ros/cartographer_grpc/*")
|
||||||
list(REMOVE_ITEM ALL_SRCS ${ALL_TESTS})
|
list(REMOVE_ITEM ALL_SRCS ${ALL_TESTS})
|
||||||
list(REMOVE_ITEM ALL_SRCS ${ALL_EXECUTABLES})
|
list(REMOVE_ITEM ALL_SRCS ${ALL_EXECUTABLES})
|
||||||
|
if (NOT ${BUILD_GRPC})
|
||||||
|
list(REMOVE_ITEM ALL_SRCS ${ALL_GRPC_FILES})
|
||||||
|
list(REMOVE_ITEM ALL_TESTS ${ALL_GRPC_FILES})
|
||||||
|
list(REMOVE_ITEM ALL_EXECUTABLES ${ALL_GRPC_FILES})
|
||||||
|
endif()
|
||||||
add_library(${PROJECT_NAME} ${ALL_SRCS})
|
add_library(${PROJECT_NAME} ${ALL_SRCS})
|
||||||
add_subdirectory("cartographer_ros")
|
add_subdirectory("cartographer_ros")
|
||||||
|
|
||||||
|
|
|
@ -91,3 +91,16 @@ install(TARGETS cartographer_pbstream_to_ros_map
|
||||||
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
|
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# TODO: Add support for shared libary case.
|
||||||
|
if (${BUILD_GRPC})
|
||||||
|
google_binary(cartographer_grpc_node
|
||||||
|
SRCS
|
||||||
|
cartographer_grpc/node_grpc_main.cc
|
||||||
|
)
|
||||||
|
|
||||||
|
install(TARGETS cartographer_grpc_node
|
||||||
|
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
|
||||||
|
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
|
||||||
|
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2017 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "cartographer_ros/node.h"
|
||||||
|
#include "cartographer_ros/node_options.h"
|
||||||
|
#include "cartographer_ros/ros_log_sink.h"
|
||||||
|
#include "gflags/gflags.h"
|
||||||
|
|
||||||
|
DEFINE_string(configuration_directory, "",
|
||||||
|
"First directory in which configuration files are searched, "
|
||||||
|
"second is always the Cartographer installation to allow "
|
||||||
|
"including files from there.");
|
||||||
|
DEFINE_string(configuration_basename, "",
|
||||||
|
"Basename, i.e. not containing any directory prefix, of the "
|
||||||
|
"configuration file.");
|
||||||
|
DEFINE_string(map_filename, "", "If non-empty, filename of a map to load.");
|
||||||
|
DEFINE_bool(
|
||||||
|
start_trajectory_with_default_topics, true,
|
||||||
|
"Enable to immediately start the first trajectory with default topics.");
|
||||||
|
DEFINE_string(
|
||||||
|
save_map_filename, "",
|
||||||
|
"If non-empty, serialize state and write it to disk before shutting down.");
|
||||||
|
|
||||||
|
namespace cartographer_ros {
|
||||||
|
namespace cartographer_grpc {
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
void Run() {
|
||||||
|
// TODO(cschuet): Implement this.
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
} // namespace cartographer_grpc
|
||||||
|
} // namespace cartographer_ros
|
||||||
|
|
||||||
|
int main(int argc, char** argv) {
|
||||||
|
google::InitGoogleLogging(argv[0]);
|
||||||
|
google::ParseCommandLineFlags(&argc, &argv, true);
|
||||||
|
|
||||||
|
CHECK(!FLAGS_configuration_directory.empty())
|
||||||
|
<< "-configuration_directory is missing.";
|
||||||
|
CHECK(!FLAGS_configuration_basename.empty())
|
||||||
|
<< "-configuration_basename is missing.";
|
||||||
|
|
||||||
|
::ros::init(argc, argv, "cartographer_grpc_node");
|
||||||
|
::ros::start();
|
||||||
|
|
||||||
|
cartographer_ros::ScopedRosLogSink ros_log_sink;
|
||||||
|
cartographer_ros::cartographer_grpc::Run();
|
||||||
|
::ros::shutdown();
|
||||||
|
}
|
Loading…
Reference in New Issue