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
43fa081e
Commit
43fa081e
authored
5 years ago
by
Joaquim Casals Buñuel
Browse files
Options
Downloads
Patches
Plain Diff
Added better suport for plugins and subscribers path input
parent
3ab2283b
No related branches found
No related tags found
No related merge requests found
Pipeline
#4417
passed
5 years ago
Stage: build
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/core/utils/loader.hpp
+2
-0
2 additions, 0 deletions
include/core/utils/loader.hpp
include/core/yaml/parser_yaml.hpp
+25
-12
25 additions, 12 deletions
include/core/yaml/parser_yaml.hpp
src/problem/problem.cpp
+15
-5
15 additions, 5 deletions
src/problem/problem.cpp
with
42 additions
and
17 deletions
include/core/utils/loader.hpp
+
2
−
0
View file @
43fa081e
#ifndef LOADER_HPP
#ifndef LOADER_HPP
#define LOADER_HPP
#define LOADER_HPP
#include
<dlfcn.h>
#include
<dlfcn.h>
#include
<string>
#include
<stdexcept>
class
Loader
{
class
Loader
{
protected:
protected:
std
::
string
path_
;
std
::
string
path_
;
...
...
This diff is collapsed.
Click to expand it.
include/core/yaml/parser_yaml.hpp
+
25
−
12
View file @
43fa081e
...
@@ -180,7 +180,8 @@ class ParserYAML {
...
@@ -180,7 +180,8 @@ class ParserYAML {
std
::
string
_active_name
;
std
::
string
_active_name
;
std
::
vector
<
ParamsInitSensor
>
_paramsSens
;
std
::
vector
<
ParamsInitSensor
>
_paramsSens
;
std
::
vector
<
ParamsInitProcessor
>
_paramsProc
;
std
::
vector
<
ParamsInitProcessor
>
_paramsProc
;
std
::
vector
<
std
::
string
>
_files
;
std
::
vector
<
std
::
string
>
_plugins
;
std
::
vector
<
std
::
string
>
_subscribers
;
std
::
stack
<
std
::
string
>
_parsing_file
;
std
::
stack
<
std
::
string
>
_parsing_file
;
std
::
string
_file
;
std
::
string
_file
;
bool
_relative_path
;
bool
_relative_path
;
...
@@ -197,7 +198,8 @@ public:
...
@@ -197,7 +198,8 @@ public:
_paramsSens
=
std
::
vector
<
ParamsInitSensor
>
();
_paramsSens
=
std
::
vector
<
ParamsInitSensor
>
();
_paramsProc
=
std
::
vector
<
ParamsInitProcessor
>
();
_paramsProc
=
std
::
vector
<
ParamsInitProcessor
>
();
_file
=
""
;
_file
=
""
;
_files
=
std
::
vector
<
std
::
string
>
();
_plugins
=
std
::
vector
<
std
::
string
>
();
_subscribers
=
std
::
vector
<
std
::
string
>
();
_parsing_file
=
std
::
stack
<
std
::
string
>
();
_parsing_file
=
std
::
stack
<
std
::
string
>
();
_path_root
=
""
;
_path_root
=
""
;
_relative_path
=
false
;
_relative_path
=
false
;
...
@@ -208,7 +210,8 @@ public:
...
@@ -208,7 +210,8 @@ public:
_active_name
=
""
;
_active_name
=
""
;
_paramsSens
=
std
::
vector
<
ParamsInitSensor
>
();
_paramsSens
=
std
::
vector
<
ParamsInitSensor
>
();
_paramsProc
=
std
::
vector
<
ParamsInitProcessor
>
();
_paramsProc
=
std
::
vector
<
ParamsInitProcessor
>
();
_files
=
std
::
vector
<
std
::
string
>
();
_plugins
=
std
::
vector
<
std
::
string
>
();
_subscribers
=
std
::
vector
<
std
::
string
>
();
_parsing_file
=
std
::
stack
<
std
::
string
>
();
_parsing_file
=
std
::
stack
<
std
::
string
>
();
_file
=
file
;
_file
=
file
;
_path_root
=
""
;
_path_root
=
""
;
...
@@ -220,7 +223,8 @@ public:
...
@@ -220,7 +223,8 @@ public:
_active_name
=
""
;
_active_name
=
""
;
_paramsSens
=
std
::
vector
<
ParamsInitSensor
>
();
_paramsSens
=
std
::
vector
<
ParamsInitSensor
>
();
_paramsProc
=
std
::
vector
<
ParamsInitProcessor
>
();
_paramsProc
=
std
::
vector
<
ParamsInitProcessor
>
();
_files
=
std
::
vector
<
std
::
string
>
();
_plugins
=
std
::
vector
<
std
::
string
>
();
_subscribers
=
std
::
vector
<
std
::
string
>
();
_parsing_file
=
std
::
stack
<
std
::
string
>
();
_parsing_file
=
std
::
stack
<
std
::
string
>
();
_file
=
file
;
_file
=
file
;
if
(
path_root
!=
""
){
if
(
path_root
!=
""
){
...
@@ -245,12 +249,13 @@ public:
...
@@ -245,12 +249,13 @@ public:
std
::
string
tagsToString
(
std
::
vector
<
std
::
string
>&
tags
);
std
::
string
tagsToString
(
std
::
vector
<
std
::
string
>&
tags
);
std
::
vector
<
std
::
array
<
std
::
string
,
2
>>
sensorsSerialization
();
std
::
vector
<
std
::
array
<
std
::
string
,
2
>>
sensorsSerialization
();
std
::
vector
<
std
::
array
<
std
::
string
,
3
>>
processorsSerialization
();
std
::
vector
<
std
::
array
<
std
::
string
,
3
>>
processorsSerialization
();
std
::
vector
<
std
::
string
>
getFiles
();
std
::
vector
<
std
::
string
>
getPlugins
();
std
::
vector
<
std
::
string
>
getSubscribers
();
std
::
vector
<
std
::
array
<
std
::
string
,
3
>>
getCallbacks
();
std
::
vector
<
std
::
array
<
std
::
string
,
3
>>
getCallbacks
();
std
::
vector
<
std
::
array
<
std
::
string
,
2
>>
getProblem
();
std
::
vector
<
std
::
array
<
std
::
string
,
2
>>
getProblem
();
std
::
map
<
std
::
string
,
std
::
string
>
getParams
();
std
::
map
<
std
::
string
,
std
::
string
>
getParams
();
void
parse
();
void
parse
();
void
parse_freely
();
void
parse_freely
();
};
};
std
::
string
ParserYAML
::
generatePath
(
std
::
string
path
){
std
::
string
ParserYAML
::
generatePath
(
std
::
string
path
){
std
::
regex
r
(
"^/.*"
);
std
::
regex
r
(
"^/.*"
);
...
@@ -413,11 +418,16 @@ void ParserYAML::parseFirstLevel(std::string file){
...
@@ -413,11 +418,16 @@ void ParserYAML::parseFirstLevel(std::string file){
for
(
const
auto
&
kv
:
n_config
[
"callbacks"
]){
for
(
const
auto
&
kv
:
n_config
[
"callbacks"
]){
_callbacks
.
push_back
({{
kv
[
0
].
as
<
std
::
string
>
(),
kv
[
1
].
as
<
std
::
string
>
(),
kv
[
2
].
as
<
std
::
string
>
()}});
_callbacks
.
push_back
({{
kv
[
0
].
as
<
std
::
string
>
(),
kv
[
1
].
as
<
std
::
string
>
(),
kv
[
2
].
as
<
std
::
string
>
()}});
}
}
YAML
::
Node
n_
file
s
=
n
[
"
file
s"
];
YAML
::
Node
n_
plugin
s
=
n
[
"
plugin
s"
];
for
(
const
auto
&
kv
:
n_
file
s
){
for
(
const
auto
&
kv
:
n_
plugin
s
){
_
file
s
.
push_back
(
kv
.
Scalar
());
_
plugin
s
.
push_back
(
kv
.
Scalar
());
}
}
insert_register
(
"files"
,
wolf
::
converter
<
std
::
string
>::
convert
(
_files
));
insert_register
(
"plugins"
,
wolf
::
converter
<
std
::
string
>::
convert
(
_plugins
));
YAML
::
Node
n_subscribers
=
n
[
"subscribers"
];
for
(
const
auto
&
kv
:
n_subscribers
)
{
_subscribers
.
push_back
(
kv
.
Scalar
());
}
insert_register
(
"subscribers"
,
wolf
::
converter
<
std
::
string
>::
convert
(
_subscribers
));
// _params.insert(std::pair<std::string,std::string>);
// _params.insert(std::pair<std::string,std::string>);
}
}
std
::
vector
<
std
::
array
<
std
::
string
,
2
>>
ParserYAML
::
sensorsSerialization
(){
std
::
vector
<
std
::
array
<
std
::
string
,
2
>>
ParserYAML
::
sensorsSerialization
(){
...
@@ -432,8 +442,11 @@ std::vector<std::array<std::string, 3>> ParserYAML::processorsSerialization(){
...
@@ -432,8 +442,11 @@ std::vector<std::array<std::string, 3>> ParserYAML::processorsSerialization(){
aux
.
push_back
({{
it
.
_type
,
it
.
_name
,
it
.
_name_assoc_sensor
}});
aux
.
push_back
({{
it
.
_type
,
it
.
_name
,
it
.
_name_assoc_sensor
}});
return
aux
;
return
aux
;
}
}
std
::
vector
<
std
::
string
>
ParserYAML
::
getFiles
(){
std
::
vector
<
std
::
string
>
ParserYAML
::
getPlugins
(){
return
this
->
_files
;
return
this
->
_plugins
;
}
std
::
vector
<
std
::
string
>
ParserYAML
::
getSubscribers
()
{
return
this
->
_subscribers
;
}
}
std
::
vector
<
std
::
array
<
std
::
string
,
3
>>
ParserYAML
::
getCallbacks
(){
std
::
vector
<
std
::
array
<
std
::
string
,
3
>>
ParserYAML
::
getCallbacks
(){
return
this
->
_callbacks
;
return
this
->
_callbacks
;
...
...
This diff is collapsed.
Click to expand it.
src/problem/problem.cpp
+
15
−
5
View file @
43fa081e
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
// C++ includes
// C++ includes
#include
<algorithm>
#include
<algorithm>
#include
<map>
#include
<map>
#include
<string>
#include
<vector>
#include
<vector>
namespace
wolf
namespace
wolf
...
@@ -87,9 +88,19 @@ ProblemPtr Problem::autoSetup(ParamsServer &_server)
...
@@ -87,9 +88,19 @@ ProblemPtr Problem::autoSetup(ParamsServer &_server)
// Load plugins
// Load plugins
auto
loaders
=
std
::
vector
<
Loader
*>
();
auto
loaders
=
std
::
vector
<
Loader
*>
();
for
(
auto
it
:
_server
.
getParam
<
std
::
vector
<
std
::
string
>>
(
"files"
))
{
auto
plugins_path
=
_server
.
getParam
<
std
::
string
>
(
"plugins_path"
);
WOLF_TRACE
(
"Loading file "
+
it
)
for
(
auto
it
:
_server
.
getParam
<
std
::
vector
<
std
::
string
>>
(
"plugins"
))
{
auto
l
=
new
LoaderRaw
(
it
);
std
::
string
plugin
=
plugins_path
+
"libwolf"
+
it
+
".so"
;
WOLF_TRACE
(
"Loading plugin "
+
plugin
);
auto
l
=
new
LoaderRaw
(
plugin
);
l
->
load
();
loaders
.
push_back
(
l
);
}
auto
subscribers_path
=
_server
.
getParam
<
std
::
string
>
(
"subscribers_path"
);
for
(
auto
it
:
_server
.
getParam
<
std
::
vector
<
std
::
string
>>
(
"subscribers"
))
{
std
::
string
subscriber
=
subscribers_path
+
"libwolf_subscriber_"
+
it
+
".so"
;
WOLF_TRACE
(
"Loading subscriber "
+
subscriber
);
auto
l
=
new
LoaderRaw
(
subscriber
);
l
->
load
();
l
->
load
();
loaders
.
push_back
(
l
);
loaders
.
push_back
(
l
);
}
}
...
@@ -121,8 +132,7 @@ ProblemPtr Problem::autoSetup(ParamsServer &_server)
...
@@ -121,8 +132,7 @@ ProblemPtr Problem::autoSetup(ParamsServer &_server)
// Done
// Done
return
problem
;
return
problem
;
}
}
Problem
::~
Problem
()
Problem
::~
Problem
()
{
{
...
...
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