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

BlitherPants's profile - activity

2022-08-28 13:01:12 -0500 marked best answer Gmapping failure culprit -- parameters, odometry, sensors?

Hello,

I am running ROS Hydro on a Turtlebot 2 (Kobuki + Kinect)

I have been trying to use teleop + gmapping to get a decent map of my cubicled office building, but after slowly perimeter-driving and looping back through several hallways, inevitably, the map will eventually do something absurd like this: image description

I started with the first two hallways on the right, constantly weaving in and out of cubicles and repeating areas. The picture of those hallways really isn't bad, but when I started exploring the third vertical hallway after 30+ minutes, gmapping suddenly decided to create that horizonal hallway beginning to form on the bottom-left, which is extremely off. Anything after that point in time got progressively worse.

This happens fairly frequently when things seem to be going otherwise well.

The following are my gmapping parameters:

<launch>
  <arg name="scan_topic" default="scan" />

  <node pkg="gmapping" type="slam_gmapping" name="slam_gmapping" output="screen">
    <param name="base_frame" value="base_footprint"/>
    <param name="odom_frame" value="odom"/>
    <param name="map_update_interval" value="2.0"/>
    <param name="maxUrange" value="6.0"/>
    <param name="maxRange" value="8.0"/>
    <param name="sigma" value="0.05"/>
    <param name="kernelSize" value="1"/>
    <param name="lstep" value="0.05"/>
    <param name="astep" value="0.05"/>
    <param name="iterations" value="5"/>
    <param name="lsigma" value="0.075"/>
    <param name="ogain" value="3.0"/>
    <param name="lskip" value="0"/>
    <param name="srr" value="0.01"/>
    <param name="srt" value="0.02"/>
    <param name="str" value="0.01"/>
    <param name="stt" value="0.02"/>
    <param name="linearUpdate" value="0.2"/>
    <param name="angularUpdate" value="0.1"/>
    <param name="temporalUpdate" value="-1.0"/>
    <param name="resampleThreshold" value="0.5"/>
    <param name="particles" value="100"/>

    <param name="xmin" value="-30.0"/>
    <param name="ymin" value="-30.0"/>
    <param name="xmax" value="30.0"/>
    <param name="ymax" value="30.0"/>

<!--
    <param name="xmin" value="-1.0"/>
    <param name="ymin" value="-1.0"/>
    <param name="xmax" value="1.0"/>
    <param name="ymax" value="1.0"/>
  -->
    <param name="delta" value="0.05"/>
    <param name="llsamplerange" value="0.01"/>
    <param name="llsamplestep" value="0.01"/>
    <param name="lasamplerange" value="0.005"/>
    <param name="lasamplestep" value="0.005"/>
    <remap from="scan" to="$(arg scan_topic)"/>
  </node>
</launch>

I have changed very little from the default turtlebot configuration, besides lowering the linear/angular update, slightly increasing the number of particles, and decreasing the map update interval.

