Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
coal
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Coal
coal
Commits
ff862b89
Commit
ff862b89
authored
13 years ago
by
jpan
Browse files
Options
Downloads
Patches
Plain Diff
git-svn-id:
https://kforge.ros.org/fcl/fcl_ros@72
253336fb-580f-4252-a368-f3cef5a2a82b
parent
c465c498
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
trunk/fcl/manifest.xml
+2
-2
2 additions, 2 deletions
trunk/fcl/manifest.xml
trunk/fcl/src/BVH_utility.cpp
+91
-2
91 additions, 2 deletions
trunk/fcl/src/BVH_utility.cpp
with
93 additions
and
4 deletions
trunk/fcl/manifest.xml
+
2
−
2
View file @
ff862b89
...
...
@@ -9,9 +9,9 @@
<review
status=
"unreviewed"
notes=
""
/>
<url>
http://ros.org/wiki/fcl
</url>
<depend
package=
"libccd"
/>
<depend
package=
"ann"
/>
<!--
<depend package="ann"/>
-->
<depend
package=
"common_rosdeps"
/>
<rosdep
name=
"flann"
/>
<export>
<cpp
cflags=
"-I${prefix}/include"
lflags=
"-Wl,-rpath,${prefix}/lib -L${prefix}/lib -lfcl"
/>
</export>
...
...
This diff is collapsed.
Click to expand it.
trunk/fcl/src/BVH_utility.cpp
+
91
−
2
View file @
ff862b89
...
...
@@ -36,7 +36,9 @@
#include
"fcl/BVH_utility.h"
#include
<ANN/ANN.h>
//#include <ANN/ANN.h>
#include
<flann/flann.hpp>
namespace
fcl
{
...
...
@@ -107,6 +109,92 @@ void BVHExpand(BVHModel<RSS>& model, const Uncertainty* ucs, BVH_REAL r = 1.0)
void
estimateSamplingUncertainty
(
Vec3f
*
vertices
,
int
num_vertices
,
Uncertainty
*
ucs
)
{
int
nPts
=
num_vertices
;
int
knn_k
=
10
;
if
(
knn_k
>
nPts
)
knn_k
=
nPts
;
int
dim
=
3
;
float
*
dataset_
=
new
float
[
dim
*
nPts
];
float
*
query_
=
new
float
[
dim
*
1
];
for
(
int
i
=
0
;
i
<
nPts
;
++
i
)
{
for
(
int
j
=
0
;
j
<
dim
;
++
j
)
dataset_
[
i
*
dim
+
j
]
=
vertices
[
i
][
j
];
}
flann
::
Matrix
<
float
>
dataset
(
dataset_
,
nPts
,
dim
);
flann
::
Matrix
<
float
>
query
(
query_
,
1
,
dim
);
int
*
indices_
=
new
int
[
query
.
rows
*
knn_k
];
float
*
dists_
=
new
float
[
query
.
rows
*
knn_k
];
flann
::
Matrix
<
int
>
indices
(
indices_
,
query
.
rows
,
knn_k
);
flann
::
Matrix
<
float
>
dists
(
dists_
,
query
.
rows
,
knn_k
);
flann
::
Index
<
flann
::
L2
<
float
>
>
index
(
dataset
,
flann
::
KDTreeIndexParams
(
4
));
index
.
buildIndex
();
double
eps
=
0
;
double
scale
=
2
;
for
(
int
i
=
0
;
i
<
nPts
;
++
i
)
{
float
C
[
3
][
3
];
for
(
int
j
=
0
;
j
<
dim
;
++
j
)
{
for
(
int
k
=
0
;
k
<
dim
;
++
k
)
C
[
j
][
k
]
=
0
;
}
for
(
int
j
=
0
;
j
<
dim
;
++
j
)
query_
[
j
]
=
vertices
[
i
][
j
];
index
.
knnSearch
(
query
,
indices
,
dists
,
knn_k
,
flann
::
SearchParams
(
128
));
double
r
=
dists_
[
knn_k
-
1
];
double
sigma
=
scale
*
r
;
double
weight_sum
=
0
;
for
(
int
j
=
1
;
j
<
knn_k
;
++
j
)
{
int
id
=
indices_
[
j
];
Vec3f
p
=
vertices
[
i
]
-
vertices
[
id
];
double
norm2p
=
p
.
sqrLength
();
double
weight
=
exp
(
-
norm2p
/
(
sigma
*
sigma
));
weight_sum
+=
weight
;
for
(
int
k
=
0
;
k
<
dim
;
++
k
)
{
for
(
int
l
=
0
;
l
<
dim
;
++
l
)
C
[
k
][
l
]
+=
p
[
k
]
*
p
[
l
]
*
weight
;
}
}
for
(
int
j
=
0
;
j
<
dim
;
++
j
)
{
for
(
int
k
=
0
;
k
<
dim
;
++
k
)
{
C
[
j
][
k
]
/=
weight_sum
;
ucs
[
i
].
Sigma
[
j
][
k
]
=
C
[
j
][
k
];
}
}
ucs
[
i
].
preprocess
();
ucs
[
i
].
sqrt
();
}
delete
[]
dataset
.
ptr
();
delete
[]
query
.
ptr
();
delete
[]
indices
.
ptr
();
delete
[]
dists
.
ptr
();
/*
int nPts = num_vertices;
ANNpointArray dataPts;
ANNpoint queryPt;
...
...
@@ -125,7 +213,7 @@ void estimateSamplingUncertainty(Vec3f* vertices, int num_vertices, Uncertainty*
for(int i = 0; i < nPts; ++i)
{
for
(
int
j
=
0
;
j
<
3
;
++
j
)
for(int j = 0; j <
dim
; ++j)
dataPts[i][j] = vertices[i][j];
}
...
...
@@ -188,6 +276,7 @@ void estimateSamplingUncertainty(Vec3f* vertices, int num_vertices, Uncertainty*
delete [] dists;
delete kdTree;
annClose();
*/
}
/** \brief Compute the covariance matrix for a set or subset of points. */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment