Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
wolf_ros_gnss
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
mobile_robotics
wolf_projects
wolf_ros
wolf_ros_gnss
Commits
bbbe0de3
Commit
bbbe0de3
authored
4 years ago
by
Joan Vallvé Navarro
Browse files
Options
Downloads
Patches
Plain Diff
optionally reseting driver
parent
64e1ca13
No related branches found
No related tags found
2 merge requests
!3
After cmake and const refactor
,
!1
new release
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/subscriber_gnss_ublox.h
+5
-0
5 additions, 0 deletions
include/subscriber_gnss_ublox.h
src/subscriber_gnss_ublox.cpp
+28
-0
28 additions, 0 deletions
src/subscriber_gnss_ublox.cpp
with
33 additions
and
0 deletions
include/subscriber_gnss_ublox.h
+
5
−
0
View file @
bbbe0de3
...
...
@@ -45,8 +45,13 @@ class SubscriberGnssUblox : public SubscriberGnssReceiver
void
callback
(
const
std_msgs
::
UInt8MultiArray
&
msg
);
double
secondsSinceLastCallback
()
override
;
protected:
long
unsigned
int
n_msgs_
;
ros
::
Time
reseted_stamp_
;
bool
reset_driver_node_
;
double
max_topic_delay_
,
reset_duration_
;
};
WOLF_REGISTER_SUBSCRIBER
(
SubscriberGnssUblox
);
...
...
This diff is collapsed.
Click to expand it.
src/subscriber_gnss_ublox.cpp
+
28
−
0
View file @
bbbe0de3
...
...
@@ -13,6 +13,12 @@ SubscriberGnssUblox::SubscriberGnssUblox(const std::string& _unique_name,
std
::
make_shared
<
GnssUtils
::
UBloxRaw
>
()),
n_msgs_
(
0
)
{
reset_driver_node_
=
_server
.
getParam
<
bool
>
(
prefix_
+
"/reset_receiver"
);
if
(
reset_driver_node_
)
{
max_topic_delay_
=
_server
.
getParam
<
double
>
(
prefix_
+
"/reset_duration"
);
reset_duration_
=
_server
.
getParam
<
double
>
(
prefix_
+
"/reset_duration"
);
}
}
SubscriberGnssUblox
::~
SubscriberGnssUblox
()
...
...
@@ -29,6 +35,8 @@ void SubscriberGnssUblox::initialize(ros::NodeHandle& nh, const std::string& top
void
SubscriberGnssUblox
::
callback
(
const
std_msgs
::
UInt8MultiArray
&
msg
)
{
ROS_DEBUG
(
"SubscriberGnssUblox::callback message received!"
);
auto
stamp
=
ros
::
Time
::
now
();
setLastStamp
(
stamp
);
n_msgs_
++
;
...
...
@@ -45,4 +53,24 @@ void SubscriberGnssUblox::callback(const std_msgs::UInt8MultiArray& msg)
}
}
double
SubscriberGnssUblox
::
secondsSinceLastCallback
()
{
if
(
last_stamp_
==
ros
::
Time
(
0
))
return
0
;
double
seconds
=
(
ros
::
Time
::
now
()
-
last_stamp_
).
toSec
();
if
(
reset_driver_node_
and
seconds
>
max_topic_delay_
and
(
ros
::
Time
::
now
()
-
reseted_stamp_
).
toSec
()
>
reset_duration_
)
{
ROS_WARN
(
"SubscriberGnssUblox: not received raw data for more than %fs and reseted more than %fs ago, reseting ublox diver..."
,
max_topic_delay_
,
reset_duration_
);
system
(
"rosnode kill ublox_gps"
);
reseted_stamp_
=
ros
::
Time
::
now
();
}
return
seconds
;
}
}
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