Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
csm
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
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
labrobotica
algorithms
csm
Commits
19fa2c71
Commit
19fa2c71
authored
3 years ago
by
Joan Vallvé Navarro
Browse files
Options
Downloads
Patches
Plain Diff
changed errors to debug msgs
parent
8b5e59de
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
sm/csm/icp/icp.c
+4
-4
4 additions, 4 deletions
sm/csm/icp/icp.c
sm/csm/icp/icp_debug.c
+3
-3
3 additions, 3 deletions
sm/csm/icp/icp_debug.c
sm/csm/icp/icp_loop.c
+10
-10
10 additions, 10 deletions
sm/csm/icp/icp_loop.c
with
17 additions
and
17 deletions
sm/csm/icp/icp.c
+
4
−
4
View file @
19fa2c71
...
@@ -90,7 +90,7 @@ void sm_icp(struct sm_params*params, struct sm_result*res) {
...
@@ -90,7 +90,7 @@ void sm_icp(struct sm_params*params, struct sm_result*res) {
int
iterations
;
int
iterations
;
int
nvalid
;
int
nvalid
;
if
(
!
icp_loop
(
params
,
x_old
->
data
,
x_new
->
data
,
&
error
,
&
nvalid
,
&
iterations
))
{
if
(
!
icp_loop
(
params
,
x_old
->
data
,
x_new
->
data
,
&
error
,
&
nvalid
,
&
iterations
))
{
sm_
error
(
"icp: ICP failed for some reason.
\n
"
);
sm_
debug
(
"icp: ICP failed for some reason.
\n
"
);
res
->
valid
=
0
;
res
->
valid
=
0
;
res
->
iterations
=
iterations
;
res
->
iterations
=
iterations
;
res
->
nvalid
=
0
;
res
->
nvalid
=
0
;
...
@@ -127,7 +127,7 @@ void sm_icp(struct sm_params*params, struct sm_result*res) {
...
@@ -127,7 +127,7 @@ void sm_icp(struct sm_params*params, struct sm_result*res) {
gsl_vector
*
x_a
=
gsl_vector_alloc
(
3
);
gsl_vector
*
x_a
=
gsl_vector_alloc
(
3
);
double
my_error
;
int
my_valid
;
int
my_iterations
;
double
my_error
;
int
my_valid
;
int
my_iterations
;
if
(
!
icp_loop
(
&
my_params
,
start
->
data
,
x_a
->
data
,
&
my_error
,
&
my_valid
,
&
my_iterations
)){
if
(
!
icp_loop
(
&
my_params
,
start
->
data
,
x_a
->
data
,
&
my_error
,
&
my_valid
,
&
my_iterations
)){
sm_
error
(
"Error during restart #%d/%d.
\n
"
,
a
,
6
);
sm_
debug
(
"Error during restart #%d/%d.
\n
"
,
a
,
6
);
break
;
break
;
}
}
iterations
+=
my_iterations
;
iterations
+=
my_iterations
;
...
@@ -263,7 +263,7 @@ void sm_icp_xy(struct sm_params*params, struct sm_result*res)
...
@@ -263,7 +263,7 @@ void sm_icp_xy(struct sm_params*params, struct sm_result*res)
int
iterations
;
int
iterations
;
int
nvalid
;
int
nvalid
;
if
(
!
icp_loop
(
params
,
x_old
->
data
,
x_new
->
data
,
&
error
,
&
nvalid
,
&
iterations
))
{
if
(
!
icp_loop
(
params
,
x_old
->
data
,
x_new
->
data
,
&
error
,
&
nvalid
,
&
iterations
))
{
sm_
error
(
"icp: ICP failed for some reason.
\n
"
);
sm_
debug
(
"icp: ICP failed for some reason.
\n
"
);
res
->
valid
=
0
;
res
->
valid
=
0
;
res
->
iterations
=
iterations
;
res
->
iterations
=
iterations
;
res
->
nvalid
=
0
;
res
->
nvalid
=
0
;
...
@@ -298,7 +298,7 @@ void sm_icp_xy(struct sm_params*params, struct sm_result*res)
...
@@ -298,7 +298,7 @@ void sm_icp_xy(struct sm_params*params, struct sm_result*res)
gsl_vector
*
x_a
=
gsl_vector_alloc
(
3
);
gsl_vector
*
x_a
=
gsl_vector_alloc
(
3
);
double
my_error
;
int
my_valid
;
int
my_iterations
;
double
my_error
;
int
my_valid
;
int
my_iterations
;
if
(
!
icp_loop
(
&
my_params
,
start
->
data
,
x_a
->
data
,
&
my_error
,
&
my_valid
,
&
my_iterations
)){
if
(
!
icp_loop
(
&
my_params
,
start
->
data
,
x_a
->
data
,
&
my_error
,
&
my_valid
,
&
my_iterations
)){
sm_
error
(
"Error during restart #%d/%d.
\n
"
,
a
,
6
);
sm_
debug
(
"Error during restart #%d/%d.
\n
"
,
a
,
6
);
break
;
break
;
}
}
iterations
+=
my_iterations
;
iterations
+=
my_iterations
;
...
...
This diff is collapsed.
Click to expand it.
sm/csm/icp/icp_debug.c
+
3
−
3
View file @
19fa2c71
...
@@ -12,13 +12,13 @@ void debug_correspondences(struct sm_params * params) {
...
@@ -12,13 +12,13 @@ void debug_correspondences(struct sm_params * params) {
find_correspondences
(
params
);
find_correspondences
(
params
);
long
hash2
=
ld_corr_hash
(
laser_sens
);
long
hash2
=
ld_corr_hash
(
laser_sens
);
if
(
hash1
!=
hash2
)
{
if
(
hash1
!=
hash2
)
{
sm_
error
(
"find_correspondences_tricks might be buggy
\n
"
);
sm_
debug
(
"find_correspondences_tricks might be buggy
\n
"
);
int
i
=
0
;
for
(
i
=
0
;
i
<
laser_sens
->
nrays
;
i
++
)
{
int
i
=
0
;
for
(
i
=
0
;
i
<
laser_sens
->
nrays
;
i
++
)
{
if
(
(
c1
[
i
].
valid
!=
c2
[
i
].
valid
)
||
if
(
(
c1
[
i
].
valid
!=
c2
[
i
].
valid
)
||
(
c1
[
i
].
j1
!=
c2
[
i
].
j1
)
||
(
c1
[
i
].
j2
!=
c2
[
i
].
j2
)
)
{
(
c1
[
i
].
j1
!=
c2
[
i
].
j1
)
||
(
c1
[
i
].
j2
!=
c2
[
i
].
j2
)
)
{
sm_
error
(
"
\t
tricks: c1[%d].valid = %d j1 = %d j2 = %d dist2_j1 = %f
\n
"
,
sm_
debug
(
"
\t
tricks: c1[%d].valid = %d j1 = %d j2 = %d dist2_j1 = %f
\n
"
,
i
,
c1
[
i
].
valid
,
c1
[
i
].
j1
,
c1
[
i
].
j2
,
c1
[
i
].
dist2_j1
);
i
,
c1
[
i
].
valid
,
c1
[
i
].
j1
,
c1
[
i
].
j2
,
c1
[
i
].
dist2_j1
);
sm_
error
(
"
\t
no tricks: c2[%d].valid = %d j1 = %d j2 = %d dist2_j1 = %f
\n
"
,
sm_
debug
(
"
\t
no tricks: c2[%d].valid = %d j1 = %d j2 = %d dist2_j1 = %f
\n
"
,
i
,
c2
[
i
].
valid
,
c2
[
i
].
j1
,
c2
[
i
].
j2
,
c2
[
i
].
dist2_j1
);
i
,
c2
[
i
].
valid
,
c2
[
i
].
j1
,
c2
[
i
].
j2
,
c2
[
i
].
dist2_j1
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
sm/csm/icp/icp_loop.c
+
10
−
10
View file @
19fa2c71
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
int
icp_loop
(
struct
sm_params
*
params
,
const
double
*
q0
,
double
*
x_new
,
int
icp_loop
(
struct
sm_params
*
params
,
const
double
*
q0
,
double
*
x_new
,
double
*
total_error
,
int
*
valid
,
int
*
iterations
)
{
double
*
total_error
,
int
*
valid
,
int
*
iterations
)
{
if
(
any_nan
(
q0
,
3
))
{
if
(
any_nan
(
q0
,
3
))
{
sm_
error
(
"icp_loop: Initial pose contains nan: %s
\n
"
,
friendly_pose
(
q0
));
sm_
debug
(
"icp_loop: Initial pose contains nan: %s
\n
"
,
friendly_pose
(
q0
));
return
0
;
return
0
;
}
}
...
@@ -56,7 +56,7 @@ int icp_loop(struct sm_params*params, const double*q0, double*x_new,
...
@@ -56,7 +56,7 @@ int icp_loop(struct sm_params*params, const double*q0, double*x_new,
int
num_corr
=
ld_num_valid_correspondences
(
laser_sens
);
int
num_corr
=
ld_num_valid_correspondences
(
laser_sens
);
double
fail_perc
=
0
.
05
;
double
fail_perc
=
0
.
05
;
if
(
num_corr
<
fail_perc
*
laser_sens
->
nrays
)
{
/* TODO: arbitrary */
if
(
num_corr
<
fail_perc
*
laser_sens
->
nrays
)
{
/* TODO: arbitrary */
sm_
error
(
" : before trimming, only %d correspondences.
\n
"
,
num_corr
);
sm_
debug
(
" : before trimming, only %d correspondences.
\n
"
,
num_corr
);
all_is_okay
=
0
;
all_is_okay
=
0
;
egsl_pop_named
(
"icp_loop iteration"
);
/* loop context */
egsl_pop_named
(
"icp_loop iteration"
);
/* loop context */
break
;
break
;
...
@@ -91,7 +91,7 @@ int icp_loop(struct sm_params*params, const double*q0, double*x_new,
...
@@ -91,7 +91,7 @@ int icp_loop(struct sm_params*params, const double*q0, double*x_new,
/* If not many correspondences, bail out */
/* If not many correspondences, bail out */
if
(
num_corr_after
<
fail_perc
*
laser_sens
->
nrays
){
if
(
num_corr_after
<
fail_perc
*
laser_sens
->
nrays
){
sm_
error
(
" icp_loop: failed: after trimming, only %d correspondences.
\n
"
,
num_corr_after
);
sm_
debug
(
" icp_loop: failed: after trimming, only %d correspondences.
\n
"
,
num_corr_after
);
all_is_okay
=
0
;
all_is_okay
=
0
;
egsl_pop_named
(
"icp_loop iteration"
);
/* loop context */
egsl_pop_named
(
"icp_loop iteration"
);
/* loop context */
break
;
break
;
...
@@ -99,7 +99,7 @@ int icp_loop(struct sm_params*params, const double*q0, double*x_new,
...
@@ -99,7 +99,7 @@ int icp_loop(struct sm_params*params, const double*q0, double*x_new,
/* Compute next estimate based on the correspondences */
/* Compute next estimate based on the correspondences */
if
(
!
compute_next_estimate
(
params
,
x_old
,
x_new
))
{
if
(
!
compute_next_estimate
(
params
,
x_old
,
x_new
))
{
sm_
error
(
" icp_loop: Cannot compute next estimate.
\n
"
);
sm_
debug
(
" icp_loop: Cannot compute next estimate.
\n
"
);
all_is_okay
=
0
;
all_is_okay
=
0
;
egsl_pop_named
(
"icp_loop iteration"
);
egsl_pop_named
(
"icp_loop iteration"
);
break
;
break
;
...
@@ -274,9 +274,9 @@ int compute_next_estimate(struct sm_params*params,
...
@@ -274,9 +274,9 @@ int compute_next_estimate(struct sm_params*params,
}
else
{
}
else
{
static
int
warned_before
=
0
;
static
int
warned_before
=
0
;
if
(
!
warned_before
)
{
if
(
!
warned_before
)
{
sm_
error
(
"Param use_ml_weights was active, but not valid alpha[] or true_alpha[]."
sm_
debug
(
"Param use_ml_weights was active, but not valid alpha[] or true_alpha[]."
"Perhaps, if this is a single ray not having alpha, you should mark it as inactive.
\n
"
);
"Perhaps, if this is a single ray not having alpha, you should mark it as inactive.
\n
"
);
sm_
error
(
"Writing laser_ref:
\n
"
);
sm_
debug
(
"Writing laser_ref:
\n
"
);
ld_write_as_json
(
laser_ref
,
stderr
);
ld_write_as_json
(
laser_ref
,
stderr
);
warned_before
=
1
;
warned_before
=
1
;
}
}
...
@@ -290,8 +290,8 @@ int compute_next_estimate(struct sm_params*params,
...
@@ -290,8 +290,8 @@ int compute_next_estimate(struct sm_params*params,
}
else
{
}
else
{
static
int
warned_before
=
0
;
static
int
warned_before
=
0
;
if
(
!
warned_before
)
{
if
(
!
warned_before
)
{
sm_
error
(
"Param use_sigma_weights was active, but the field readings_sigma[] was not filled in.
\n
"
);
sm_
debug
(
"Param use_sigma_weights was active, but the field readings_sigma[] was not filled in.
\n
"
);
sm_
error
(
"Writing laser_sens:
\n
"
);
sm_
debug
(
"Writing laser_sens:
\n
"
);
ld_write_as_json
(
laser_sens
,
stderr
);
ld_write_as_json
(
laser_sens
,
stderr
);
}
}
}
}
...
@@ -315,7 +315,7 @@ int compute_next_estimate(struct sm_params*params,
...
@@ -315,7 +315,7 @@ int compute_next_estimate(struct sm_params*params,
int
ok
=
gpc_solve
(
k
,
c
,
0
,
inv_cov_x0
,
x_new
);
int
ok
=
gpc_solve
(
k
,
c
,
0
,
inv_cov_x0
,
x_new
);
if
(
!
ok
)
{
if
(
!
ok
)
{
sm_
error
(
"gpc_solve_valid failed
\n
"
);
sm_
debug
(
"gpc_solve_valid failed
\n
"
);
return
0
;
return
0
;
}
}
...
@@ -328,7 +328,7 @@ int compute_next_estimate(struct sm_params*params,
...
@@ -328,7 +328,7 @@ int compute_next_estimate(struct sm_params*params,
double
epsilon
=
0
.
000001
;
double
epsilon
=
0
.
000001
;
if
(
new_error
>
old_error
+
epsilon
)
{
if
(
new_error
>
old_error
+
epsilon
)
{
sm_
error
(
"
\t
compute_next_estimate: something's fishy here! Old error: %lf new error: %lf x_old %lf %lf %lf x_new %lf %lf %lf
\n
"
,
old_error
,
new_error
,
x_old
[
0
],
x_old
[
1
],
x_old
[
2
],
x_new
[
0
],
x_new
[
1
],
x_new
[
2
]);
sm_
debug
(
"
\t
compute_next_estimate: something's fishy here! Old error: %lf new error: %lf x_old %lf %lf %lf x_new %lf %lf %lf
\n
"
,
old_error
,
new_error
,
x_old
[
0
],
x_old
[
1
],
x_old
[
2
],
x_new
[
0
],
x_new
[
1
],
x_new
[
2
]);
}
}
return
1
;
return
1
;
...
...
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