0
$\begingroup$

Rosanswers logo

Hi There,

I receive following error message when starting my costmap, which is instantiated:

The /scan observation buffer has not been updated for 140.78 seconds, and it should be updated every 5.00 seconds.

So how do I update the LaserScan in my code? In addition, I recognized that I need to instantiate the global and local costmap, otherwise the LaserScannerCallback is never entered. If I instantiate both, LaserScannerCallback is entered right at the beginning and not updated later on.

How I instantiate:

tf::TransformListener tf(ros::Duration(10));
costmap2d = new costmap_2d::Costmap2DROS("local_costmap", tf);
costmap2d_global = new costmap_2d::Costmap2DROS("global_costmap", tf);
//start updating the costmap
costmap2d->start();
costmap2d_global->start();

while (true) 
{
    costmap2d->updateMap();
    costmap2d_global->updateMap();
    ROS_ERROR("SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!");
}

This are the debugging messages in the costmap_2d_ros.cpp file (line 240):

  //create a callback for the topic
  if(data_type == "LaserScan"){
    boost::shared_ptr<message_filters::Subscriber<sensor_msgs::LaserScan> > sub(
          new message_filters::Subscriber<sensor_msgs::LaserScan>(g_nh, topic, 50));

    boost::shared_ptr<tf::MessageFilter<sensor_msgs::LaserScan> > filter(
        new tf::MessageFilter<sensor_msgs::LaserScan>(*sub, tf_, global_frame_, 50));
    filter->registerCallback(boost::bind(&Costmap2DROS::laserScanCallback, this, _1, observation_buffers_.back()));

    observation_subscribers_.push_back(sub);
    observation_notifiers_.push_back(filter);

    observation_notifiers_.back()->setTolerance(ros::Duration(0.05));
    ROS_WARN("LaserScan Callback created."); // <<-- I SHOULD GET THIS MESSAGE IF THE CALLBACK IS CREATED
  }

There is the callback in costmap_2d_ros.cpp (line 998):

void Costmap2DROS::laserScanCallback(const sensor_msgs::LaserScanConstPtr& message, const boost::shared_ptr<ObservationBuffer>& buffer){
    //project the laser into a point cloud
    sensor_msgs::PointCloud2 cloud;
    cloud.header = message->header;

    ROS_WARN("CALLBACK !!!!"); // <<-- THIS SHOULD BE CALLED WHENEVER THE CALLBACK IS ENTERED
    //project the scan into a point cloud
    try
    {
      projector_.transformLaserScanToPointCloud(message->header.frame_id, *message, cloud, tf_);
    }
    catch (tf::TransformException &ex)
    {
      ROS_WARN ("High fidelity enabled, but TF returned a transform exception to frame %s: %s", global_frame_.c_str (), ex.what ());
      projector_.projectLaser(*message, cloud);
    }

    //buffer the point cloud
    buffer->lock();
    buffer->bufferCloud(cloud);
    buffer->unlock();
  }

This is the output when I start my node:

[ INFO] [1390551857.199559862]: Subscribed to Topics: scan
[ WARN] [1390551858.117169643]: Created an observation buffer for data type: LaserScan source: scan, topic: /scan, global frame: /odom, expected update rate: 5.00, observation persistence: 0.00
[ WARN] [1390551858.120995261]: LaserScan Callback created.
[ INFO] [1390551858.413191936]: Subscribed to Topics: 
[ INFO] [1390551858.455085838]: Requesting the map...

[ WARN] [1390551858.459802919]: CALLBACK !!!!
[ INFO] [1390551858.461015799]: Still waiting on map...

