| 46 | IteratorsDemo::~IteratorsDemo() {} |
| 47 | |
| 48 | void IteratorsDemo::demoGridMapIterator() |
| 49 | { |
| 50 | ROS_INFO("Running grid map iterator demo."); |
| 51 | map_.clearAll(); |
| 52 | publish(); |
| 53 | |
| 54 | // Note: In this example we locally store a reference to the map data |
| 55 | // for improved performance. See `iterator_benchmark.cpp` and the |
| 56 | // README.md for a comparison and more information. |
| 57 | grid_map::Matrix& data = map_["type"]; |
| 58 | for (grid_map::GridMapIterator iterator(map_); !iterator.isPastEnd(); ++iterator) { |
| 59 | const int i = iterator.getLinearIndex(); |
| 60 | data(i) = 1.0; |
| 61 | publish(); |
| 62 | ros::Duration duration(0.01); |
| 63 | duration.sleep(); |
| 64 | } |
| 65 | |
| 66 | ros::Duration duration(1.0); |
| 67 | duration.sleep(); |
| 68 | } |
| 69 | |
| 70 | void IteratorsDemo::demoSubmapIterator() |
| 71 | { |