Add a launch file for 2d localization demo with gRPC. (#682)

master
Alexander Belyaev 2018-01-25 10:44:30 +01:00 committed by Wally B. Feed
parent d65f3c0f47
commit 7cf570d19e
2 changed files with 44 additions and 0 deletions

View File

@ -37,6 +37,7 @@ DEFINE_bool(
DEFINE_string( DEFINE_string(
save_map_filename, "", save_map_filename, "",
"If non-empty, serialize state and write it to disk before shutting down."); "If non-empty, serialize state and write it to disk before shutting down.");
DEFINE_string(map_filename, "", "If non-empty, filename of a map to load.");
namespace cartographer_ros { namespace cartographer_ros {
namespace cartographer_grpc { namespace cartographer_grpc {
@ -55,6 +56,10 @@ void Run() {
::cartographer_grpc::mapping::MapBuilderStub>(FLAGS_server_address); ::cartographer_grpc::mapping::MapBuilderStub>(FLAGS_server_address);
Node node(node_options, std::move(map_builder), &tf_buffer); Node node(node_options, std::move(map_builder), &tf_buffer);
if (!FLAGS_map_filename.empty()) {
node.LoadMap(FLAGS_map_filename);
}
if (FLAGS_start_trajectory_with_default_topics) { if (FLAGS_start_trajectory_with_default_topics) {
node.StartTrajectoryWithDefaultTopics(trajectory_options); node.StartTrajectoryWithDefaultTopics(trajectory_options);
} }

View File

@ -0,0 +1,39 @@
<!--
Copyright 2018 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.
-->
<launch>
<param name="/use_sim_time" value="true" />
<param name="robot_description"
textfile="$(find cartographer_ros)/urdf/backpack_2d.urdf" />
<node name="robot_state_publisher" pkg="robot_state_publisher"
type="robot_state_publisher" />
<node name="cartographer_grpc_node" pkg="cartographer_ros"
type="cartographer_grpc_node" args="
-configuration_directory $(find cartographer_ros)/configuration_files
-configuration_basename backpack_2d.lua
-map_filename $(arg map_filename)"
output="screen">
<remap from="echoes" to="horizontal_laser_2d" />
</node>
<node name="playbag" pkg="rosbag" type="play"
args="--clock $(arg bag_filename)" />
<node name="rviz" pkg="rviz" type="rviz" required="true"
args="-d $(find cartographer_ros)/configuration_files/demo_2d.rviz" />
</launch>