Since I know that a failure in scan matching causes gmapping to rely on odometry, I wonder if my odometry is decent enough. I ran the test suggested in the navigation tuning guide ( http://wiki.ros.org/navigation/Tutori... ):

  • I booted up minimal.launch, keyboard_teleop.launch , gmapping_demo.launch, and view_navigation_app.launch
  • In rviz, I set the global frame to odom, turned off all costmaps, and put the decay time on /scan to 600s.

I did all the following tests at the lowest teleop speed.

This is the result of performing three rotations in my standard-sized cubicle: image description

Entrance to cubicle, staring at wall ~5ft away: image description

Drove straight towards wall: image description

Circled ... (more)

2022-08-28 13:01:12 -0500 received badge  Nice Answer (source)
2022-05-22 17:22:36 -0500 received badge  Great Question (source)
2020-11-10 22:33:01 -0500 received badge  Great Answer (source)
2020-11-10 22:33:01 -0500 received badge  Guru (source)
2020-09-27 02:31:49 -0500 received badge  Nice Question (source)
2020-05-24 05:11:24 -0500 received badge  Great Question (source)
2019-08-20 05:32:31 -0500 received badge  Famous Question (source)
2018-10-18 07:34:06 -0500 marked best answer Getting accurate real-time x,y coordinates with gmapping?

Hello,

I have a Turtlebot 2 (Kobuki base) running in Ubuntu 12.04, ROS Groovy. I want to be able to print out a map of the robot's X,Y coordinates in real time.

Using information I've spliced together from various tutorials (still a newbie), I've come up with a node that uses a StampedTranform object to lookup the transform from "/map" to "base_link". It then takes the transform.getOrigin().x() and transform.getOrigin().y() and prints it to a text file.

My steps are this:

roslaunch turtlebot_bringup turtlebot.launch

roslaunch turtlebot_navigation gmapping_demo.launch

roslaunch turtlebot_teleop keyboard_teleop.launch

I then launch my application and manually drive the robot in a rectangular path around an office building (perhaps 50ft by 20ft). I load the resulting XY text file into MS Excel, and plot the points, but the path looks pretty awful.

I don't have enough karma to post pictures here, but suffice to say it looks like a squashed rhombus.

My question is, what am I doing wrong? Is there a different transform path I should be listening in on? Am I using the wrong function to extract X and Y? Or is it a bad idea in the first place to try and get the path coordinates in real time while the map is being built?

Thanks in advance! I've posted my code below, if anyone is interested.

#include "ros/ros.h"
#include "std_msgs/String.h"
#include <tf/transform_listener.h>
#include <iostream>
#include <fstream>


int main(int argc, char **argv)
{

  ros::init(argc, argv, "PoseUpdate");


  ros::NodeHandle n;


  ros::Publisher chatter_pub = n.advertise<std_msgs::String>("chatter", 1000);

  tf::TransformListener listener;

  ros::Rate rate(1.0);
  std::ofstream myfile;
  myfile.open("/tmp/OUTPUTXY.txt");

  while (n.ok())
  {
    tf::StampedTransform transform;
    try
    {
        //ROS_INFO("Attempting to read pose...");
        listener.lookupTransform("/map","/base_link",ros::Time(0), transform);

        ROS_INFO("Got a transform! x = %f, y = %f",transform.getOrigin().x(),transform.getOrigin().y());
        myfile << transform.getOrigin().x() << "," << transform.getOrigin().y() << "\n";
    }
    catch (tf::TransformException ex)
    {
        ROS_ERROR("Nope! %s", ex.what());
    } 


    rate.sleep();

  }
  myfile.close();
  ROS_ERROR("I DIED");
  return 0;
}
2018-10-18 07:33:56 -0500 received badge  Good Question (source)
2018-03-15 05:09:28 -0500 received badge  Enlightened (source)
2018-03-15 05:09:28 -0500 received badge  Good Answer (source)
2018-01-30 21:34:36 -0500 marked best answer Gmapping inconsistent between identical runs

Hello,

I've been trying to get a decent map of an office building using gmapping on my Turtlebot 2(Kinect), ROS Hydro, Ubuntu 12.04

After posting this a few weeks ago, I had come to the conclusion that my gmapping runs were failing because my i3 laptop CPU wasn't fast enough; while running gmapping with a bagfile, I would see one of the cores jump to 100% usage and sit there for a few seconds. While doing this, I would suppose gmapping was missing vital updates. I somewhat confirmed this by slowing down my bagfiles, and this produced overall better, but still not entirely consistent, maps.

I have now obtained an i7 laptop (Dell Latitude E6410 -- 2.67 GHz x 4) to test with, and I figured this should be fast enough, but I am still not getting consistent results between playing the same bagfile back with the same arguments to gmapping.

For instance, compare these two images: image description image description

When creating the bagfile, I used keyboard teleop at the default speed, which is very slow. These two images are generated from the same bagfile, using the same gmapping parameters, and played back ten times slower.

If driving the robot at a slow speed, playing the bagfile back at a tenth of that, and running gmapping on an i7 processor does not produce identical results between identical runs, what does?

What worries and confuses me is that modern computers don't get all that much faster than the one I have. Yet people on here seem to be getting reasonable and consistent results. Am I missing something basic that everyone else understands? Do I need to use a separate lightning-fast desktop computer to run solely gmapping and publish the map and transforms back to the laptop? Is there a bug in gmapping that makes it produce different output between identical runs if the map is big?

My gmapping parameters, by the way, are the turtlebot demo defaults, with slightly reduced particles and increased map update interval:

<launch>
  <arg name="scan_topic" default="scan" />

  <node pkg="gmapping" type="slam_gmapping" name="slam_gmapping" output="screen">
    <param name="base_frame" value="base_footprint"/>
    <param name="odom_frame" value="odom"/>
    <param name="map_update_interval" value="100"/>
    <param name="maxUrange" value="6.0"/>
    <param name="maxRange" value="8.0"/>
    <param name="sigma" value="0.05"/>
    <param name="kernelSize" value="1"/>
    <param name="lstep" value="0.05"/>
    <param name="astep" value="0.05"/>
    <param name="iterations" value="5"/>
    <param name="lsigma" value="0.075"/>
    <param name="ogain" value="3.0"/>
    <param name="lskip" value="0"/>
    <param name="srr" value="0.01"/>
    <param name="srt" value="0.02"/>
    <param name="str" value="0.01"/>
    <param name="stt" value="0.02"/>
    <param name="linearUpdate" value="0.5"/>
    <param name="angularUpdate" value="0.436"/>
    <param name="temporalUpdate" value="-1.0"/>
    <param name="resampleThreshold" value="0.5"/>
    <param name="particles" value="50"/>
  <!--
    <param name="xmin" value="-50.0"/>
    <param name="ymin" value="-50.0"/>
    <param name="xmax" value="50.0"/>
    <param name="ymax" value="50 ...
(more)
2018-01-30 21:11:57 -0500 marked best answer CostMap2D no longer showing unknown space

Hello,

I am running ROS Hydro on Ubuntu 12.04.

I have written an application that runs alongside gmapping_demo.launch but has its own Costmap2DROS object keeping track of the global costmap. While developing my app, I have been able to use the getCostmap() function to get a copy of the character map. Relevant code is shown:

costmap_2d::Costmap2D* mymap = globalmap_->getCostmap();
boost::unique_lock< boost::shared_mutex > lock(*(mymap->getLock()));
mymap->saveMap("/tmp/map");

I then go through the "mymap" pointer and copy its cost values to a character array.

This used to work perfectly, but today I noticed that the saved map no longer keeps track of unknown space (cost = 255), instead just saving it as zeros, as though all unknown space was freespace. To illustrate this, here is the map generated by saveMap():

image description

I have searched the file, and 255 does not appear anywhere.

I am quite stumped as to why this is happening. The only thing I can think of is that I allowed Ubuntu to install updates yesterday, and the navigation packages were included. Has something changed in the way they work? I am wondering if some bug was introduced.

Saving the map via rosrun map_server map_saver still runs the way I expect it to.

If there is any more information I can provide, please let me know. Thanks in advance.

2017-08-18 15:03:45 -0500 received badge  Nice Answer (source)
2017-02-12 03:12:44 -0500 received badge  Good Question (source)
2016-06-28 17:04:07 -0500 marked best answer Is AMCL necessary for exploration if gmapping is already running?

Hello,

I've got a Turtlebot 2 with a Kinect on ROS groovy, and I'm trying to understand the basics of navigation. I've been going over the navigation tutorials but one thing that consistently confuses me is the role of AMCL.

My issue is this: I plan to write a program similar to "Explore" (http://www.ros.org/wiki/explore, which seems unmaintained for current ROS distributions). I know in general that gmapping is used to build a map from driving around an unknown environment, and that AMCL is used for localization. The tutorials provided for Turtlebot only ever use gmapping when the driving is controlled by the user (teleop), and they only use AMCL to navigate a known map that has already been created by a previous teleop. But what if I wanted the robot to explore and map an unknown area autonomously? Would just running gmapping work?

The idea that gmapping is a SLAM algorithm, by name (Simultaneous Localization and Mapping), suggests to me that I only need gmapping to achieve this, but since the tutorials seem to insist on AMCL so much, I just want to be sure I have this right.

If anyone could clear this up for me, I'd appreciate it. Thanks in advance!

2016-06-28 16:35:57 -0500 received badge  Nice Question (source)
2016-03-23 10:37:26 -0500 marked best answer Sensor raytrace error when maps set to voxel

Hello,

I am trying to run navigation on a Turtlebot 2 with Kinect on ROS Groovy and Ubuntu 12.04 64 bit.

I have previously been able to run the gmapping demo to create maps just fine, and have been using it to experiment with the "explore" algorithm. My issue thus far as been that, while I have been able to get explore working with 2D costmaps, this is not enough because the Kinect cannot locate some obstacles on the ground and has been crashing into things. I would like to have gmapping also take the bump sensor on the Kobuki into account, and it seems the only reasonable way to do that is by using voxel maps instead of 2d costmaps, as per this question: http://answers.ros.org/question/58111/bumper-in-the-gmapping-costmap-turtlebot/

I have changed my gmapping parameter files to do this. I then run the following:

roslaunch turtlebot_bringup minimal.launch
roslaunch turtlebot_navigation gmapping_demo.launch

After gmapping launches, I immediately get this repeated error:

Registering First Scan
[ INFO] [1378838179.754750699]: Still waiting on map...

[ INFO] [1378838180.763781769]: Received a 320 X 512 map at 0.050000 m/pix

[ INFO] [1378838181.463125972]: MAP SIZE: 320, 512
[ INFO] [1378838181.477537345]: Subscribed to Topics: scan bump
[ INFO] [1378838182.150699492]: Sim period is set to 0.20
[ WARN] [1378838182.179434911]: Trajectory Rollout planner initialized with param meter_scoring not set. Set it to true to make your settins robust against changes of costmap resolution.
[ WARN] [1378838183.486340527]: The origin for the sensor at (-0.09, 0.01, 0.30) is out of map bounds. So, the costmap cannot raytrace for it.
[ WARN] [1378838184.684260669]: The origin for the sensor at (-0.09, 0.01, 0.30) is out of map bounds. So, the costmap cannot raytrace for it.
[ WARN] [1378838185.686235306]: The origin for the sensor at (-0.09, 0.01, 0.30) is out of map bounds. So, the costmap cannot raytrace for it.
[ WARN] [1378838186.686290364]: The origin for the sensor at (-0.09, 0.01, 0.30) is out of map bounds. So, the costmap cannot raytrace for it.

This did not happen before I made my changes, so I must not be setting the voxel maps properly. The following are my param files:

base_local_planner_params.yaml

controller_frequency: 5.0
TrajectoryPlannerROS:
  max_vel_x: 0.50
  min_vel_x: 0.10
  max_rotational_vel: 1.5
  min_in_place_rotational_vel: 1.0
  acc_lim_th: 0.75
  acc_lim_x: 0.50
  acc_lim_y: 0.50

  holonomic_robot: false
  yaw_goal_tolerance: 0.3
  xy_goal_tolerance: 0.15

  goal_distance_bias: 0.8
  path_distance_bias: 0.6
  sim_time: 1.5
  heading_lookahead: 0.325
  oscillation_reset_dist: 0.05

  vx_samples: 6
  vtheta_samples: 20
  dwa: true

costmap_common_params.yaml

origin_z: 0.0
z_resolution: .1
z_voxels: 2


max_obstacle_height: 0.60  # assume something like an arm is mounted on top of the robot
obstacle_range: 2.5
raytrace_range: 3.0
robot_radius: 0.18
inflation_radius: 0.50
observation_sources: scan bump

scan: {data_type: LaserScan, topic: /scan, marking: true, clearing: true, min_obstacle_height: 0.1, max_obstacle_height: 0.6}

# Current bump cloud configuration
bump: {data_type: PointCloud2, topic: mobile_base/sensors/bumper_pointcloud, marking: true, clearing: false, min_obstacle_height: 0 ...
(more)
2016-03-23 10:37:26 -0500 received badge  Self-Learner (source)
2016-02-04 18:31:57 -0500 received badge  Nice Question (source)
2015-09-29 10:20:23 -0500 received badge  Famous Question (source)
2015-08-06 22:41:58 -0500 received badge  Famous Question (source)
2015-07-27 18:25:23 -0500 received badge  Taxonomist
2015-07-17 08:14:31 -0500 received badge  Notable Question (source)
2015-07-16 12:58:04 -0500 commented answer Local costmap's OccupancyGrid doesn't update origin

(cont'd) When I press the button, it shifts the tf properly (which is why it visualizes correctly?), but the origin doesn't move at all. Driving after that does move the origin, but only as though it had started from [0,0]. Would you still like a bag or is that basically the solution?

2015-07-16 12:56:14 -0500 commented answer Local costmap's OccupancyGrid doesn't update origin

Testing, the origin seems to shift correctly only if I never use"2D Pose estimate" in RViz. The default initial position is [0,0] in the AMCL launch, but if I start anywhere else, I use the button.

2015-07-16 12:49:37 -0500 received badge  Popular Question (source)
2015-07-16 12:29:50 -0500 commented answer Local costmap's OccupancyGrid doesn't update origin

OK, this is very strange. Now when booting up AMCL and driving the robot around manually, I can echo /move_base/local_costmap/costmap and see that the origin is updating. But I echoed it before and it didn't! Maybe it has something to do with the second costmap my drive algorithm creates?

2015-07-16 12:13:11 -0500 commented answer Local costmap's OccupancyGrid doesn't update origin

Oh sorry, I'm more of a beginner and not familiar with wiki editing. I was more just curious if it was something that belonged there. Strange thing is that I couldn't find it listed when I ran rosparam list, so I don't know if it's more of a legacy parameter?

2015-07-16 11:00:46 -0500 commented answer Local costmap's OccupancyGrid doesn't update origin

I already tried that, and no, sadly it doesn't. I wonder if someone should update the wiki with that parameter BTW? I had to search the code to find it. Thanks though!

2015-07-15 10:37:48 -0500 asked a question Local costmap's OccupancyGrid doesn't update origin

Hi,

I'm using ROS Indigo on Ubuntu 14.04

I am in the process of writing an autonomous drive algorithm for my Turtlebot, and I've written a function that is meant to search the local costmap for a safe goal to send to the actionclient for move_base.

So, in my function, I call a function that picks up the most recent OccupancyGrid published to move_base/local_costmap/costmap. I then copy the callback to a global variable called "localgrid", which my function examines for obstacles.

void localmapcallback(const nav_msgs::OccupancyGrid::ConstPtr& msg)
{        
    localgrid.info = msg->info;     
    localgrid.header = msg->header;
    localgrid.data = msg->data;

    gotmap = true;
    ROS_INFO("Got a local map! Origin is %f,%f", msg->info.origin.position.x,msg->info.origin.position.y);
}

//  ^ localmapcallback

What I've noticed, however, is that, no matter where I am in the global map, the origin on the occupancy grid never changes!

Move_base is being launched from the default AMCL demo launch, so I can see that the local costmap is configured properly, i.e., rolling_window is set true. The local costmap also looks fine in RViz.

Also, in my program, I have my own self-updating global Costmap 2DROS named localmap_

localmap_ = new costmap_2d::Costmap2DROS(std::string("newlocal_costmap"), tf_);

So what I have done, is add a lot of debug statements in my "safe goal" function. I compare the difference between the origin of the OccupancyGrid ("localgrid") and the Costmap2DROS ("localmap_") after running the above callback:

ROS_INFO("Looking for a safe goal. The local OG origin is %f,%f",localgrid.info.origin.position.x,localgrid.info.origin.position.y);

costmap_2d::Costmap2D* mymap = localmap_->getCostmap();
boost::unique_lock< boost::recursive_mutex> lock(*(localmap_->getCostmap()->getMutex()));

ROS_INFO("Looking for a safe goal. The local costmap origin is %f,%f",mymap->getOriginX(),mymap->getOriginY());
boost::unique_lock< boost::recursive_mutex> unlock(*(mymap->getMutex()));

And this is what I get when I run the code while the robot is far from its starting point: image description

(Apologies for the photo instead of pasted text -- I can't figure out how to copy output from GDB. Also, apologies for my coding conventions. They're sloppy and I need to fix them eventually)

So, why doesn't the OccupancyGrid have a meaningful origin like the local Costmap2DROS does?

My code is quite long, so that is why I've refrained from posting everything here, but please do let me know if I need to put anything else here.

Thanks!

2015-06-30 13:38:51 -0500 marked best answer What coordinate frame does rviz set the 2D Nav Goal in?

Hello,

I've got a Turtlebot 2 in ROS Groovy, and I've been learning about navigation. One thing that confuses me is what happens internally in rviz when I press the "2D Nav Goal" button after running roslaunch turtlebot_rviz_launchers view_navigation.launch as done in the tutorial at: http://ros.org/wiki/turtlebot_navigation/Tutorials/Autonomously%20navigate%20in%20a%20known%20map

I know that it sends a goal to the navfn component in the move_base node (I think), but my question is, what reference is it using when I click the screen? IE, if I click on an X,Y point on the screen, what is it passing to move_base? Am I telling the robot to move some distance relative to its base_link? Or am I sending it to a fixed point on its local or global costmap?

Thanks in advance!

2015-05-29 08:23:13 -0500 received badge  Famous Question (source)