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
06c07ac6
Commit
06c07ac6
authored
3 years ago
by
Joan Solà Ortega
Browse files
Options
Downloads
Patches
Plain Diff
Use smart pointers in Prb::autoSetup
parent
9e561ff9
No related branches found
No related tags found
2 merge requests
!436
Release to start wolf public
,
!433
After 2nd RA-L submission
Pipeline
#8066
failed
3 years ago
Stage: license
Stage: build_and_test
Stage: deploy
Stage: final
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/problem/problem.cpp
+39
-33
39 additions, 33 deletions
src/problem/problem.cpp
with
39 additions
and
33 deletions
src/problem/problem.cpp
+
39
−
33
View file @
06c07ac6
...
...
@@ -113,35 +113,37 @@ ProblemPtr Problem::autoSetup(ParamsServer &_server)
#else
std
::
string
lib_extension
=
".so"
;
#endif
// Problem structure and dimension
std
::
string
frame_structure
=
_server
.
getParam
<
std
::
string
>
(
"problem/frame_structure"
);
int
dim
=
_server
.
getParam
<
int
>
(
"problem/dimension"
);
auto
problem
=
Problem
::
create
(
frame_structure
,
dim
);
//
// cout << "PRINTING SERVER MAP" << endl;
// _server.print();
// cout << "-----------------------------------" << endl;
int
dim
=
_server
.
getParam
<
int
>
(
"problem/dimension"
);
auto
problem
=
Problem
::
create
(
frame_structure
,
dim
);
WOLF_TRACE
(
"Setting up problem with frame structure {"
+
frame_structure
+
"} and dimension "
+
std
::
to_string
(
dim
)
+
"D"
);
// Load plugins
auto
loaders
=
std
::
vector
<
Loader
*
>
();
auto
loaders
=
std
::
vector
<
std
::
shared_ptr
<
Loader
>
>
();
std
::
string
plugins_path
;
try
{
plugins_path
=
_server
.
getParam
<
std
::
string
>
(
"plugins_path"
);
}
catch
(
MissingValueException
&
e
){
WOLF_WARN
(
e
.
what
());
WOLF_WARN
(
"Setting '/usr/local/lib/
iri-algorithms/
' as plugins path..."
);
plugins_path
=
"/usr/local/lib/
iri-algorithms/
"
;
WOLF_WARN
(
"Setting '/usr/local/lib/' as plugins path..."
);
plugins_path
=
"/usr/local/lib/"
;
}
for
(
auto
plugin_name
:
_server
.
getParam
<
std
::
vector
<
std
::
string
>>
(
"plugins"
))
{
for
(
auto
plugin_name
:
_server
.
getParam
<
std
::
vector
<
std
::
string
>>
(
"plugins"
))
{
if
(
plugin_name
==
"core"
or
plugin_name
==
"wolf"
or
plugin_name
==
""
)
continue
;
// ignore plugin "core"
std
::
string
plugin
=
plugins_path
+
"libwolf"
+
plugin_name
+
lib_extension
;
WOLF_TRACE
(
"Loading plugin "
+
plugin
);
auto
l
=
new
LoaderRaw
(
plugin
);
WOLF_TRACE
(
"Loading plugin "
+
plugin_name
+
" via "
+
plugin
);
auto
l
=
std
::
make_shared
<
LoaderRaw
>
(
plugin
);
l
->
load
();
loaders
.
push_back
(
l
);
}
// load Packages for subscribers and publishers
std
::
string
packages_path
;
try
{
packages_path
=
_server
.
getParam
<
std
::
string
>
(
"packages_path"
);
...
...
@@ -149,20 +151,22 @@ ProblemPtr Problem::autoSetup(ParamsServer &_server)
WOLF_WARN
(
e
.
what
());
WOLF_WARN
(
"Support for subscribers disabled..."
);
}
for
(
auto
it
:
_server
.
getParam
<
std
::
vector
<
std
::
string
>>
(
"packages_subscriber"
))
{
std
::
string
subscriber
=
packages_path
+
"/libsubscriber_"
+
it
+
lib_extension
;
WOLF_TRACE
(
"Loading subscriber "
+
subscriber
);
auto
l
=
new
LoaderRaw
(
subscriber
);
for
(
auto
subscriber_name
:
_server
.
getParam
<
std
::
vector
<
std
::
string
>>
(
"packages_subscriber"
))
{
std
::
string
subscriber
=
packages_path
+
"/libsubscriber_"
+
subscriber_name
+
lib_extension
;
WOLF_TRACE
(
"Loading subscriber "
+
subscriber_name
+
" via "
+
subscriber
);
auto
l
=
std
::
make_shared
<
LoaderRaw
>
(
subscriber
);
l
->
load
();
loaders
.
push_back
(
l
);
}
for
(
auto
it
:
_server
.
getParam
<
std
::
vector
<
std
::
string
>>
(
"packages_publisher"
))
{
std
::
string
s
ub
scrib
er
=
packages_path
+
"/libpublisher_"
+
it
+
lib_extension
;
WOLF_TRACE
(
"Loading publisher "
+
s
ub
scrib
er
);
auto
l
=
new
LoaderRaw
(
subscrib
er
);
for
(
auto
publisher_name
:
_server
.
getParam
<
std
::
vector
<
std
::
string
>>
(
"packages_publisher"
))
{
std
::
string
p
ub
lish
er
=
packages_path
+
"/libpublisher_"
+
publisher_name
+
lib_extension
;
WOLF_TRACE
(
"Loading publisher "
+
p
ub
lisher_name
+
" via "
+
publish
er
);
auto
l
=
std
::
make_shared
<
LoaderRaw
>
(
publish
er
);
l
->
load
();
loaders
.
push_back
(
l
);
}
// load raw libs
std
::
vector
<
std
::
string
>
raw_libs
;
try
{
raw_libs
=
_server
.
getParam
<
std
::
vector
<
std
::
string
>>
(
"raw_libs"
);
...
...
@@ -172,22 +176,25 @@ ProblemPtr Problem::autoSetup(ParamsServer &_server)
}
for
(
auto
lib
:
raw_libs
)
{
WOLF_TRACE
(
"Loading raw lib "
+
lib
);
auto
l
=
new
LoaderRaw
(
lib
);
auto
l
=
std
::
make_shared
<
LoaderRaw
>
(
lib
);
l
->
load
();
loaders
.
push_back
(
l
);
}
// Install sensors and processors
auto
sensorMap
=
std
::
map
<
std
::
string
,
SensorBasePtr
>
();
auto
procesorMap
=
std
::
map
<
std
::
string
,
ProcessorBasePtr
>
();
auto
sensors
=
_server
.
getParam
<
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>>
(
"sensors"
);
for
(
auto
sen
:
sensors
){
sensorMap
.
insert
(
std
::
pair
<
std
::
string
,
SensorBasePtr
>
(
sen
[
"name"
],
problem
->
installSensor
(
sen
[
"type"
],
sen
[
"name"
],
_server
)));
}
auto
processors
=
_server
.
getParam
<
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>>
(
"processors"
);
for
(
auto
prc
:
processors
){
procesorMap
.
insert
(
std
::
pair
<
std
::
string
,
ProcessorBasePtr
>
(
prc
[
"name"
],
problem
->
installProcessor
(
prc
[
"type"
],
prc
[
"name"
],
prc
[
"sensor_name"
],
_server
)));
}
auto
sensors
=
_server
.
getParam
<
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>>
(
"sensors"
);
for
(
auto
sen
:
sensors
)
problem
->
installSensor
(
sen
[
"type"
],
sen
[
"name"
],
_server
);
auto
processors
=
_server
.
getParam
<
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>>
(
"processors"
);
for
(
auto
prc
:
processors
)
problem
->
installProcessor
(
prc
[
"type"
],
prc
[
"name"
],
prc
[
"sensor_name"
],
_server
);
// Tree manager
std
::
string
tree_manager_type
=
_server
.
getParam
<
std
::
string
>
(
"problem/tree_manager/type"
);
...
...
@@ -195,7 +202,7 @@ ProblemPtr Problem::autoSetup(ParamsServer &_server)
if
(
tree_manager_type
!=
"None"
and
tree_manager_type
!=
"none"
)
problem
->
setTreeManager
(
AutoConfFactoryTreeManager
::
create
(
tree_manager_type
,
"tree manager"
,
_server
));
//
Prior
//
Set problem prior -- first keyframe
std
::
string
prior_mode
=
_server
.
getParam
<
std
::
string
>
(
"problem/prior/mode"
);
assert
((
prior_mode
==
"nothing"
||
prior_mode
==
"initial_guess"
||
prior_mode
==
"fix"
||
prior_mode
==
"factor"
)
&&
"wrong _mode value, it should be: 'nothing', 'initial_guess', 'fix' or 'factor'"
);
WOLF_TRACE
(
"Prior mode: "
,
prior_mode
);
...
...
@@ -214,7 +221,6 @@ ProblemPtr Problem::autoSetup(ParamsServer &_server)
}
else
{
WOLF_TRACE
(
"Prior mode: "
,
prior_mode
);
problem
->
setPriorOptions
(
prior_mode
,
_server
.
getParam
<
VectorComposite
>
(
"problem/prior/state"
));
}
...
...
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