Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
dynamic_graph_bridge
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
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
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
Stack Of Tasks
dynamic_graph_bridge
Commits
8eb39ab9
Commit
8eb39ab9
authored
4 years ago
by
Joseph Mirabel
Browse files
Options
Downloads
Patches
Plain Diff
Clean RosPublish commands.
parent
7f756489
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/ros_publish-python-module-py.cc
+6
-1
6 additions, 1 deletion
src/ros_publish-python-module-py.cc
src/ros_publish.cpp
+4
-57
4 additions, 57 deletions
src/ros_publish.cpp
src/ros_publish.hh
+1
-4
1 addition, 4 deletions
src/ros_publish.hh
with
11 additions
and
62 deletions
src/ros_publish-python-module-py.cc
+
6
−
1
View file @
8eb39ab9
...
@@ -8,5 +8,10 @@ BOOST_PYTHON_MODULE(wrap)
...
@@ -8,5 +8,10 @@ BOOST_PYTHON_MODULE(wrap)
{
{
bp
::
import
(
"dynamic_graph"
);
bp
::
import
(
"dynamic_graph"
);
dg
::
python
::
exposeEntity
<
dg
::
RosPublish
,
bp
::
bases
<
dg
::
Entity
>
,
dg
::
python
::
AddCommands
>
()
;
dg
::
python
::
exposeEntity
<
dg
::
RosPublish
,
bp
::
bases
<
dg
::
Entity
>
,
dg
::
python
::
AddCommands
>
()
.
def
(
"clear"
,
&
dg
::
RosPublish
::
clear
,
"Remove all signals writing data to a ROS topic"
)
.
def
(
"rm"
,
&
dg
::
RosPublish
::
rm
,
"Remove a signal writing data to a ROS topic"
,
bp
::
args
(
"signal_name"
))
.
def
(
"list"
,
&
dg
::
RosPublish
::
list
,
"List signals writing data to a ROS topic"
)
;
}
}
This diff is collapsed.
Click to expand it.
src/ros_publish.cpp
+
4
−
57
View file @
8eb39ab9
...
@@ -28,23 +28,6 @@ const double RosPublish::ROS_JOINT_STATE_PUBLISHER_RATE = 0.01;
...
@@ -28,23 +28,6 @@ const double RosPublish::ROS_JOINT_STATE_PUBLISHER_RATE = 0.01;
namespace
command
{
namespace
command
{
namespace
rosPublish
{
namespace
rosPublish
{
Clear
::
Clear
(
RosPublish
&
entity
,
const
std
::
string
&
docstring
)
:
Command
(
entity
,
std
::
vector
<
Value
::
Type
>
(),
docstring
)
{}
Value
Clear
::
doExecute
()
{
RosPublish
&
entity
=
static_cast
<
RosPublish
&>
(
owner
());
entity
.
clear
();
return
Value
();
}
List
::
List
(
RosPublish
&
entity
,
const
std
::
string
&
docstring
)
:
Command
(
entity
,
std
::
vector
<
Value
::
Type
>
(),
docstring
)
{}
Value
List
::
doExecute
()
{
RosPublish
&
entity
=
static_cast
<
RosPublish
&>
(
owner
());
return
Value
(
entity
.
list
());
}
Add
::
Add
(
RosPublish
&
entity
,
const
std
::
string
&
docstring
)
Add
::
Add
(
RosPublish
&
entity
,
const
std
::
string
&
docstring
)
:
Command
(
entity
,
boost
::
assign
::
list_of
(
Value
::
STRING
)(
Value
::
STRING
)(
Value
::
STRING
),
docstring
)
{}
:
Command
(
entity
,
boost
::
assign
::
list_of
(
Value
::
STRING
)(
Value
::
STRING
)(
Value
::
STRING
),
docstring
)
{}
...
@@ -88,16 +71,6 @@ Value Add::doExecute() {
...
@@ -88,16 +71,6 @@ Value Add::doExecute() {
return
Value
();
return
Value
();
}
}
Rm
::
Rm
(
RosPublish
&
entity
,
const
std
::
string
&
docstring
)
:
Command
(
entity
,
boost
::
assign
::
list_of
(
Value
::
STRING
),
docstring
)
{}
Value
Rm
::
doExecute
()
{
RosPublish
&
entity
=
static_cast
<
RosPublish
&>
(
owner
());
std
::
vector
<
Value
>
values
=
getParameterValues
();
const
std
::
string
&
signal
=
values
[
0
].
value
();
entity
.
rm
(
signal
);
return
Value
();
}
}
// namespace rosPublish
}
// namespace rosPublish
}
// end of namespace command.
}
// end of namespace command.
...
@@ -143,29 +116,6 @@ RosPublish::RosPublish(const std::string& n)
...
@@ -143,29 +116,6 @@ RosPublish::RosPublish(const std::string& n)
" - topic: the topic name in ROS.
\n
"
" - topic: the topic name in ROS.
\n
"
"
\n
"
;
"
\n
"
;
addCommand
(
"add"
,
new
command
::
rosPublish
::
Add
(
*
this
,
docstring
));
addCommand
(
"add"
,
new
command
::
rosPublish
::
Add
(
*
this
,
docstring
));
docstring
=
"
\n
"
" Remove a signal writing data to a ROS topic
\n
"
"
\n
"
" Input:
\n
"
" - name of the signal to remove (see method list for the list of "
"signals).
\n
"
"
\n
"
;
addCommand
(
"rm"
,
new
command
::
rosPublish
::
Rm
(
*
this
,
docstring
));
docstring
=
"
\n
"
" Remove all signals writing data to a ROS topic
\n
"
"
\n
"
" No input:
\n
"
"
\n
"
;
addCommand
(
"clear"
,
new
command
::
rosPublish
::
Clear
(
*
this
,
docstring
));
docstring
=
"
\n
"
" List signals writing data to a ROS topic
\n
"
"
\n
"
" No input:
\n
"
"
\n
"
;
addCommand
(
"list"
,
new
command
::
rosPublish
::
List
(
*
this
,
docstring
));
}
}
RosPublish
::~
RosPublish
()
{
aofs_
.
close
();
}
RosPublish
::~
RosPublish
()
{
aofs_
.
close
();
}
...
@@ -187,13 +137,10 @@ void RosPublish::rm(const std::string& signal) {
...
@@ -187,13 +137,10 @@ void RosPublish::rm(const std::string& signal) {
bindedSignal_
.
erase
(
signal
);
bindedSignal_
.
erase
(
signal
);
}
}
std
::
string
RosPublish
::
list
()
const
{
std
::
vector
<
std
::
string
>
RosPublish
::
list
()
const
{
std
::
string
result
(
"["
);
std
::
vector
<
std
::
string
>
result
(
bindedSignal_
.
size
());
for
(
std
::
map
<
std
::
string
,
bindedSignal_t
>::
const_iterator
it
=
bindedSignal_
.
begin
();
it
!=
bindedSignal_
.
end
();
std
::
transform
(
bindedSignal_
.
begin
(),
bindedSignal_
.
end
(),
it
++
)
{
result
.
begin
(),
[](
const
auto
&
pair
)
{
return
pair
.
first
;
});
result
+=
"'"
+
it
->
first
+
"',"
;
}
result
+=
"]"
;
return
result
;
return
result
;
}
}
...
...
This diff is collapsed.
Click to expand it.
src/ros_publish.hh
+
1
−
4
View file @
8eb39ab9
...
@@ -34,9 +34,6 @@ using ::dynamicgraph::command::Value;
...
@@ -34,9 +34,6 @@ using ::dynamicgraph::command::Value;
}
}
ROS_PUBLISH_MAKE_COMMAND
(
Add
);
ROS_PUBLISH_MAKE_COMMAND
(
Add
);
ROS_PUBLISH_MAKE_COMMAND
(
Clear
);
ROS_PUBLISH_MAKE_COMMAND
(
List
);
ROS_PUBLISH_MAKE_COMMAND
(
Rm
);
#undef ROS_PUBLISH_MAKE_COMMAND
#undef ROS_PUBLISH_MAKE_COMMAND
...
@@ -62,7 +59,7 @@ class RosPublish : public dynamicgraph::Entity {
...
@@ -62,7 +59,7 @@ class RosPublish : public dynamicgraph::Entity {
void
add
(
const
std
::
string
&
signal
,
const
std
::
string
&
topic
);
void
add
(
const
std
::
string
&
signal
,
const
std
::
string
&
topic
);
void
rm
(
const
std
::
string
&
signal
);
void
rm
(
const
std
::
string
&
signal
);
std
::
string
list
()
const
;
std
::
vector
<
std
::
string
>
list
()
const
;
void
clear
();
void
clear
();
int
&
trigger
(
int
&
,
int
);
int
&
trigger
(
int
&
,
int
);
...
...
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