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

Gmapping problem

asked 2014-08-13 03:28:32 -0600

sumanth gravatar image

updated 2014-08-14 02:01:24 -0600

Hello I am trying to get a map of the area with a differential drive mobile robot, for which the following are the steps followed.

  1. Open the kinect with openini using "roslaunch openni_launch openni.launch".
  2. Change the pointcloud to the laser scan using "rosrun depthimage_to_laserscan depthimage_to_laserscan image:=/camera/depth/image_raw", after step-2 I am able to see the "laser scan" in the RVIz properly.

  3. Running the gmapping with "rosrun gmapping slam_gmapping scan:=/scan tf:=/odom" , I am running the node which publishes the odom (the odometry data from the real robot).

  4. Then open rviz with "rosrun rviz rviz".

But in RVIZ I am unable to see any mapping.

Questions:

  1. The procedure which I follwed is correct or Is there something I am missing..?

  2. For publishing the odo data I am using the example from the following link: http://wiki.ros.org/navigation/Tutori... with the following changes:

    • Added a callback, so as to subscribe to the incoming data from the robot.
    • Changed the velocities to suit for differential drive robot.
    • Small change in calculation of the robot position based on odo.

But the odom published from this has many fields:

    nav_msgs::Odometry odom;
    odom.header.stamp = current_time;
    odom.header.frame_id = "odom";

    //set the position
    odom.pose.pose.position.x = x;
    odom.pose.pose.position.y = y;
    odom.pose.pose.position.z = 0.0;
    odom.pose.pose.orientation = odom_quat;

    //set the velocity
    odom.child_frame_id = "base_link";
    odom.twist.twist.linear.x = vx;
    odom.twist.twist.linear.y = vy;
    odom.twist.twist.angular.z = vth;

which one I should give to the gmapping...?

Please find the rqt_graph here image description

Please find the frames.pdf here image description

Many thanks in advance

edit retag flag offensive close merge delete

Comments

share your rqt_graph here in question

bvbdort gravatar image bvbdort  ( 2014-08-13 04:36:59 -0600 )edit

I am unable to attach the rqt_graph here because of lack of points!!

sumanth gravatar image sumanth  ( 2014-08-13 04:51:50 -0600 )edit

i did upvote, try now if its possible. or use http://imgur.com/

bvbdort gravatar image bvbdort  ( 2014-08-13 04:58:35 -0600 )edit

I have modified the question

sumanth gravatar image sumanth  ( 2014-08-13 05:01:51 -0600 )edit
1

you can see from image that odom is not published . publish Odom and start gmapping like "rosrun gmapping slam_gmapping scan:=scan _odom_frame:=/odom"

bvbdort gravatar image bvbdort  ( 2014-08-13 06:06:05 -0600 )edit

Its getting published, I have reuploaded the rqt_graph. but how to link the odom to the gmapping...?

sumanth gravatar image sumanth  ( 2014-08-13 06:15:56 -0600 )edit

rosrun gmapping slam_gmapping scan:=scan odom_frame:=/odom

bvbdort gravatar image bvbdort  ( 2014-08-13 06:16:49 -0600 )edit

No its not geeting linked, you can check the rqt_graph

sumanth gravatar image sumanth  ( 2014-08-13 06:18:29 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2014-08-14 02:13:47 -0600

ahendrix gravatar image

As per the gmapping wiki page, gmapping only subscribes to tf, not to /odom.

You should make sure that your odometry node is publishing tf correctly (from your tf tree, it looks like it is), and that the frame parameters to gmapping are correct (from the wiki page, it looks like the defaults are correct for your system).

I suspect the problem here is that your laser scans aren't published in the correct frame; you can confirm by looking at the frame_id in the header of your published laser scans.

Notice how there are two disconnected trees in your TF view - one for most of your frames (map, odom, base_link, etc), and a separate tree with camera_link and the other Kinect frames. I suspect you just need to rename the scanner frame to camera_link in your URDF to connect the two trees.

edit flag offensive delete link more

Comments

Oh super, Now its working, I can see the mapping in rviz, but some times I get

terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
Aborted (core dumped)

Why this happens..?

how to give map created here to navigation stack..? or how to store map?

sumanth gravatar image sumanth  ( 2014-08-14 02:52:24 -0600 )edit
1

I'm not sure what's crashing or why; that's probably a separate question. You should be able to save your map with:

rosrun map_server map_saver
ahendrix gravatar image ahendrix  ( 2014-08-14 03:12:17 -0600 )edit

Many Thanks.

sumanth gravatar image sumanth  ( 2014-08-14 03:13:48 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2014-08-13 03:28:32 -0600

Seen: 2,518 times

Last updated: Aug 14 '14