Main Page
Namespaces
Classes
Files
File List
src
novatel_span_driver
monitor.py
Go to the documentation of this file.
1
#! /usr/bin/env python
2
# -*- coding: utf-8 -*-
3
4
# Software License Agreement (BSD)
5
#
6
# file @monitor.py
7
# authors Mike Purvis <mpurvis@clearpathrobotics.com>
8
# copyright Copyright (c) 2012, Clearpath Robotics, Inc., All rights reserved.
9
#
10
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that
11
# the following conditions are met:
12
# * Redistributions of source code must retain the above copyright notice, this list of conditions and the
13
# following disclaimer.
14
# * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
15
# following disclaimer in the documentation and/or other materials provided with the distribution.
16
# * Neither the name of Clearpath Robotics nor the names of its contributors may be used to endorse or promote
17
# products derived from this software without specific prior written permission.
18
#
19
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WAR-
20
# RANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, IN-
22
# DIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
23
# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
27
import
rospy
28
import
threading
29
30
31
class
Monitor
(threading.Thread):
32
def
__init__
(self, ports):
33
super(Monitor, self).
__init__
()
34
self.
ports
= ports
35
self.
finish
= threading.Event()
36
37
def
run
(self):
38
while
not
self.
finish
:
39
rospy.sleep(1.0)
40
for
name, port
in
ports.items():
41
if
not
port.is_alive():
42
rospy.logerr(
"Port %s thread died. Signalling node shutdown."
% name)
43
rospy.signal_shutdown(
"Node lost thread."
)
novatel_span_driver.monitor.Monitor.ports
ports
Definition:
monitor.py:34
novatel_span_driver.monitor.Monitor.finish
finish
Definition:
monitor.py:35
novatel_span_driver.monitor.Monitor.__init__
def __init__(self, ports)
Definition:
monitor.py:32
novatel_span_driver.monitor.Monitor.run
def run(self)
Definition:
monitor.py:37
novatel_span_driver.monitor.Monitor
Definition:
monitor.py:31
novatel_span_driver
Author(s): NovAtel Support
autogenerated on Wed Apr 3 2019 02:52:53