Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lrs_util_nodelet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
lrs
lrs_util_nodelet
Commits
2edcaa47
Commit
2edcaa47
authored
3 years ago
by
Tommy Persson
Browse files
Options
Downloads
Patches
Plain Diff
Debug
parent
ebc76964
No related branches found
No related tags found
No related merge requests found
Pipeline
#50581
passed
3 years ago
Stage: build
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/nodeletserver.cc
+4
-39
4 additions, 39 deletions
src/nodeletserver.cc
src/nodeletutil.cc
+44
-1
44 additions, 1 deletion
src/nodeletutil.cc
src/nodeletutil.h
+2
-0
2 additions, 0 deletions
src/nodeletutil.h
with
50 additions
and
40 deletions
src/nodeletserver.cc
+
4
−
39
View file @
2edcaa47
...
@@ -30,48 +30,13 @@ bool nodelet_exists_service (lrs_msgs_common::NodeletExists::Request &req,
...
@@ -30,48 +30,13 @@ bool nodelet_exists_service (lrs_msgs_common::NodeletExists::Request &req,
return
true
;
return
true
;
}
}
std
::
string
nodelet_type
;
bool
res
=
basic_nodelet_exists
(
req
.
pkg
,
req
.
tst_type
,
nodelet_type
);
response
.
nodelet_type
=
nodelet_type
;
std
::
string
package
=
req
.
pkg
;
std
::
string
package
=
req
.
pkg
;
std
::
string
name
=
req
.
tst_type
;
std
::
string
name
=
req
.
tst_type
;
std
::
string
path
=
ros
::
package
::
getPath
(
package
);
// ROS_ERROR("PATH: %s", path.c_str());
std
::
string
filename
=
path
+
"/nodelet_plugins.xml"
;
TiXmlDocument
doc
(
filename
);
doc
.
LoadFile
();
TiXmlNode
*
node
=
&
doc
;
node
=
node
->
FirstChild
();
// library level
TiXmlNode
*
child
;
bool
res
=
false
;
for
(
child
=
node
->
FirstChild
();
child
!=
0
;
child
=
child
->
NextSibling
())
{
// child id class element
TiXmlAttribute
*
attrib
=
child
->
ToElement
()
->
FirstAttribute
();
while
(
attrib
)
{
std
::
string
elname
=
std
::
string
(
attrib
->
Name
());
std
::
string
value
=
std
::
string
(
attrib
->
Value
());
if
(
elname
==
"name"
)
{
std
::
string
suffix
=
value
.
substr
(
value
.
find
(
"/"
)
+
1
);
// ROS_INFO("CLASS ATTR: %s - %s - %s", attrib->Name(), attrib->Value(), suffix.c_str());
if
(
suffix
==
name
)
{
res
=
true
;
response
.
nodelet_type
=
value
;
break
;
}
}
attrib
=
attrib
->
Next
();
}
if
(
res
)
{
break
;
}
}
response
.
success
=
res
;
response
.
success
=
res
;
return
true
;
return
true
;
...
...
This diff is collapsed.
Click to expand it.
src/nodeletutil.cc
+
44
−
1
View file @
2edcaa47
...
@@ -36,6 +36,49 @@ bool nodelet_exists(std::string package, std::string name, std::string & nodelet
...
@@ -36,6 +36,49 @@ bool nodelet_exists(std::string package, std::string name, std::string & nodelet
return
res
;
return
res
;
}
}
bool
basic_nodelet_exists
(
std
::
string
package
,
std
::
string
name
,
std
::
string
&
nodelet_name
)
{
std
::
string
path
=
ros
::
package
::
getPath
(
package
);
// ROS_ERROR("PATH: %s", path.c_str());
std
::
string
filename
=
path
+
"/nodelet_plugins.xml"
;
TiXmlDocument
doc
(
filename
);
doc
.
LoadFile
();
TiXmlNode
*
node
=
&
doc
;
node
=
node
->
FirstChild
();
// library level
TiXmlNode
*
child
;
bool
res
=
false
;
for
(
child
=
node
->
FirstChild
();
child
!=
0
;
child
=
child
->
NextSibling
())
{
// child id class element
TiXmlAttribute
*
attrib
=
child
->
ToElement
()
->
FirstAttribute
();
while
(
attrib
)
{
std
::
string
elname
=
std
::
string
(
attrib
->
Name
());
std
::
string
value
=
std
::
string
(
attrib
->
Value
());
if
(
elname
==
"name"
)
{
std
::
string
suffix
=
value
.
substr
(
value
.
find
(
"/"
)
+
1
);
// ROS_INFO("CLASS ATTR: %s - %s - %s", attrib->Name(), attrib->Value(), suffix.c_str());
if
(
suffix
==
name
)
{
res
=
true
;
nodelet_name
=
value
;
break
;
}
}
attrib
=
attrib
->
Next
();
}
if
(
res
)
{
break
;
}
}
return
res
;
}
void
load_nodelet_for_service
(
ros
::
ServiceClient
client
,
std
::
string
tst_type
)
{
void
load_nodelet_for_service
(
ros
::
ServiceClient
client
,
std
::
string
tst_type
)
{
ROS_INFO
(
"nodeletutil load_nodelet_for_service: %s"
,
tst_type
.
c_str
());
ROS_INFO
(
"nodeletutil load_nodelet_for_service: %s"
,
tst_type
.
c_str
());
if
(
!
client
.
exists
())
{
if
(
!
client
.
exists
())
{
...
@@ -91,7 +134,7 @@ bool load_nodelet(std::vector<std::string> pkgs, std::string tst_type) {
...
@@ -91,7 +134,7 @@ bool load_nodelet(std::vector<std::string> pkgs, std::string tst_type) {
bool
load_nodelet
(
std
::
string
pkg
,
std
::
string
tst_type
)
{
bool
load_nodelet
(
std
::
string
pkg
,
std
::
string
tst_type
)
{
ROS_ERROR
(
"nodeletutil load_nodelet3: %s - %s"
,
pkg
.
c_str
(),
tst_type
.
c_str
());
ROS_ERROR
(
"nodeletutil load_nodelet3: %s - %s"
,
pkg
.
c_str
(),
tst_type
.
c_str
());
std
::
string
nodelet_type
;
std
::
string
nodelet_type
;
if
(
nodelet_exists
(
pkg
,
tst_type
,
nodelet_type
))
{
if
(
basic_
nodelet_exists
(
pkg
,
tst_type
,
nodelet_type
))
{
std
::
string
ns
=
ros
::
names
::
clean
(
ros
::
this_node
::
getNamespace
());
std
::
string
ns
=
ros
::
names
::
clean
(
ros
::
this_node
::
getNamespace
());
std
::
string
nodelet_name
=
ns
+
"/"
+
tst_type
;
std
::
string
nodelet_name
=
ns
+
"/"
+
tst_type
;
std
::
string
manager
=
pkg
+
"_manager"
;
std
::
string
manager
=
pkg
+
"_manager"
;
...
...
This diff is collapsed.
Click to expand it.
src/nodeletutil.h
+
2
−
0
View file @
2edcaa47
...
@@ -7,6 +7,8 @@
...
@@ -7,6 +7,8 @@
bool
nodelet_exists
(
std
::
string
package
,
std
::
string
name
,
std
::
string
&
nodelet_name
);
bool
nodelet_exists
(
std
::
string
package
,
std
::
string
name
,
std
::
string
&
nodelet_name
);
bool
basic_nodelet_exists
(
std
::
string
package
,
std
::
string
name
,
std
::
string
&
nodelet_name
);
bool
load_nodelet
(
std
::
string
tst_type
);
bool
load_nodelet
(
std
::
string
tst_type
);
bool
load_nodelet
(
std
::
vector
<
std
::
string
>
pkgs
,
std
::
string
tst_type
);
bool
load_nodelet
(
std
::
vector
<
std
::
string
>
pkgs
,
std
::
string
tst_type
);
bool
load_nodelet
(
std
::
string
pkg
,
std
::
string
tst_type
);
bool
load_nodelet
(
std
::
string
pkg
,
std
::
string
tst_type
);
...
...
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