ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
3

Using cartographer for creating map, how??

asked 2017-01-16 08:42:56 -0500

SCrusher gravatar image

Hello, I just installed cartographer package and I am trying to use it in order to create a map and visualise it in rviz. I am using vrep, where I have a robot with laser scan publishing data to laser scan topic and odometry data to odom topic. I am trying to make the cartographer_node to subscribe to these topics and produce the map, just like I did with gmapping before.

However I am lost in the launch files and in how I pass these parameters to cartographer. I am in beginner level. I have read the ros tutorials but still it doesn't make sense. Could anyone provide me with an example of how to do this?

Thanks in advance.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2017-01-31 16:37:57 -0500

farhatm gravatar image

Hey, you need a IMU topic that publich /imu msg. I d'ont know, if you can use it only with /scan and /odom topic you have to change the configuration in your backpack_2d.lua.

use_laser_scan = true, use_multi_echo_laser_scan = false,

read this: https://google-cartographer-ros.readt...

edit flag offensive delete link more
0

answered 2017-02-01 21:20:15 -0500

tb12 gravatar image

I also use a laser scanner but I don't have any odometry data (I assume you mean from your wheels?) and it works fine. Here is my configuration file, which is almost identical to the given backpack_2d.lua file from the demo:

include "map_builder.lua"

options = {
  map_builder = MAP_BUILDER,
  map_frame = "map",
  tracking_frame = "base_link",
  published_frame = "base_link",
  odom_frame = "base_link",
  provide_odom_frame = false,
  use_odometry = false,
  use_laser_scan = true,
  use_multi_echo_laser_scan = false,
  num_point_clouds = 0,
  lookup_transform_timeout_sec = 0.2,
  submap_publish_period_sec = 0.3,
  pose_publish_period_sec = 5e-3,
}

MAP_BUILDER.use_trajectory_builder_2d = true
TRAJECTORY_BUILDER_2D.use_imu_data = false

return options

The configuration file can be called from a launch file as so:

<launch>
  <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_node" pkg="cartographer_ros"
      type="cartographer_node" args="
          -configuration_directory $(find cartographer_ros)/configuration_files
          -configuration_basename backpack_2d.lua"
      output="screen">
     <!--<remap from="echoes" to="scan" />-->
  </node>

  <node pkg="tf" type="static_transform_publisher" name="world_to_map_broadcaster" args="0 0 0 0 0 0 world map 50" />
  <node pkg="tf" type="static_transform_publisher" name="base_to_laser_broadcaster" args="0 0 0 0 0 0 base_link laser 50" />

</launch>

Be sure to configure the simtime somewhere too

edit flag offensive delete link more

Comments

did you get any errors when you launch it? can you run: rosrun rqt_graph rqt_graph and rosrun rqt_tf_tree rqt_tf_tree after you launch the cartographer node, and post the result.

farhatm gravatar image farhatm  ( 2017-02-03 14:59:30 -0500 )edit

i cant post any pictures yet, but the tf tree is:

world -> map -> base_link -> laser, and base_link also points to other links which are being ignored based on my configurations.

tb12 gravatar image tb12  ( 2017-02-06 10:54:46 -0500 )edit

in the rqt graph you have cartographer_node subscribed to tf, tf_static, and scan, and publishing the scan matcher, submap list, and tf.

tf gets your robot state publisher as well as the static transforms. and the robot state publisher is also publishing to tf_static.

tb12 gravatar image tb12  ( 2017-02-06 10:59:07 -0500 )edit

and of course your urg_node publishes to scan

tb12 gravatar image tb12  ( 2017-02-06 10:59:20 -0500 )edit

what errors are you getting when you launch cartographer mapping?

tb12 gravatar image tb12  ( 2017-02-06 11:00:27 -0500 )edit

Hi, where does this come from? "TRAJECTORY_BUILDER_2D.use_imu_data = false"

Bill5785 gravatar image Bill5785  ( 2017-02-25 16:43:24 -0500 )edit

Did you check the source code? I couldn't find where it is referred.

Bill5785 gravatar image Bill5785  ( 2017-02-25 16:47:10 -0500 )edit

trajectory_builder_2d is a configuration file that is referenced by default from the tutorial launch file

tb12 gravatar image tb12  ( 2017-02-25 18:13:03 -0500 )edit

Question Tools

5 followers

Stats

Asked: 2017-01-16 08:42:56 -0500

Seen: 9,147 times

Last updated: Feb 01 '17