SteveMacenski / spatio_temporal_voxel_layer

A new voxel layer leveraging modern 3D graphics tools to modernize navigation environmental representations
http://wiki.ros.org/spatio_temporal_voxel_layer
GNU Lesser General Public License v2.1
644 stars 189 forks source link

The problem of the order of marking and clearing #284

Closed tanghaijian1992 closed 7 months ago

tanghaijian1992 commented 7 months ago

// navigation mode: clear observations, mapping mode: save maps and publish if (!_mapping_mode) { _voxel_grid->updateRobotPosition(robot_x, robot_y); _voxel_grid->ClearFrustums(clearing_observations, cleared_cells); } else if (ros::Time::now() - _last_map_save_time > _map_save_duration) { _last_map_save_time = ros::Time::now(); time_t rawtime; struct tm* timeinfo; char time_buffer[100]; time (&rawtime); timeinfo = localtime (&rawtime); strftime(time_buffer, 100, "%F-%r", timeinfo);

costmap_2d::SaveGrid srv;
srv.request.file_name.data = time_buffer;
SaveGridCallback(srv.request, srv.response);

} double t2 = ros::Time::now().toSec(); ROS_INFO_THROTTLE(costmap_2d::loginterval,"occlusion dectect time elapsed %f", t2-t1);

// mark observations _voxel_grid->Mark(marking_observations);

// update the ROS Layered Costmap UpdateROSCostmap(min_x, min_y, max_x, max_y, cleared_cells);


As the code show,when running "voxel_grid->Mark(marking_observations);" ,we do not mark at costmap,we should wait for next round to do it . I think it will have some delay ,why not mark at costmap just after running "voxel_grid->Mark(marking_observations);" ?

SteveMacenski commented 7 months ago

Its an efficiency thing, iterating through the voxel grid isn't "free" so by queuing it up for the next iteration we can substantially save computation. For running this at 10-20-etc hz, 1 timestep isn't a big deal for slow moving robots

tanghaijian1992 commented 7 months ago

OK, I see that.Thanks!