[ WARN] [1390551859.459632166]: CALLBACK !!!!
[ WARN] [1390551859.460424412]: CALLBACK !!!!
[ WARN] [1390551859.461023054]: CALLBACK !!!!
[ WARN] [1390551859.461938169]: CALLBACK !!!!
[ WARN] [1390551859.462500109]: CALLBACK !!!!
[ WARN] [1390551859.463153905]: CALLBACK !!!!
[ WARN] [1390551859.464408500]: CALLBACK !!!!
[ WARN] [1390551859.474896956]: CALLBACK !!!!
[ WARN] [1390551859.475409172]: CALLBACK !!!!
[ WARN] [1390551859.475852453]: CALLBACK !!!!
[ WARN] [1390551859.476327935]: CALLBACK !!!!
[ WARN] [1390551859.476803132]: CALLBACK !!!!
[ WARN] [1390551859.477267024]: CALLBACK !!!!
[ WARN] [1390551859.477728195]: CALLBACK !!!!
[ WARN] [1390551859.478331598]: CALLBACK !!!!
[ WARN] [1390551859.478928722]: CALLBACK !!!!
[ WARN] [1390551859.479506096]: CALLBACK !!!!
[ WARN] [1390551859.480412325]: CALLBACK !!!!
[ WARN] [1390551859.481133095]: CALLBACK !!!!
[ WARN] [1390551859.481902018]: CALLBACK !!!!
[ WARN] [1390551859.482498100]: CALLBACK !!!!
[ WARN] [1390551859.482904982]: CALLBACK !!!!
[ WARN] [1390551859.483329213]: CALLBACK !!!!
[ WARN] [1390551859.483728536]: CALLBACK !!!!
[ WARN] [1390551859.484164747]: CALLBACK !!!!
[ WARN] [1390551859.484736968]: CALLBACK !!!!
[ WARN] [1390551859.485151610]: CALLBACK !!!!
[ WARN] [1390551859.485624194]: CALLBACK !!!!
[ WARN] [1390551859.486024053]: CALLBACK !!!!
[ WARN] [1390551859.486758580]: CALLBACK !!!!
[ WARN] [1390551859.487176375]: CALLBACK !!!!
[ WARN] [1390551859.487598087]: CALLBACK !!!!
[ WARN] [1390551859.488217605]: CALLBACK !!!!
[ INFO] [1390551859.488647106]: Still waiting on map...

[ WARN] [1390551860.470007964]: You have set map parameters, but also requested to use the static map. Your parameters will be overwritten by those of the map server
[ INFO] [1390551860.470453220]: Received a 800 X 800 map at 0.010000 m/pix

[ERROR] [1390551860.852783590]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!
[ERROR] [1390551860.932992655]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!
[ERROR] [1390551861.013353698]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!
[ERROR] [1390551861.092613647]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!
[ERROR] [1390551861.172171341]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!
[ERROR] [1390551861.265645795]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!
[ERROR] [1390551861.344098548]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!
[ERROR] [1390551861.444890504]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!
[ERROR] [1390551861.563250378]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!
[ERROR] [1390551861.759625451]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!
[ERROR] [1390551861.839900151]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!
[ERROR] [1390551861.918588397]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!
[ERROR] [1390551861.996885997]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!
[ERROR] [1390551862.076387145]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!
[ERROR] [1390551862.154786022]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!
[ERROR] [1390551862.244727698]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!
[ERROR] [1390551862.324159266]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!
[ERROR] [1390551862.407031019]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!
[ERROR] [1390551862.486244886]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!
[ERROR] [1390551863.467708836]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!
[ERROR] [1390551863.557531665]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!
[ERROR] [1390551863.727346287]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!
[ERROR] [1390551863.808174815]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!
[ERROR] [1390551863.896049261]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!
[ERROR] [1390551863.989772975]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!
[ERROR] [1390551864.075443061]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!
[ERROR] [1390551864.153290010]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!
[ERROR] [1390551864.238701008]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!
[ERROR] [1390551864.319080165]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!
[ERROR] [1390551864.405990749]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!
[ERROR] [1390551864.487675764]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!
[ERROR] [1390551864.577738340]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!
[ERROR] [1390551865.513357442]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!
[ERROR] [1390551865.609056396]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!
[ERROR] [1390551865.776650880]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!
[ WARN] [1390551865.776827630]: The /scan observation buffer has not been updated for 5.03 seconds, and it should be updated every 5.00 seconds.
[ERROR] [1390551865.856221137]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!
[ WARN] [1390551865.856363460]: The /scan observation buffer has not been updated for 5.11 seconds, and it should be updated every 5.00 seconds.
[ERROR] [1390551865.937278526]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!
[ WARN] [1390551865.937817439]: The /scan observation buffer has not been updated for 5.19 seconds, and it should be updated every 5.00 seconds.
[ERROR] [1390551866.019037569]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!
[ WARN] [1390551866.019541493]: The /scan observation buffer has not been updated for 5.27 seconds, and it should be updated every 5.00 seconds.
[ERROR] [1390551866.098517770]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!
[ WARN] [1390551866.099021746]: The /scan observation buffer has not been updated for 5.35 seconds, and it should be updated every 5.00 seconds.
[ WARN] [1390551866.178367975]: The /scan observation buffer has not been updated for 5.43 seconds, and it should be updated every 5.00 seconds.
[ERROR] [1390551866.185031563]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!
[ WARN] [1390551866.185527269]: The /scan observation buffer has not been updated for 5.44 seconds, and it should be updated every 5.00 seconds.
[ERROR] [1390551866.303455188]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!
[ WARN] [1390551866.304250416]: The /scan observation buffer has not been updated for 5.56 seconds, and it should be updated every 5.00 seconds.
...

