oem7_bist.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 ################################################################################
4 # Copyright (c) 2020 NovAtel Inc.
5 #
6 # Permission is hereby granted, free of charge, to any person obtaining a copy
7 # of this software and associated documentation files (the "Software"), to deal
8 # in the Software without restriction, including without limitation the rights
9 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 # copies of the Software, and to permit persons to whom the Software is
11 # furnished to do so, subject to the following conditions:
12 #
13 # The above copyright notice and this permission notice shall be included in all
14 # copies or substantial portions of the Software.
15 #
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 # SOFTWARE.
23 #
24 #################################################################################
25 
26 
27 import unittest
28 import rospy
29 import os, sys
30 
31 import oem7_message_test
32 
33 PKG = 'novatel_oem7_driver'
34 NAME = 'oem7_bist'
35 
36 class Oem7BIST(unittest.TestCase):
37  """
38  Built-in Self-Test. Runs in parallel with a 'live' driver, supports correct recording of topics;
39  and analyzes message rates.
40  """
41  def __init__(self, *args):
42  super(self.__class__, self).__init__(*args)
43  rospy.init_node(NAME)
44 
45 
46  def test_1_recording(self):
47  """
48  Removes stale test .bag; delays execution of analysis until current recording is complete.
49  """
50  if os.path.exists(self.bist_bag):
51  os.remove(self.bist_bag)
52 
53  delay_sec = float(rospy.get_param('~duration', 60.))
54  print("Sleeping for {0} sec to allow topics to be recorded...".format(delay_sec))
55  rospy.sleep(delay_sec)
56  print("..done")
57 
58  def test_2_analysis(self):
59  """
60  Analyzes message rates.
61  """
62  oem7_message_test.analyze_hz(self.bist_bag, output_csv = False)
63  # Set output_csv = True to dump topic statistics to .csv file.
64 
65 
66 if __name__ == '__main__':
67 
68  Oem7BIST.bist_bag = sys.argv[1]
69 
70  import rostest
71  rostest.run(PKG, NAME, Oem7BIST, sys.argv)
72 
def __init__(self, args)
Definition: oem7_bist.py:41
def analyze_hz(bag_name, output_csv)
def test_1_recording(self)
Definition: oem7_bist.py:46
def test_2_analysis(self)
Definition: oem7_bist.py:58


novatel_oem7_driver
Author(s):
autogenerated on Tue Mar 9 2021 03:48:00