cartographer-project / cartographer_ros

Provides ROS integration for Cartographer.
Apache License 2.0
1.67k stars 1.21k forks source link

I want to change the default topic #1796

Open kooofresemi opened 1 year ago

kooofresemi commented 1 year ago

I want to change the topic of /scan. This is what the current trajectory_builder_2d.lua looks like with the changes.

submaps = {
    num_range_data = 90,
    grid_options_2d = {
      grid_type = "PROBABILITY_GRID",
      resolution = 0.05,
    },
    range_data_inserter = {
      range_data_inserter_type = "PROBABILITY_GRID_INSERTER_2D",
      probability_grid_range_data_inserter = {
        insert_free_space = true,
        hit_probability = 0.55,
        miss_probability = 0.49,
        topic = "/scan",
      },      
    },
  },

However, I got this error.

[cartographer_node-1] F0928 16:47:29.577988 22229 lua_parameter_dictionary.cc:410] Check failed: 1 == reference_counts_.count(key) (1 vs. 0) Key 'topic' was used the wrong number of times.
[cartographer_node-1] [FATAL] [1695887249.578198312] [cartographer_ros]: F0928 16:47:29.000000 22229 lua_parameter_dictionary.cc:410] Check failed: 1 == reference_counts_.count(key) (1 vs. 0) Key 'topic' was used the wrong number of times.

I think it would solve the problem if the default topic could be changed from /scan. Please let me know the candidate location to change the subscribed topic.

lucamozza commented 1 year ago

Hello, here you can find an example on how to change the topic names cartographer expects.