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
9465f316
Commit
9465f316
authored
5 years ago
by
Joseph Mirabel
Committed by
olivier stasse
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix logging issue.
parent
a5e5b18d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/ros_tf_listener.cpp
+23
-0
23 additions, 0 deletions
src/ros_tf_listener.cpp
src/ros_tf_listener.hh
+7
-20
7 additions, 20 deletions
src/ros_tf_listener.hh
with
30 additions
and
20 deletions
src/ros_tf_listener.cpp
+
23
−
0
View file @
9465f316
...
@@ -5,5 +5,28 @@
...
@@ -5,5 +5,28 @@
namespace
dynamicgraph
namespace
dynamicgraph
{
{
namespace
internal
{
sot
::
MatrixHomogeneous
&
TransformListenerData
::
getTransform
(
sot
::
MatrixHomogeneous
&
res
,
int
time
)
{
static
const
ros
::
Time
rosTime
(
0
);
try
{
listener
.
lookupTransform
(
toFrame
,
fromFrame
,
rosTime
,
transform
);
}
catch
(
const
tf
::
TransformException
&
ex
)
{
res
.
setIdentity
();
std
::
ostringstream
oss
;
oss
<<
"Enable to get transform at time "
<<
time
<<
": "
<<
ex
.
what
();
entity
->
SEND_WARNING_STREAM_MSG
(
oss
.
str
());
return
res
;
}
for
(
int
r
=
0
;
r
<
3
;
++
r
)
{
for
(
int
c
=
0
;
c
<
3
;
++
c
)
res
.
linear
()(
r
,
c
)
=
transform
.
getBasis
().
getRow
(
r
)[
c
];
res
.
translation
()[
r
]
=
transform
.
getOrigin
()[
r
];
}
return
res
;
}
}
DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN
(
RosTfListener
,
"RosTfListener"
);
DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN
(
RosTfListener
,
"RosTfListener"
);
}
}
This diff is collapsed.
Click to expand it.
src/ros_tf_listener.hh
+
7
−
20
View file @
9465f316
...
@@ -19,15 +19,18 @@ namespace dynamicgraph {
...
@@ -19,15 +19,18 @@ namespace dynamicgraph {
struct
TransformListenerData
{
struct
TransformListenerData
{
typedef
Signal
<
sot
::
MatrixHomogeneous
,
int
>
signal_t
;
typedef
Signal
<
sot
::
MatrixHomogeneous
,
int
>
signal_t
;
RosTfListener
*
entity
;
tf
::
TransformListener
&
listener
;
tf
::
TransformListener
&
listener
;
const
std
::
string
toFrame
,
fromFrame
;
const
std
::
string
toFrame
,
fromFrame
;
tf
::
StampedTransform
transform
;
tf
::
StampedTransform
transform
;
signal_t
signal
;
signal_t
signal
;
TransformListenerData
(
tf
::
TransformListener
&
l
,
TransformListenerData
(
RosTfListener
*
e
,
tf
::
TransformListener
&
l
,
const
std
::
string
&
to
,
const
std
::
string
&
from
,
const
std
::
string
&
to
,
const
std
::
string
&
from
,
const
std
::
string
&
signame
)
const
std
::
string
&
signame
)
:
listener
(
l
)
:
entity
(
e
)
,
listener
(
l
)
,
toFrame
(
to
)
,
toFrame
(
to
)
,
fromFrame
(
from
)
,
fromFrame
(
from
)
,
signal
(
signame
)
,
signal
(
signame
)
...
@@ -35,23 +38,7 @@ namespace dynamicgraph {
...
@@ -35,23 +38,7 @@ namespace dynamicgraph {
signal
.
setFunction
(
boost
::
bind
(
&
TransformListenerData
::
getTransform
,
this
,
_1
,
_2
));
signal
.
setFunction
(
boost
::
bind
(
&
TransformListenerData
::
getTransform
,
this
,
_1
,
_2
));
}
}
sot
::
MatrixHomogeneous
&
getTransform
(
sot
::
MatrixHomogeneous
&
res
,
int
time
)
sot
::
MatrixHomogeneous
&
getTransform
(
sot
::
MatrixHomogeneous
&
res
,
int
time
);
{
static
const
ros
::
Time
rosTime
(
0
);
try
{
listener
.
lookupTransform
(
toFrame
,
fromFrame
,
rosTime
,
transform
);
}
catch
(
const
tf
::
TransformException
&
ex
)
{
res
.
setIdentity
();
ROS_ERROR
(
"Enable to get transform at time %i: %s"
,
time
,
ex
.
what
());
return
res
;
}
for
(
sot
::
MatrixHomogeneous
::
Index
r
=
0
;
r
<
3
;
++
r
)
{
for
(
sot
::
MatrixHomogeneous
::
Index
c
=
0
;
c
<
3
;
++
c
)
res
.
linear
()(
r
,
c
)
=
transform
.
getBasis
().
getRow
(
r
)[
c
];
res
.
translation
()[
r
]
=
transform
.
getOrigin
()[
r
];
}
return
res
;
}
};
};
}
// end of internal namespace.
}
// end of internal namespace.
...
@@ -93,7 +80,7 @@ namespace dynamicgraph {
...
@@ -93,7 +80,7 @@ namespace dynamicgraph {
signalName
%
getName
()
%
signame
;
signalName
%
getName
()
%
signame
;
TransformListenerData
*
tld
=
new
TransformListenerData
(
TransformListenerData
*
tld
=
new
TransformListenerData
(
listener
,
to
,
from
,
signalName
.
str
());
this
,
listener
,
to
,
from
,
signalName
.
str
());
signalRegistration
(
tld
->
signal
);
signalRegistration
(
tld
->
signal
);
listenerDatas
[
signame
]
=
tld
;
listenerDatas
[
signame
]
=
tld
;
}
}
...
...
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