test
include
planner_cspace
distance_map_utils.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2023, the neonavigation authors
3
* All rights reserved.
4
*
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions are met:
7
*
8
* * Redistributions of source code must retain the above copyright
9
* notice, this list of conditions and the following disclaimer.
10
* * Redistributions in binary form must reproduce the above copyright
11
* notice, this list of conditions and the following disclaimer in the
12
* documentation and/or other materials provided with the distribution.
13
* * Neither the name of the copyright holder nor the names of its
14
* contributors may be used to endorse or promote products derived from
15
* this software without specific prior written permission.
16
*
17
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27
* POSSIBILITY OF SUCH DAMAGE.
28
*/
29
30
#ifndef PLANNER_CSPACE_DISTANCE_MAP_UTILS_H
31
#define PLANNER_CSPACE_DISTANCE_MAP_UTILS_H
32
33
#include <limits>
34
#include <string>
35
36
#include <
planner_cspace/grid_astar.h
>
37
#include <
planner_cspace/planner_3d/distance_map.h
>
38
#include <
planner_cspace/planner_3d/grid_astar_model.h
>
39
40
namespace
planner_cspace
41
{
42
namespace
planner_3d
43
{
44
using
Astar
=
GridAstar<3, 2>
;
45
46
namespace
47
{
48
inline
std::string xyStr(
const
float
x,
const
float
y)
49
{
50
return
"("
+ std::to_string(x) +
", "
+ std::to_string(y) +
")"
;
51
}
52
53
inline
void
debugOutput(
54
const
DistanceMap
& dm,
55
const
Astar::Gridmap<char, 0x80>& cm_rough,
56
const
Astar::Vec
&
s
,
const
Astar::Vec
& e)
57
{
58
for
(
int
y = 0; y < cm_rough.size()[1]; y++)
59
{
60
for
(
int
x = 0; x < cm_rough.size()[0]; x++)
61
{
62
const
Astar::Vec
pos(x, y, 0);
63
const
float
d
= dm[pos];
64
65
const
char
type = (pos == s ?
's'
: (pos == e ?
'e'
:
' '
));
66
if
(d == std::numeric_limits<float>::max())
67
{
68
fprintf(stderr,
"xxx%c "
, type);
69
continue
;
70
}
71
else
if
(cm_rough[pos] == 100)
72
{
73
fprintf(stderr,
"***%c "
, type);
74
continue
;
75
}
76
fprintf(stderr,
"%3.1f%c "
, d, type);
77
}
78
fprintf(stderr,
"\n"
);
79
}
80
for
(
int
x = 0; x < cm_rough.size()[0]; x++)
81
{
82
fprintf(stderr,
"---- "
);
83
}
84
fprintf(stderr,
"\n"
);
85
}
86
}
// namespace
87
}
// namespace planner_3d
88
}
// namespace planner_cspace
89
90
#endif // PLANNER_CSPACE_DISTANCE_MAP_UTILS_H
d
d
s
XmlRpcServer s
grid_astar_model.h
planner_cspace::GridAstar< 3, 2 >
planner_cspace::planner_3d::DistanceMap
Definition:
distance_map.h:47
planner_cspace::CyclicVecBase
Definition:
cyclic_vec.h:78
distance_map.h
grid_astar.h
planner_cspace
Definition:
bbf.h:33
planner_cspace
Author(s): Atsushi Watanabe
autogenerated on Mon Jul 3 2023 02:39:06