Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
wolf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
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
mobile_robotics
wolf_projects
wolf_lib
wolf
Commits
13bc2394
Commit
13bc2394
authored
3 years ago
by
Joan Solà Ortega
Browse files
Options
Downloads
Patches
Plain Diff
Update hello_wolf_autoconf.cpp
parent
e4dfa56a
No related branches found
No related tags found
3 merge requests
!436
Release to start wolf public
,
!433
After 2nd RA-L submission
,
!428
Resolve "Rename IsMotion --> StateProvider"
Pipeline
#7773
failed
3 years ago
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
demos/hello_wolf/hello_wolf_autoconf.cpp
+17
-13
17 additions, 13 deletions
demos/hello_wolf/hello_wolf_autoconf.cpp
with
17 additions
and
13 deletions
demos/hello_wolf/hello_wolf_autoconf.cpp
+
17
−
13
View file @
13bc2394
...
@@ -116,7 +116,7 @@ int main()
...
@@ -116,7 +116,7 @@ int main()
using
namespace
wolf
;
using
namespace
wolf
;
WOLF_
TRACE
(
"======== CONFIGURE PROBLEM ======="
);
WOLF_
INFO
(
"======== CONFIGURE PROBLEM ======="
);
// Config file to parse. Here is where all the problem is defined:
// Config file to parse. Here is where all the problem is defined:
std
::
string
config_file
=
"demos/hello_wolf/yaml/hello_wolf_config.yaml"
;
std
::
string
config_file
=
"demos/hello_wolf/yaml/hello_wolf_config.yaml"
;
...
@@ -144,7 +144,7 @@ int main()
...
@@ -144,7 +144,7 @@ int main()
// APPLY PRIOR and SET PROCESSOR ODOM ORIGIN ===================================================
// APPLY PRIOR and SET PROCESSOR ODOM ORIGIN ===================================================
TimeStamp
t
(
0.0
);
TimeStamp
t
(
0.0
);
FrameBasePtr
KF1
=
problem
->
applyPriorOptions
(
t
);
FrameBasePtr
KF1
=
problem
->
applyPriorOptions
(
t
);
std
::
static_pointer_cast
<
ProcessorMotion
>
(
problem
->
getMotionProviderMap
().
begin
()
->
second
)
->
setOrigin
(
KF1
);
//
std::static_pointer_cast<ProcessorMotion>(problem->getMotionProviderMap().begin()->second)->setOrigin(KF1);
// SELF CALIBRATION ===================================================
// SELF CALIBRATION ===================================================
// These few lines control whether we calibrate some sensor parameters or not.
// These few lines control whether we calibrate some sensor parameters or not.
...
@@ -169,12 +169,16 @@ int main()
...
@@ -169,12 +169,16 @@ int main()
// SET OF EVENTS: make things happen =======================================================
// SET OF EVENTS: make things happen =======================================================
std
::
cout
<<
std
::
endl
;
std
::
cout
<<
std
::
endl
;
WOLF_
TRACE
(
"======== START ROBOT MOVE AND SLAM ======="
)
WOLF_
INFO
(
"======== START ROBOT MOVE AND SLAM ======="
)
// We'll do 3 steps of motion and landmark observations.
// We'll do 3 steps of motion and landmark observations.
// STEP 1 --------------------------------------------------------------
// STEP 1 --------------------------------------------------------------
// move zero motion to accept the first keyframe and initialize the processor
CaptureOdom2dPtr
cap_motion
=
std
::
make_shared
<
CaptureOdom2d
>
(
t
,
sensor_odo
,
0
*
motion_data
,
0
*
motion_cov
);
cap_motion
->
process
();
// KF1 : (0,0,0)
// observe lmks
// observe lmks
ids
.
resize
(
1
);
ranges
.
resize
(
1
);
bearings
.
resize
(
1
);
ids
.
resize
(
1
);
ranges
.
resize
(
1
);
bearings
.
resize
(
1
);
ids
<<
1
;
// will observe Lmk 1
ids
<<
1
;
// will observe Lmk 1
...
@@ -187,7 +191,7 @@ int main()
...
@@ -187,7 +191,7 @@ int main()
t
+=
1.0
;
// t : 1.0
t
+=
1.0
;
// t : 1.0
// motion
// motion
CaptureOdom2dPtr
cap_motion
=
std
::
make_shared
<
CaptureOdom2d
>
(
t
,
sensor_odo
,
motion_data
,
motion_cov
);
cap_motion
=
std
::
make_shared
<
CaptureOdom2d
>
(
t
,
sensor_odo
,
motion_data
,
motion_cov
);
cap_motion
->
process
();
// KF2 : (1,0,0)
cap_motion
->
process
();
// KF2 : (1,0,0)
// observe lmks
// observe lmks
...
@@ -220,40 +224,40 @@ int main()
...
@@ -220,40 +224,40 @@ int main()
// SOLVE ================================================================
// SOLVE ================================================================
// SOLVE with exact initial guess
// SOLVE with exact initial guess
WOLF_
TRACE
(
"======== SOLVE PROBLEM WITH EXACT PRIORS ======="
)
WOLF_
INFO
(
"======== SOLVE PROBLEM WITH EXACT PRIORS ======="
)
std
::
string
report
=
ceres
->
solve
(
wolf
::
SolverManager
::
ReportVerbosity
::
FULL
);
std
::
string
report
=
ceres
->
solve
(
wolf
::
SolverManager
::
ReportVerbosity
::
FULL
);
WOLF_
TRACE
(
report
);
// should show a very low iteration number (possibly 1)
WOLF_
INFO
(
report
);
// should show a very low iteration number (possibly 1)
problem
->
print
(
1
,
0
,
1
,
0
);
problem
->
print
(
1
,
0
,
1
,
0
);
// PERTURB initial guess
// PERTURB initial guess
WOLF_
TRACE
(
"======== PERTURB PROBLEM PRIORS ======="
)
WOLF_
INFO
(
"======== PERTURB PROBLEM PRIORS ======="
)
problem
->
perturb
(
0.5
);
// Perturb all state blocks that are not fixed
problem
->
perturb
(
0.5
);
// Perturb all state blocks that are not fixed
problem
->
print
(
1
,
0
,
1
,
0
);
problem
->
print
(
1
,
0
,
1
,
0
);
// SOLVE again
// SOLVE again
WOLF_
TRACE
(
"======== SOLVE PROBLEM WITH PERTURBED PRIORS ======="
)
WOLF_
INFO
(
"======== SOLVE PROBLEM WITH PERTURBED PRIORS ======="
)
report
=
ceres
->
solve
(
wolf
::
SolverManager
::
ReportVerbosity
::
FULL
);
report
=
ceres
->
solve
(
wolf
::
SolverManager
::
ReportVerbosity
::
FULL
);
WOLF_
TRACE
(
report
);
// should show a very high iteration number (more than 10, or than 100!)
WOLF_
INFO
(
report
);
// should show a very high iteration number (more than 10, or than 100!)
problem
->
print
(
1
,
0
,
1
,
0
);
problem
->
print
(
1
,
0
,
1
,
0
);
// GET COVARIANCES of all states
// GET COVARIANCES of all states
WOLF_
TRACE
(
"======== COVARIANCES OF SOLVED PROBLEM ======="
)
WOLF_
INFO
(
"======== COVARIANCES OF SOLVED PROBLEM ======="
)
ceres
->
computeCovariances
(
SolverManager
::
CovarianceBlocksToBeComputed
::
ALL_MARGINALS
);
ceres
->
computeCovariances
(
SolverManager
::
CovarianceBlocksToBeComputed
::
ALL_MARGINALS
);
for
(
auto
&
kf
:
*
problem
->
getTrajectory
())
for
(
auto
&
kf
:
*
problem
->
getTrajectory
())
{
{
Eigen
::
MatrixXd
cov
;
Eigen
::
MatrixXd
cov
;
kf
->
getCovariance
(
cov
);
kf
->
getCovariance
(
cov
);
WOLF_
TRACE
(
"KF"
,
kf
->
id
(),
"_cov =
\n
"
,
cov
);
WOLF_
INFO
(
"KF"
,
kf
->
id
(),
"_cov =
\n
"
,
cov
);
}
}
for
(
auto
&
lmk
:
problem
->
getMap
()
->
getLandmarkList
())
for
(
auto
&
lmk
:
problem
->
getMap
()
->
getLandmarkList
())
{
{
Eigen
::
MatrixXd
cov
;
Eigen
::
MatrixXd
cov
;
lmk
->
getCovariance
(
cov
);
lmk
->
getCovariance
(
cov
);
WOLF_
TRACE
(
"L"
,
lmk
->
id
(),
"_cov =
\n
"
,
cov
);
WOLF_
INFO
(
"L"
,
lmk
->
id
(),
"_cov =
\n
"
,
cov
);
}
}
std
::
cout
<<
std
::
endl
;
std
::
cout
<<
std
::
endl
;
WOLF_
TRACE
(
"======== FINAL PRINT FOR INTERPRETATION ======="
)
WOLF_
INFO
(
"======== FINAL PRINT FOR INTERPRETATION ======="
)
problem
->
print
(
4
,
1
,
1
,
1
);
problem
->
print
(
4
,
1
,
1
,
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