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
85212f20
Commit
85212f20
authored
13 years ago
by
Thomas Moulard
Browse files
Options
Downloads
Patches
Plain Diff
Make sure we do not publish faster than 100hz.
parent
8f7dd59e
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/ros_import.cpp
+7
-1
7 additions, 1 deletion
src/ros_import.cpp
src/ros_import.hh
+4
-0
4 additions, 0 deletions
src/ros_import.hh
src/ros_joint_state.cpp
+6
-2
6 additions, 2 deletions
src/ros_joint_state.cpp
src/ros_joint_state.hh
+4
-0
4 additions, 0 deletions
src/ros_joint_state.hh
with
21 additions
and
3 deletions
src/ros_import.cpp
+
7
−
1
View file @
85212f20
...
...
@@ -123,7 +123,9 @@ namespace dynamicgraph
bindedSignal_
(),
trigger_
(
boost
::
bind
(
&
RosImport
::
trigger
,
this
,
_1
,
_2
),
sotNOSIGNAL
,
MAKE_SIGNAL_STRING
(
name
,
true
,
"int"
,
"trigger"
))
MAKE_SIGNAL_STRING
(
name
,
true
,
"int"
,
"trigger"
)),
rate_
(
ROS_JOINT_STATE_PUBLISHER_RATE
),
lastPublicated_
(
ros
::
Time
::
now
()
-
rate_
-
rate_
)
{
signalRegistration
(
trigger_
);
trigger_
.
setNeedUpdateFromAllChildren
(
true
);
...
...
@@ -171,6 +173,10 @@ namespace dynamicgraph
{
typedef
std
::
map
<
std
::
string
,
bindedSignal_t
>::
iterator
iterator_t
;
ros
::
Duration
dt
=
ros
::
Time
::
now
()
-
lastPublicated_
;
if
(
dt
<
rate_
)
return
dummy
;
for
(
iterator_t
it
=
bindedSignal_
.
begin
();
it
!=
bindedSignal_
.
end
();
++
it
)
{
...
...
This diff is collapsed.
Click to expand it.
src/ros_import.hh
+
4
−
0
View file @
85212f20
...
...
@@ -60,6 +60,8 @@ namespace dynamicgraph
callback_t
>
bindedSignal_t
;
static
const
double
ROS_JOINT_STATE_PUBLISHER_RATE
=
1.
/
100.
;
RosImport
(
const
std
::
string
&
n
);
virtual
~
RosImport
();
...
...
@@ -88,6 +90,8 @@ namespace dynamicgraph
ros
::
NodeHandle
nh_
;
std
::
map
<
std
::
string
,
bindedSignal_t
>
bindedSignal_
;
dynamicgraph
::
SignalTimeDependent
<
int
,
int
>
trigger_
;
ros
::
Duration
rate_
;
ros
::
Time
lastPublicated_
;
};
}
// end of namespace dynamicgraph.
...
...
This diff is collapsed.
Click to expand it.
src/ros_joint_state.cpp
+
6
−
2
View file @
85212f20
...
...
@@ -28,7 +28,9 @@ namespace dynamicgraph
jointState_
(),
trigger_
(
boost
::
bind
(
&
RosJointState
::
trigger
,
this
,
_1
,
_2
),
sotNOSIGNAL
,
MAKE_SIGNAL_STRING
(
name
,
true
,
"int"
,
"trigger"
))
MAKE_SIGNAL_STRING
(
name
,
true
,
"int"
,
"trigger"
)),
rate_
(
ROS_JOINT_STATE_PUBLISHER_RATE
),
lastPublicated_
(
ros
::
Time
::
now
()
-
rate_
-
rate_
)
{
signalRegistration
(
state_
<<
trigger_
);
trigger_
.
setNeedUpdateFromAllChildren
(
true
);
...
...
@@ -46,8 +48,10 @@ namespace dynamicgraph
int
&
RosJointState
::
trigger
(
int
&
dummy
,
int
t
)
{
if
(
publisher_
.
trylock
())
ros
::
Duration
dt
=
ros
::
Time
::
now
()
-
lastPublicated_
;
if
(
dt
>
rate_
&&
publisher_
.
trylock
())
{
lastPublicated_
=
ros
::
Time
::
now
();
std
::
size_t
s
=
state_
.
access
(
t
).
size
();
// Update header.
...
...
This diff is collapsed.
Click to expand it.
src/ros_joint_state.hh
+
4
−
0
View file @
85212f20
...
...
@@ -21,6 +21,8 @@ namespace dynamicgraph
/// \brief Vector input signal.
typedef
SignalPtr
<
ml
::
Vector
,
int
>
signalVectorIn_t
;
static
const
double
ROS_JOINT_STATE_PUBLISHER_RATE
=
1.
/
100.
;
RosJointState
(
const
std
::
string
&
n
);
virtual
~
RosJointState
();
...
...
@@ -31,6 +33,8 @@ namespace dynamicgraph
realtime_tools
::
RealtimePublisher
<
sensor_msgs
::
JointState
>
publisher_
;
sensor_msgs
::
JointState
jointState_
;
dynamicgraph
::
SignalTimeDependent
<
int
,
int
>
trigger_
;
ros
::
Duration
rate_
;
ros
::
Time
lastPublicated_
;
};
}
// end of namespace dynamicgraph.
...
...
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