Since I set the maximum time of non-updating the costmap to 5 sec I get warnings after that time. The buffer is then anymore updated and also the CALLBACK is not entered. This means I get /scan data at the beginning and then the update routine is not executed.

This is the local_costmap.yaml file:

local_costmap:
   global_frame: /odom
   robot_base_frame: /base_link #/base_footprint
   height: 4
   width: 4
   max_obstacle_height: 0.6
   max_obstacle_range: 2.5
   obstacle_range: 4.0
   publish_frequency: 2.0
   update_frequency: 2.0
   publish_voxel_map: false
   raytrace_range: 4.0
   resolution: 0.01
   static_map: false
   rolling_window: true
   track_unknown_space: true
   unknown_cost_value: 255
   transform_tolerance: 2.5
   robot_radius: 0.18
   inflation_radius: 0.50
   observation_sources: scan

   scan: {data_type: LaserScan, topic: /scan, marking: true, clearing: true, expected_update_rate: 5.0}


global_costmap:
   global_frame: /map
   robot_base_frame: /base_link #/base_footprint
   map_topic: /map
   map_type: costmap
   max_obstacle_height: 0.6
   max_obstacle_range: 2.5
   obstacle_range: 4.0
   publish_frequency: 1.0
   update_frequency: 1.0
   publish_voxel_map: false
   raytrace_range: 4.0
   resolution: 0.01
   static_map: true
   rolling_window: false
   track_unknown_space: true
   unknown_cost_value: 255
   transform_tolerance: 2.5
   robot_radius: 0.18
   inflation_radius: 0.50

Here is the Output of the tf_monitor:

*Frames (I just picked odom): 
Frame: /odom published by /slam_gmapping Average Delay: 4.54992 Max Delay: 4.55078

*All Broadcasters:
Node: /robot_pose_ekf 10.0166 Hz, Average Delay: 4.58184 Max Delay: 4.60978
Node: /robot_state_publisher 9.60911 Hz, Average Delay: 4.28917 Max Delay: 4.55138
Node: /slam_gmapping 20.0195 Hz, Average Delay: 4.54992 Max Delay: 4.55078

*Average rate for 
/tf: average rate: 40.404 min: 0.000s max: 0.050s std dev: 0.01835s window: 38
/scan: average rate: 29.969 min: 0.028s max: 0.037s std dev: 0.00189s window: 118

Any hint is appreciated.

BR Daniel


Originally posted by dneuhold on ROS Answers with karma: 205 on 2014-01-22

Post score: 0


Original comments

Comment by David Lu on 2014-01-23:
How often is the /scan topic being published?

Comment by dneuhold on 2014-01-23:
Thanks for your answer David. The /scan topic is updated with an average frequency of 30Hz. I just wonder why the LaserScanCallback (in costmap_2d_ros.cpp) is called at the beginning and then anymore!? It seems like the message from /scan is not received anymore and hence the LaserScanCallback never called again to update the costmap! Thanks for every hint, I am really struggling with that.

Comment by David Lu on 2014-01-23:
How do you know it is called only once?

Comment by dneuhold on 2014-01-23:
I was editing your code to debug( using ROS_ERROR messages). The callback for the laserscan is created and called multiple times at the beginning! Would a screenshot help?

Comment by David Lu on 2014-01-23:
Is your TF tree up to date? That could slow down the message filter.

Comment by dneuhold on 2014-01-23:
How do I verify if the TF tree is up to date? If I use the tf_monitor tool I get the output as above ... I updated my question to make it more traceable for you. Just tell me if you need additional informations! Thank you for your help!!

Comment by dneuhold on 2014-01-27:
ohh I just realized that my robot_base_frame and my global_frame are connected and up to date in the tf_tree but there is no sensor_frame connected in the tf tree!? Could that be a possible mistake? How do I add this tf?

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Problem found!!! I was using the callback in the costmap_2d_ros.cpp but this callback was never called! The reason was that my code prevented to reach the ros::spin() command which is obviously responsible to receive all inputs from existing callbacks! Now that I removed this bottleneck, the callback returns LaserScans continuously and everything works fine ...

Hope this helps to solve your problems.

BR Daniel


Originally posted by dneuhold with karma: 205 on 2014-02-04

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by itaouil on 2020-04-14:
Thanks for your reply, it indeed helped :).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.