MCPcopy Create free account
hub / github.com/ANYbotics/grid_map / demoPolygonIterator

Method demoPolygonIterator

grid_map_demos/src/IteratorsDemo.cpp:175–214  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

173}
174
175void IteratorsDemo::demoPolygonIterator(const bool prepareForOtherDemos)
176{
177 ROS_INFO("Running polygon iterator demo.");
178 map_.clearAll();
179 if (prepareForOtherDemos) map_["type"].setZero();
180 publish();
181
182 grid_map::Polygon polygon;
183 polygon.setFrameId(map_.getFrameId());
184 polygon.addVertex(Position( 0.480, 0.000));
185 polygon.addVertex(Position( 0.164, 0.155));
186 polygon.addVertex(Position( 0.116, 0.500));
187 polygon.addVertex(Position(-0.133, 0.250));
188 polygon.addVertex(Position(-0.480, 0.399));
189 polygon.addVertex(Position(-0.316, 0.000));
190 polygon.addVertex(Position(-0.480, -0.399));
191 polygon.addVertex(Position(-0.133, -0.250));
192 polygon.addVertex(Position( 0.116, -0.500));
193 polygon.addVertex(Position( 0.164, -0.155));
194 polygon.addVertex(Position( 0.480, 0.000));
195
196 geometry_msgs::PolygonStamped message;
197 grid_map::PolygonRosConverter::toMessage(polygon, message);
198 polygonPublisher_.publish(message);
199
200 for (grid_map::PolygonIterator iterator(map_, polygon);
201 !iterator.isPastEnd(); ++iterator) {
202 map_.at("type", *iterator) = 1.0;
203 if (!prepareForOtherDemos) {
204 publish();
205 ros::Duration duration(0.02);
206 duration.sleep();
207 }
208 }
209
210 if (!prepareForOtherDemos) {
211 ros::Duration duration(1.0);
212 duration.sleep();
213 }
214}
215
216void IteratorsDemo::demoSlidingWindowIterator()
217{

Callers

nothing calls this directly

Calls 6

clearAllMethod · 0.80
addVertexMethod · 0.80
atMethod · 0.80
setFrameIdMethod · 0.45
publishMethod · 0.45
isPastEndMethod · 0.45

Tested by

no test coverage detected