inflation_layer.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2020, Sebastian Pütz
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * 2. Redistributions in binary form must reproduce the above
12  * copyright notice, this list of conditions and the following
13  * disclaimer in the documentation and/or other materials provided
14  * with the distribution.
15  *
16  * 3. Neither the name of the copyright holder nor the names of its
17  * contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  *
33  * authors:
34  * Sebastian Pütz <spuetz@uni-osnabrueck.de>
35  *
36  */
37 
39 
40 #include <queue>
41 #include <lvr2/util/Meap.hpp>
43 #include <mesh_map/util.h>
44 
46 
47 namespace mesh_layers
48 {
50 {
51  // riskiness
52  ROS_INFO_STREAM("Try to read riskiness from map file...");
53  auto riskiness_opt = mesh_io_ptr->getDenseAttributeMap<lvr2::DenseVertexMap<float>>("riskiness");
54 
55  if (riskiness_opt)
56  {
57  ROS_INFO_STREAM("Riskiness has been read successfully.");
58  riskiness = riskiness_opt.get();
59  return true;
60  }
61  else
62  {
63  return false;
64  }
65 }
66 
68 {
69  ROS_INFO_STREAM("Saving " << riskiness.numValues() << " riskiness values to map file...");
70 
71  if (mesh_io_ptr->addDenseAttributeMap(riskiness, "riskiness"))
72  {
73  ROS_INFO_STREAM("Saved riskiness to map file.");
74  return true;
75  }
76  else
77  {
78  ROS_ERROR_STREAM("Could not save riskiness to map file!");
79  return false;
80  }
81 }
82 
84 {
85  return std::numeric_limits<float>::quiet_NaN();
86 }
87 
88 void InflationLayer::updateLethal(std::set<lvr2::VertexHandle>& added_lethal,
89  std::set<lvr2::VertexHandle>& removed_lethal)
90 {
91  lethal_vertices = added_lethal;
92 
93  ROS_INFO_STREAM("Update lethal for inflation layer.");
94  waveCostInflation(lethal_vertices, config.inflation_radius, config.inscribed_radius, config.inscribed_value,
95  std::numeric_limits<float>::infinity());
96 
97  /*lethalCostInflation(lethal_vertices, config.inflation_radius,
98  config.inscribed_radius, config.inscribed_value,
99  config.lethal_value == -1
100  ? std::numeric_limits<float>::infinity()
101  : config.lethal_value);
102 */
103 }
104 
105 inline float InflationLayer::computeUpdateSethianMethod(const float& d1, const float& d2, const float& a,
106  const float& b, const float& dot, const float& F)
107 {
108  float t = std::numeric_limits<float>::infinity();
109  float r_cos_angle = dot;
110  float r_sin_angle = sqrt(1 - dot * dot);
111 
112  float u = d2 - d1; // T(B) - T(A)
113 
114  float f2 = a * a + b * b - 2 * a * b * r_cos_angle;
115  float f1 = b * u * (a * r_cos_angle - b);
116  float f0 = b * b * (u * u - F * F * a * a * r_sin_angle);
117 
118  float delta = f1 * f1 - f0 * f2;
119 
120  if (delta >= 0)
121  {
122  if (std::fabs(f2) > mesh_layers::EPSILON)
123  {
124  t = (-f1 - sqrt(delta)) / f2;
125  if (t < u || b * (t - u) / t < a * r_cos_angle || a / r_cos_angle < b * (t - u) / 2)
126  {
127  t = (-f1 + sqrt(delta)) / f2;
128  }
129  else
130  {
131  if (f1 != 0)
132  {
133  t = -f0 / f1;
134  }
135  else
136  {
137  t = -std::numeric_limits<float>::infinity();
138  }
139  }
140  }
141  }
142  else
143  {
144  t = -std::numeric_limits<float>::infinity();
145  }
146 
147  if (u < t && a * r_cos_angle < b * (t - u) / t && b * (t - u) / t < a / r_cos_angle)
148  {
149  return t + d1;
150  }
151  else
152  {
153  return std::min(b * F + d1, a * F + d2);
154  }
155 }
156 
159  const float& max_distance, const lvr2::DenseEdgeMap<float>& edge_weights,
160  const lvr2::FaceHandle& fh, const lvr2::BaseVector<float>& normal,
161  const lvr2::VertexHandle& v1h, const lvr2::VertexHandle& v2h,
162  const lvr2::VertexHandle& v3h)
163 {
164  const auto& mesh = map_ptr->mesh();
165 
166  const double u1 = distances[v1h];
167  const double u2 = distances[v2h];
168  const double u3 = distances[v3h];
169 
170  if (u3 == 0)
171  return false;
172 
173  const lvr2::OptionalEdgeHandle e12h = mesh.getEdgeBetween(v1h, v2h);
174  const float c = edge_weights[e12h.unwrap()];
175  const float c_sq = c * c;
176 
177  const lvr2::OptionalEdgeHandle e13h = mesh.getEdgeBetween(v1h, v3h);
178  const float b = edge_weights[e13h.unwrap()];
179  const float b_sq = b * b;
180 
181  const lvr2::OptionalEdgeHandle e23h = mesh.getEdgeBetween(v2h, v3h);
182  const float a = edge_weights[e23h.unwrap()];
183  const float a_sq = a * a;
184 
185  float dot = (a_sq + b_sq - c_sq) / (2 * a * b);
186  float u3tmp = computeUpdateSethianMethod(u1, u2, a, b, dot, 1.0);
187 
188  if (!std::isfinite(u3tmp))
189  return false;
190 
191  const float d31 = u3tmp - u1;
192  const float d32 = u3tmp - u2;
193 
194  if (u1 == 0 && u2 == 0)
195  {
196  const auto& v1 = mesh_ptr->getVertexPosition(v1h);
197  const auto& v2 = mesh_ptr->getVertexPosition(v2h);
198  const auto& v3 = mesh_ptr->getVertexPosition(v3h);
199  const auto& dir = ((v3 - v2) + (v3 - v1)).normalized();
200  const auto& face_normals = map_ptr->faceNormals();
201  cutting_faces.insert(v1h, fh);
202  cutting_faces.insert(v2h, fh);
203  cutting_faces.insert(v3h, fh);
204  vector_map[v1h] = (vector_map[v1h] + dir).normalized();
205  vector_map[v2h] = (vector_map[v2h] + dir).normalized();
206  //vector_map[v3h] = (vector_map[v1h] * d31 + vector_map[v2h] * d32).normalized();
207  vector_map[v3h] = (vector_map[v3h] + dir).normalized();
208  }
209 
210  if (u3tmp < u3)
211  {
212  distances[v3h] = static_cast<float>(u3tmp);
213 
214  if (u1 != 0 || u2 != 0)
215  {
216  cutting_faces.insert(v3h, fh);
217  vector_map[v3h] = (vector_map[v1h] * d31 + vector_map[v2h] * d32).normalized();
218  }
219 
220  if (d31 < d32)
221  {
222  predecessors.insert(v3h, v1h);
223  }
224  else // right face check
225  {
226  predecessors.insert(v3h, v2h);
227  }
228 
229  // backToSource(v3h, predecessors, vector_map);
230  return u1 <= max_distance && u2 <= max_distance;
231  }
232  return false;
233 }
234 
235 float InflationLayer::fading(const float val)
236 {
237  if (val > config.inflation_radius)
238  return 0;
239 
240  // Inflation radius
241  if (val > config.inscribed_radius)
242  {
243  float alpha = (sqrt(val) - config.inscribed_radius) / (config.inflation_radius - config.inscribed_radius) * M_PI;
244  return config.inscribed_value * (cos(alpha) + 1) / 2.0;
245  }
246 
247  // Inscribed radius
248  if (val > 0)
249  return config.inscribed_value;
250 
251  // Lethality
252  return config.lethal_value;
253 }
254 
255 void InflationLayer::waveCostInflation(const std::set<lvr2::VertexHandle>& lethals, const float inflation_radius,
256  const float inscribed_radius, const float inscribed_value,
257  const float lethal_value)
258 {
259  if (mesh_ptr)
260  {
261  auto const& mesh = *mesh_ptr;
262 
263  ROS_INFO_STREAM("inflation radius:" << inflation_radius);
264  ROS_INFO_STREAM("Init wave inflation.");
265 
266  lvr2::DenseVertexMap<bool> seen(mesh_ptr->nextVertexIndex(), false);
267  distances = lvr2::DenseVertexMap<float>(mesh_ptr->nextVertexIndex(), std::numeric_limits<float>::infinity());
269  predecessors.reserve(mesh_ptr->nextVertexIndex());
270 
272 
274 
275  const auto& edge_distances = map_ptr->edgeDistances();
276  const auto& face_normals = map_ptr->faceNormals();
277 
278  lvr2::DenseVertexMap<bool> fixed(mesh.nextVertexIndex(), false);
279 
280  // initialize distances with infinity
281  // initialize predecessor of each vertex with itself
282  for (auto const& vH : mesh.vertices())
283  {
284  predecessors.insert(vH, vH);
285  }
286 
288  // Set start distance to zero
289  // add start vertex to priority queue
290  for (auto vH : lethals)
291  {
292  distances[vH] = 0;
293  fixed[vH] = true;
294  pq.insert(vH, 0);
295  }
296 
297  ROS_INFO_STREAM("Start inflation wave front propagation");
298 
299  while (!pq.isEmpty())
300  {
301  lvr2::VertexHandle current_vh = pq.popMin().key();
302 
303  if (current_vh.idx() >= mesh.nextVertexIndex())
304  {
305  continue;
306  }
307 
308  if (map_ptr->invalid[current_vh])
309  continue;
310 
311  // check if already fixed
312  // if(fixed[current_vh]) continue;
313  fixed[current_vh] = true;
314 
315  std::vector<lvr2::VertexHandle> neighbours;
316  try
317  {
318  mesh.getNeighboursOfVertex(current_vh, neighbours);
319  }
320  catch (lvr2::PanicException exception)
321  {
322  map_ptr->invalid.insert(current_vh, true);
323  continue;
324  }
325  catch (lvr2::VertexLoopException exception)
326  {
327  map_ptr->invalid.insert(current_vh, true);
328  continue;
329  }
330 
331  for (auto nh : neighbours)
332  {
333  std::vector<lvr2::FaceHandle> faces;
334  try
335  {
336  mesh.getFacesOfVertex(nh, faces);
337  }
338  catch (lvr2::PanicException exception)
339  {
340  map_ptr->invalid.insert(nh, true);
341  continue;
342  }
343 
344  for (auto fh : faces)
345  {
346  const auto vertices = mesh.getVerticesOfFace(fh);
347  const lvr2::VertexHandle& a = vertices[0];
348  const lvr2::VertexHandle& b = vertices[1];
349  const lvr2::VertexHandle& c = vertices[2];
350 
351  try
352  {
353  if (fixed[a] && fixed[b] && fixed[c])
354  {
355  // ROS_INFO_STREAM("All fixed!");
356  continue;
357  }
358  else if (fixed[a] && fixed[b] && !fixed[c])
359  {
360  // c is free
361  if (waveFrontUpdate(distances, predecessors, inflation_radius, edge_distances, fh, face_normals[fh], a, b,
362  c))
363  {
364  pq.insert(c, distances[c]);
365  }
366  // if(pq.containsKey(c)) pq.updateValue(c, distances[c]);
367  }
368  else if (fixed[a] && !fixed[b] && fixed[c])
369  {
370  // b is free
371  if (waveFrontUpdate(distances, predecessors, inflation_radius, edge_distances, fh, face_normals[fh], c, a,
372  b))
373  {
374  pq.insert(b, distances[b]);
375  }
376  // if(pq.containsKey(b)) pq.updateValue(b, distances[b]);
377  }
378  else if (!fixed[a] && fixed[b] && fixed[c])
379  {
380  // a if free
381  if (waveFrontUpdate(distances, predecessors, inflation_radius, edge_distances, fh, face_normals[fh], b, c,
382  a))
383  {
384  pq.insert(a, distances[a]);
385  }
386  // if(pq.containsKey(a)) pq.updateValue(a, distances[a]);
387  }
388  else
389  {
390  // two free vertices -> skip that face
391  // ROS_INFO_STREAM("two vertices are free.");
392  continue;
393  }
394  }
395  catch (lvr2::PanicException exception)
396  {
397  map_ptr->invalid.insert(nh, true);
398  }
399  catch (lvr2::VertexLoopException exception)
400  {
401  map_ptr->invalid.insert(nh, true);
402  }
403  }
404  }
405  }
406 
407  ROS_INFO_STREAM("Finished inflation wave front propagation.");
408 
409  for (auto vH : mesh_ptr->vertices())
410  {
411  riskiness.insert(vH, fading(distances[vH]));
412  }
413 
414  map_ptr->publishVectorField("inflation", vector_map, distances,
415  std::bind(&InflationLayer::fading, this, std::placeholders::_1));
416  }
417  else
418  {
419  ROS_ERROR_STREAM("Cannot init wave inflation: mesh_ptr points to null");
420  }
421 }
422 
423 lvr2::BaseVector<float> InflationLayer::vectorAt(const std::array<lvr2::VertexHandle, 3>& vertices,
424  const std::array<float, 3>& barycentric_coords)
425 {
426  if (!config.repulsive_field)
427  return lvr2::BaseVector<float>();
428 
429  const float distance = mesh_map::linearCombineBarycentricCoords(vertices, distances, barycentric_coords);
430 
431  if (distance > config.inflation_radius)
432  return lvr2::BaseVector<float>();
433 
434  // Inflation radius
435  if (distance > config.inscribed_radius)
436  {
437  float alpha =
438  (sqrt(distance) - config.inscribed_radius) / (config.inflation_radius - config.inscribed_radius) * M_PI;
439  return mesh_map::linearCombineBarycentricCoords(vertices, vector_map, barycentric_coords) * config.inscribed_value *
440  (cos(alpha) + 1) / 2.0;
441  }
442 
443  // Inscribed radius
444  if (distance > 0)
445  {
446  return mesh_map::linearCombineBarycentricCoords(vertices, vector_map, barycentric_coords) * config.inscribed_value;
447  }
448 
449  // Lethality
450  return mesh_map::linearCombineBarycentricCoords(vertices, vector_map, barycentric_coords) * config.lethal_value;
451 }
452 
454 {
455  if (!config.repulsive_field)
456  return lvr2::BaseVector<float>();
457 
458  float distance = 0;
460 
461  auto dist_opt = distances.get(vH);
462  auto vector_opt = vector_map.get(vH);
463  if (dist_opt && vector_opt)
464  {
465  distance = dist_opt.get();
466  vec = vector_opt.get();
467  }
468  else
469  {
470  return vec;
471  }
472 
473  if (distance > config.inflation_radius)
474 
475  // Inflation radius
476  if (distance > config.inscribed_radius)
477  {
478  float alpha =
479  (sqrt(distance) - config.inscribed_radius) / (config.inflation_radius - config.inscribed_radius) * M_PI;
480  return vec * config.inscribed_value * (cos(alpha) + 1) / 2.0;
481  }
482 
483  // Inscribed radius
484  if (distance > 0)
485  {
486  return vec * config.inscribed_value;
487  }
488 
489  // Lethality
490  return vec * config.lethal_value;
491 }
492 
494  const lvr2::DenseVertexMap<lvr2::VertexHandle>& predecessors,
496 {
497  if (vector_map.containsKey(current_vertex))
498  return;
499 
500  const auto& pre = predecessors[current_vertex];
501 
502  if (pre != current_vertex)
503  {
504  backToSource(pre, predecessors, vector_map);
505  const auto& v0 = mesh_ptr->getVertexPosition(current_vertex);
506  const auto& v1 = mesh_ptr->getVertexPosition(pre);
507  vector_map.insert(current_vertex, v1 - v0 + vector_map[pre]);
508  }
509  else
510  {
511  vector_map.insert(current_vertex, lvr2::BaseVector<float>());
512  }
513 }
514 
515 void InflationLayer::lethalCostInflation(const std::set<lvr2::VertexHandle>& lethals, const float inflation_radius,
516  const float inscribed_radius, const float inscribed_value,
517  const float lethal_value)
518 {
519  ROS_INFO_STREAM("lethal cost inflation.");
520 
521  struct Cmp
522  {
525  {
526  }
527 
528  bool operator()(lvr2::VertexHandle& left, lvr2::VertexHandle& right)
529  {
530  return distances[left] > distances[right];
531  }
532  };
533 
534  lvr2::DenseVertexMap<bool> seen(mesh_ptr->nextVertexIndex(), false);
535  lvr2::DenseVertexMap<float> distances(mesh_ptr->nextVertexIndex(), std::numeric_limits<float>::max());
537  prev.reserve(mesh_ptr->nextVertexIndex());
538 
539  for (auto vH : mesh_ptr->vertices())
540  {
541  prev.insert(vH, vH);
542  }
543 
544  Cmp cmp(distances);
545  std::priority_queue<lvr2::VertexHandle, std::vector<lvr2::VertexHandle>, Cmp> pq(cmp);
546 
547  for (auto vH : lethals)
548  {
549  distances[vH] = 0;
550  pq.push(vH);
551  }
552 
553  float inflation_radius_squared = inflation_radius * inflation_radius;
554  float inscribed_radius_squared = inscribed_radius * inscribed_radius;
555 
556  while (!pq.empty())
557  {
558  lvr2::VertexHandle vH = pq.top();
559  pq.pop();
560 
561  if (seen[vH])
562  continue;
563  seen[vH] = true;
564 
565  std::vector<lvr2::VertexHandle> neighbours;
566  mesh_ptr->getNeighboursOfVertex(vH, neighbours);
567  for (auto n : neighbours)
568  {
569  if (distances[n] == 0 || seen[n])
570  continue;
571  float n_dist = mesh_ptr->getVertexPosition(n).squaredDistanceFrom(mesh_ptr->getVertexPosition(prev[vH]));
572  if (n_dist < distances[n] && n_dist < inflation_radius_squared)
573  {
574  prev[n] = prev[vH];
575  distances[n] = n_dist;
576  pq.push(n);
577  }
578  }
579  }
580 
581  for (auto vH : mesh_ptr->vertices())
582  {
583  if (distances[vH] > inflation_radius_squared)
584  {
585  riskiness.insert(vH, 0);
586  }
587 
588  // Inflation radius
589  else if (distances[vH] > inscribed_radius_squared)
590  {
591  float alpha = (sqrt(distances[vH]) - inscribed_radius) / (inflation_radius - inscribed_radius) * M_PI;
592  riskiness.insert(vH, inscribed_value * (cos(alpha) + 1) / 2.0);
593  }
594 
595  // Inscribed radius
596  else if (distances[vH] > 0)
597  {
598  riskiness.insert(vH, inscribed_value);
599  }
600 
601  // Lethality
602  else
603  {
604  riskiness.insert(vH, lethal_value);
605  }
606  }
607 
608  ROS_INFO_STREAM("lethal cost inflation finished.");
609 }
610 
612 {
613  /*waveCostInflation(lethal_vertices, config.inflation_radius,
614  config.inscribed_radius, config.inscribed_value,
615  std::numeric_limits<float>::infinity());
616  */
617  // lethalCostInflation(lethal_vertices, config.inflation_radius,
618  // config.inscribed_radius, config.inscribed_value,
619  // std::numeric_limits<float>::infinity());
620  // config.lethal_value);
621 
622  return true;
623 }
625 {
626  return riskiness;
627 }
628 
629 void InflationLayer::reconfigureCallback(mesh_layers::InflationLayerConfig& cfg, uint32_t level)
630 {
631  bool notify = false;
632  ROS_INFO_STREAM("New inflation layer config through dynamic reconfigure.");
633  if (first_config)
634  {
635  config = cfg;
636  first_config = false;
637  }
638 
639  if (config.inflation_radius != cfg.inflation_radius)
640  {
641  // TODO handle other config params
642  waveCostInflation(lethal_vertices, config.inflation_radius, config.inscribed_radius, config.inscribed_value,
643  std::numeric_limits<float>::infinity());
644  notify = true;
645  }
646 
647  if (config.inscribed_radius != cfg.inscribed_radius || config.inflation_radius != cfg.inflation_radius ||
648  config.lethal_value != cfg.lethal_value || config.inscribed_value != cfg.inscribed_value)
649  {
650  map_ptr->publishVectorField("inflation", vector_map, distances,
651  std::bind(&mesh_layers::InflationLayer::fading, this, std::placeholders::_1));
652  notify = true;
653  }
654 
655  /*lethalCostInflation(lethal_vertices, cfg.inflation_radius,
656  cfg.inscribed_radius, cfg.inscribed_value,
657  cfg.lethal_value == -1
658  ? std::numeric_limits<float>::infinity()
659  : cfg.lethal_value);
660  */
661  config = cfg;
662 
663  if (notify)
664  notifyChange();
665 }
666 
667 bool InflationLayer::initialize(const std::string& name)
668 {
669  first_config = true;
671  new dynamic_reconfigure::Server<mesh_layers::InflationLayerConfig>(private_nh));
672 
673  config_callback = boost::bind(&InflationLayer::reconfigureCallback, this, _1, _2);
675  return true;
676 }
677 
678 } /* namespace mesh_layers */
mesh_layers::InflationLayer::writeLayer
virtual bool writeLayer()
try to write layer to map file
Definition: inflation_layer.cpp:67
mesh_layers::InflationLayer::first_config
bool first_config
Definition: inflation_layer.h:241
Meap.hpp
lvr2::PanicException
lvr2::BaseVector< float >
mesh_layers::InflationLayer::readLayer
virtual bool readLayer()
try read layer from map file
Definition: inflation_layer.cpp:49
mesh_layers::InflationLayer::riskiness
lvr2::DenseVertexMap< float > riskiness
Definition: inflation_layer.h:225
ROS_ERROR_STREAM
#define ROS_ERROR_STREAM(args)
mesh_layers::InflationLayer::vectorAt
lvr2::BaseVector< float > vectorAt(const std::array< lvr2::VertexHandle, 3 > &vertices, const std::array< float, 3 > &barycentric_coords)
returns repulsive vector at a given position inside a face
Definition: inflation_layer.cpp:423
boost::shared_ptr
mesh_map::AbstractLayer::notifyChange
void notifyChange()
lvr2::FaceHandle
mesh_layers::InflationLayer::direction
lvr2::DenseVertexMap< float > direction
Definition: inflation_layer.h:227
mesh_map::AbstractLayer::map_ptr
std::shared_ptr< mesh_map::MeshMap > map_ptr
dot
std::iterator_traits< InputIterator >::value_type dot(InputIterator v1, InputIterator v2)
mesh_layers::InflationLayer::updateLethal
virtual void updateLethal(std::set< lvr2::VertexHandle > &added_lethal, std::set< lvr2::VertexHandle > &removed_lethal)
update set of lethal vertices by adding and removing vertices
Definition: inflation_layer.cpp:88
lvr2::AttributeMap
lvr2::VertexLoopException
mesh_layers::InflationLayer::waveFrontUpdate
bool waveFrontUpdate(lvr2::DenseVertexMap< float > &distances, lvr2::DenseVertexMap< lvr2::VertexHandle > &predecessors, const float &max_distance, const lvr2::DenseEdgeMap< float > &edge_weights, const lvr2::FaceHandle &fh, const lvr2::BaseVector< float > &normal, const lvr2::VertexHandle &v1, const lvr2::VertexHandle &v2, const lvr2::VertexHandle &v3)
updates the wavefront
Definition: inflation_layer.cpp:157
mesh_layers
Definition: height_diff_layer.h:45
mesh_layers::InflationLayer::fading
float fading(const float val)
fade cost value based on lethal and inscribed area
Definition: inflation_layer.cpp:235
BaseOptionalHandle< Index, EdgeHandle >::unwrap
EdgeHandle unwrap() const
mesh_layers::InflationLayer::distances
lvr2::DenseVertexMap< float > distances
Definition: inflation_layer.h:233
mesh_layers::InflationLayer::reconfigure_server_ptr
boost::shared_ptr< dynamic_reconfigure::Server< mesh_layers::InflationLayerConfig > > reconfigure_server_ptr
Definition: inflation_layer.h:238
class_list_macros.h
mesh_layers::InflationLayer::computeLayer
virtual bool computeLayer()
calculate the values of this layer
Definition: inflation_layer.cpp:611
M_PI
#define M_PI
lvr2::VectorMap
lvr2::OptionalEdgeHandle
mesh_layers::InflationLayer::backToSource
void backToSource(const lvr2::VertexHandle &current_vertex, const lvr2::DenseVertexMap< lvr2::VertexHandle > &predecessors, lvr2::DenseVertexMap< lvr2::BaseVector< float >> &vector_map)
adds vector pointing back to source of inflation source
Definition: inflation_layer.cpp:493
mesh_layers::InflationLayer::lethals
virtual std::set< lvr2::VertexHandle > & lethals()
deliver set containing all vertices marked as lethal
Definition: inflation_layer.h:203
lvr2::VertexHandle
lvr2::Meap
lvr2::Meap::insert
boost::optional< ValueT > insert(KeyT key, const ValueT &value)
mesh_layers::InflationLayer::config_callback
dynamic_reconfigure::Server< mesh_layers::InflationLayerConfig >::CallbackType config_callback
Definition: inflation_layer.h:239
mesh_layers::InflationLayer
Costmap layer which inflates around existing lethal vertices.
Definition: inflation_layer.h:52
mesh_layers::EPSILON
const float EPSILON
Definition: inflation_layer.h:47
mesh_map::AbstractLayer
inflation_layer.h
mesh_layers::InflationLayer::config
InflationLayerConfig config
Definition: inflation_layer.h:243
ROS_INFO_STREAM
#define ROS_INFO_STREAM(args)
mesh_layers::InflationLayer::lethal_vertices
std::set< lvr2::VertexHandle > lethal_vertices
Definition: inflation_layer.h:235
mesh_layers::InflationLayer::cutting_faces
lvr2::DenseVertexMap< lvr2::FaceHandle > cutting_faces
Definition: inflation_layer.h:229
lvr2::Meap::isEmpty
bool isEmpty() const
mesh_layers::InflationLayer::vector_map
lvr2::DenseVertexMap< lvr2::BaseVector< float > > vector_map
Definition: inflation_layer.h:231
mesh_layers::InflationLayer::reconfigureCallback
void reconfigureCallback(mesh_layers::InflationLayerConfig &cfg, uint32_t level)
callback for incoming reconfigure configs
Definition: inflation_layer.cpp:629
mesh_layers::InflationLayer::computeUpdateSethianMethod
float computeUpdateSethianMethod(const float &d1, const float &d2, const float &a, const float &b, const float &dot, const float &F)
Definition: inflation_layer.cpp:105
mesh_map::linearCombineBarycentricCoords
T linearCombineBarycentricCoords(const std::array< lvr2::VertexHandle, 3 > &vertices, const lvr2::VertexMap< T > &attribute_map, const std::array< float, 3 > &barycentric_coords)
mesh_map::AbstractLayer::private_nh
ros::NodeHandle private_nh
mesh_map::AbstractLayer::mesh_io_ptr
std::shared_ptr< lvr2::AttributeMeshIOBase > mesh_io_ptr
mesh_layers::InflationLayer::threshold
virtual float threshold()
delivers the threshold above which vertices are marked lethal
Definition: inflation_layer.cpp:83
mesh_map::AbstractLayer::notify
notify_func notify
mesh_map::AbstractLayer::mesh_ptr
std::shared_ptr< lvr2::HalfEdgeMesh< Vector > > mesh_ptr
lvr2::Meap::popMin
MeapPair< KeyT, ValueT > popMin()
lvr2::VectorMap::insert
boost::optional< ValueT > insert(HandleT key, const ValueT &value) final
mesh_layers::InflationLayer::initialize
virtual bool initialize(const std::string &name)
initializes this layer plugin
Definition: inflation_layer.cpp:667
PLUGINLIB_EXPORT_CLASS
PLUGINLIB_EXPORT_CLASS(mesh_layers::InflationLayer, mesh_map::AbstractLayer)
lvr2::VectorMap::reserve
void reserve(size_t newCap)
mesh_layers::InflationLayer::waveCostInflation
void waveCostInflation(const std::set< lvr2::VertexHandle > &lethals, const float inflation_radius, const float inscribed_radius, const float inscribed_value, const float lethal_value)
inflate around lethal vertices by using an wave front propagation and assign riskiness values to vert...
Definition: inflation_layer.cpp:255
mesh
HalfEdgeMesh< Vec > mesh
normalized
__kf_device__ float3 normalized(const float3 &v)
util.h
mesh_layers::InflationLayer::lethalCostInflation
void lethalCostInflation(const std::set< lvr2::VertexHandle > &lethals, const float inflation_radius, const float inscribed_radius, const float inscribed_value, const float lethal_value)
inflate around lethal vertices by inflating to neighbours on mesh and using squared distances and ass...
Definition: inflation_layer.cpp:515
t
geometry_msgs::TransformStamped t
BaseHandle< Index >::idx
Index idx() const
mesh_layers::InflationLayer::costs
virtual lvr2::VertexMap< float > & costs()
deliver the current costmap
Definition: inflation_layer.cpp:624


mesh_layers
Author(s): Sebastian Pütz
autogenerated on Thu Jan 25 2024 03:43:03