profile_gateway.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 from __future__ import absolute_import
3 
4 # ROS SETUP if needed
5 
6 import multiprocessing
7 import threading
8 import time
9 import cProfile
10 
11 
12 
13 try:
14  import rospy
15  import rosgraph
16  import roslaunch
17  import rocon_gateway
18  import pyros_setup
19 except ImportError as exc:
20  import os
21  import pyros_setup
22  import sys
23  sys.modules["pyros_setup"] = pyros_setup.delayed_import_auto(base_path=os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..'))
24  import rospy
25  import rosgraph
26  import roslaunch
27  import rocon_gateway
28 
29 roscore_process = None
30 master = None
31 
32 if not rosgraph.masterapi.is_online():
33  master, roscore_process = pyros_setup.get_master()
34  assert master.is_online()
35 
36 # Start roslaunch
37 launch = roslaunch.scriptapi.ROSLaunch()
38 launch.start()
39 
40 os.environ["ROS_NAMESPACE"] = "/rocon"
41 rospy.init_node('gateway', )
42 rospy.set_param("~hub_uri", "http://localhost:6380")
43 rospy.set_param("~disable_zeroconf", "true")
44 
45 gw_node = rocon_gateway.GatewayNode()
46 
48  count = 255
49  start = time.time()
50  while count > 0:
51  # time is ticking
52  now = time.time()
53  timedelta = now - start
54  start = now
55 
56  time.sleep(0.2)
57 
58  count -= 1
59 
60  rospy.signal_shutdown('timer expired')
61 
62 timer = threading.Thread(target= wait_just_a_bit())
63 timer.start()
64 
65 cProfile.run('gw_node.spin()')
66 
67 rospy.signal_shutdown('test complete')
68 
69 if roscore_process is not None:
70  roscore_process.terminate() # make sure everything is stopped


rocon_gateway_tests
Author(s): Daniel Stonier, Jihoon Lee, Piyush Khandelwal
autogenerated on Mon Jun 10 2019 14:40:15