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
Guilhem Saurel
dynamic_graph_bridge
Commits
4e7542fe
Commit
4e7542fe
authored
6 years ago
by
Joseph Mirabel
Committed by
olivier stasse
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Avoid overflow in ros::Duration
* This was trigerring an exception "Duration is out of dual 32-bit * range"
parent
86cfdc71
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_publish.cpp
+4
-6
4 additions, 6 deletions
src/ros_publish.cpp
src/ros_publish.hh
+1
-1
1 addition, 1 deletion
src/ros_publish.hh
with
5 additions
and
7 deletions
src/ros_publish.cpp
+
4
−
6
View file @
4e7542fe
...
@@ -143,11 +143,11 @@ namespace dynamicgraph
...
@@ -143,11 +143,11 @@ namespace dynamicgraph
sotNOSIGNAL
,
sotNOSIGNAL
,
MAKE_SIGNAL_STRING
(
name
,
true
,
"int"
,
"trigger"
)),
MAKE_SIGNAL_STRING
(
name
,
true
,
"int"
,
"trigger"
)),
rate_
(
ROS_JOINT_STATE_PUBLISHER_RATE
),
rate_
(
ROS_JOINT_STATE_PUBLISHER_RATE
),
las
tPublicat
ed
_
()
nex
tPublicat
ion
_
()
{
{
try
{
try
{
las
tPublicat
ed
_
=
ros
::
Time
::
now
();
nex
tPublicat
ion
_
=
ros
::
Time
::
now
();
}
catch
(
const
std
::
exception
&
exc
)
{
}
catch
(
const
std
::
exception
&
exc
)
{
throw
std
::
runtime_error
(
"Failed to call ros::Time::now ():"
+
throw
std
::
runtime_error
(
"Failed to call ros::Time::now ():"
+
std
::
string
(
exc
.
what
()));
std
::
string
(
exc
.
what
()));
...
@@ -220,7 +220,6 @@ namespace dynamicgraph
...
@@ -220,7 +220,6 @@ namespace dynamicgraph
}
}
//lock the mutex to avoid deleting the signal during a call to trigger
//lock the mutex to avoid deleting the signal during a call to trigger
while
(
!
mutex_
.
try_lock
()
){}
signalDeregistration
(
signal
);
signalDeregistration
(
signal
);
bindedSignal_
.
erase
(
signal
);
bindedSignal_
.
erase
(
signal
);
mutex_
.
unlock
();
mutex_
.
unlock
();
...
@@ -258,11 +257,10 @@ namespace dynamicgraph
...
@@ -258,11 +257,10 @@ namespace dynamicgraph
{
{
typedef
std
::
map
<
std
::
string
,
bindedSignal_t
>::
iterator
iterator_t
;
typedef
std
::
map
<
std
::
string
,
bindedSignal_t
>::
iterator
iterator_t
;
ros
::
Duration
dt
=
ros
::
Time
::
now
()
-
lastPublicated_
;
if
(
ros
::
Time
::
now
()
<=
nextPublication_
)
if
(
dt
<
rate_
)
return
dummy
;
return
dummy
;
las
tPublicat
ed
_
=
ros
::
Time
::
now
();
nex
tPublicat
ion
_
=
ros
::
Time
::
now
()
+
rate_
;
while
(
!
mutex_
.
try_lock
()
){}
while
(
!
mutex_
.
try_lock
()
){}
for
(
iterator_t
it
=
bindedSignal_
.
begin
();
for
(
iterator_t
it
=
bindedSignal_
.
begin
();
...
...
This diff is collapsed.
Click to expand it.
src/ros_publish.hh
+
1
−
1
View file @
4e7542fe
...
@@ -93,7 +93,7 @@ namespace dynamicgraph
...
@@ -93,7 +93,7 @@ namespace dynamicgraph
std
::
map
<
std
::
string
,
bindedSignal_t
>
bindedSignal_
;
std
::
map
<
std
::
string
,
bindedSignal_t
>
bindedSignal_
;
dynamicgraph
::
SignalTimeDependent
<
int
,
int
>
trigger_
;
dynamicgraph
::
SignalTimeDependent
<
int
,
int
>
trigger_
;
ros
::
Duration
rate_
;
ros
::
Duration
rate_
;
ros
::
Time
las
tPublicat
ed
_
;
ros
::
Time
nex
tPublicat
ion
_
;
boost
::
interprocess
::
interprocess_mutex
mutex_
;
boost
::
interprocess
::
interprocess_mutex
mutex_
;
};
};
}
// end of namespace dynamicgraph.
}
// 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