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
6014f830
Commit
6014f830
authored
14 years ago
by
Thomas Moulard
Browse files
Options
Downloads
Patches
Plain Diff
Add export node.
parent
ca40117b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
CMakeLists.txt
+14
-2
14 additions, 2 deletions
CMakeLists.txt
src/ros_export.cpp
+105
-0
105 additions, 0 deletions
src/ros_export.cpp
src/ros_export.hh
+48
-0
48 additions, 0 deletions
src/ros_export.hh
src/ros_export.hxx
+16
-0
16 additions, 0 deletions
src/ros_export.hxx
with
183 additions
and
2 deletions
CMakeLists.txt
+
14
−
2
View file @
6014f830
cmake_minimum_required
(
VERSION 2.4.6
)
include
(
$ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake
)
include
(
FindPkgConfig
)
# Set the build type. Options are:
# Coverage : w/ debug symbols, w/o optimization, w/ code-coverage
# Debug : w/ debug symbols, w/o optimization
...
...
@@ -29,7 +31,17 @@ rosbuild_genmsg()
#rosbuild_add_executable(example examples/example.cpp)
#target_link_libraries(example ${PROJECT_NAME})
pkg_check_modules
(
JRL_MAL REQUIRED jrl-mal
)
pkg_check_modules
(
DYNAMIC_GRAPH REQUIRED dynamic-graph
)
rosbuild_add_library
(
ros_import src/ros_import.cpp
)
target_link_libraries
(
ros_import dynamic-graph
)
rosbuild_add_compile_flags
(
ros_import
${
JRL_MAL_CFLAGS
}
${
DYNAMIC_GRAPH_CFLAGS
}
)
rosbuild_add_link_flags
(
ros_import
${
JRL_MAL_LDFLAGS
}
${
DYNAMIC_GRAPH_LDFLAGS
}
)
target_link_libraries
(
ros_import
${
JRL_MAL_LIBRARIES
}
${
DYNAMIC_GRAPH_LIBRARIES
}
)
# rosbuild_add_library(sot_to_ros src/sot_to_ros.cpp)
rosbuild_add_library
(
ros_export src/ros_export.cpp
)
rosbuild_add_compile_flags
(
ros_export
${
JRL_MAL_CFLAGS
}
${
DYNAMIC_GRAPH_CFLAGS
}
)
rosbuild_add_link_flags
(
ros_export
${
JRL_MAL_LDFLAGS
}
${
DYNAMIC_GRAPH_LDFLAGS
}
)
target_link_libraries
(
ros_export
${
JRL_MAL_LIBRARIES
}
${
DYNAMIC_GRAPH_LIBRARIES
}
)
This diff is collapsed.
Click to expand it.
src/ros_export.cpp
0 → 100644
+
105
−
0
View file @
6014f830
#include
<boost/bind.hpp>
#include
<boost/format.hpp>
#include
<boost/function.hpp>
#include
<boost/make_shared.hpp>
#include
<ros/ros.h>
#include
<std_msgs/Float64.h>
#include
<dynamic-graph/factory.h>
#include
"ros_export.hh"
namespace
dynamicgraph
{
DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN
(
RosExport
,
"RosExport"
);
const
char
*
rosInit
()
{
int
argc
=
1
;
char
*
arg0
=
strdup
(
"ros_export"
);
char
*
argv
[]
=
{
arg0
,
0
};
ros
::
init
(
argc
,
argv
,
"ros_export"
);
free
(
arg0
);
return
"dynamic_graph"
;
}
RosExport
::
RosExport
(
const
std
::
string
&
n
)
:
dynamicgraph
::
Entity
(
n
),
nh_
(
rosInit
()),
bindedSignal_
()
{
}
RosExport
::~
RosExport
()
{
}
void
RosExport
::
display
(
std
::
ostream
&
os
)
const
{
os
<<
CLASS_NAME
<<
std
::
endl
;
}
void
RosExport
::
commandLine
(
const
std
::
string
&
cmdLine
,
std
::
istringstream
&
cmdArgs
,
std
::
ostream
&
os
)
{
std
::
string
type
;
std
::
string
signal
;
std
::
string
topic
;
if
(
cmdLine
==
"help"
)
{
os
<<
"RosExport: "
<<
std
::
endl
<<
" - add <TYPE> <SIGNAL> <TOPIC>"
<<
std
::
endl
<<
" - rm <SIGNAL>"
<<
std
::
endl
<<
" - clear"
<<
std
::
endl
<<
" - list"
<<
std
::
endl
;
Entity
::
commandLine
(
cmdLine
,
cmdArgs
,
os
);
}
else
if
(
cmdLine
==
"add"
)
{
cmdArgs
>>
type
>>
signal
>>
topic
;
if
(
type
==
"double"
)
;
else
if
(
type
==
"matrix"
)
;
else
if
(
type
==
"vector"
)
;
else
throw
"bad type"
;
}
else
if
(
cmdLine
==
"rm"
)
{
cmdArgs
>>
signal
;
rm
(
signal
);
}
else
if
(
cmdLine
==
"clear"
)
clear
();
else
if
(
cmdLine
==
"list"
)
list
();
else
Entity
::
commandLine
(
cmdLine
,
cmdArgs
,
os
);
}
const
std
::
string
&
RosExport
::
getClassName
()
{
return
CLASS_NAME
;
}
void
RosExport
::
rm
(
const
std
::
string
&
signal
)
{
bindedSignal_
.
erase
(
signal
);
}
void
RosExport
::
list
()
{
std
::
cout
<<
CLASS_NAME
<<
std
::
endl
;
}
void
RosExport
::
clear
()
{
bindedSignal_
.
clear
();
}
}
// end of namespace dynamicgraph.
This diff is collapsed.
Click to expand it.
src/ros_export.hh
0 → 100644
+
48
−
0
View file @
6014f830
#ifndef DYNAMIC_GRAPH_ROS_EXPORT_HH
# define DYNAMIC_GRAPH_ROS_EXPORT_HH
# include <iostream>
# include <map>
# include <boost/shared_ptr.hpp>
# include <dynamic-graph/entity.h>
# include <dynamic-graph/signal-time-dependent.h>
# include <ros/ros.h>
namespace
dynamicgraph
{
class
RosExport
:
public
dynamicgraph
::
Entity
{
public:
typedef
std
::
pair
<
boost
::
shared_ptr
<
dynamicgraph
::
SignalBase
<
int
>
>
,
boost
::
shared_ptr
<
ros
::
Publisher
>
>
bindedSignal_t
;
static
const
std
::
string
CLASS_NAME
;
RosExport
(
const
std
::
string
&
n
);
virtual
~
RosExport
();
void
display
(
std
::
ostream
&
os
)
const
;
virtual
void
commandLine
(
const
std
::
string
&
cmdLine
,
std
::
istringstream
&
cmdArgs
,
std
::
ostream
&
os
);
virtual
const
std
::
string
&
getClassName
();
private:
void
add
(
const
std
::
string
&
signal
,
const
std
::
string
&
topic
);
void
rm
(
const
std
::
string
&
signal
);
void
list
();
void
clear
();
ros
::
NodeHandle
nh_
;
std
::
map
<
std
::
string
,
bindedSignal_t
>
bindedSignal_
;
};
}
// end of namespace dynamicgraph.
# include "ros_export.hxx"
#endif //! DYNAMIC_GRAPH_ROS_EXPORT_HH
This diff is collapsed.
Click to expand it.
src/ros_export.hxx
0 → 100644
+
16
−
0
View file @
6014f830
#ifndef DYNAMIC_GRAPH_ROS_EXPORT_HXX
# define DYNAMIC_GRAPH_ROS_EXPORT_HXX
# include <vector>
# include <jrl/mal/boost.hh>
# include <std_msgs/Float64.h>
# include "dynamic_graph/Matrix.h"
# include "dynamic_graph/Vector.h"
namespace
ml
=
maal
::
boost
;
namespace
dynamicgraph
{
}
// end of namespace dynamicgraph.
#endif //! DYNAMIC_GRAPH_ROS_EXPORT_HXX
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