-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_sensor_handler.py
More file actions
executable file
·39 lines (29 loc) · 1011 Bytes
/
test_sensor_handler.py
File metadata and controls
executable file
·39 lines (29 loc) · 1011 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env python
"""Test displaying the robot's current sensors.
Before using this, run:
roslaunch subtle_launch static-sim.launch
roslaunch controller run.launch
"""
import time
import threading
import rospy
from controller_handlers.sensor import sensorHandler
def display_sensors(sensor_handler):
"""Print the current sensor state periodically."""
while not rospy.is_shutdown():
# We use a testing hook to get all sensors at once.
# pylint: disable=W0212
sensors = sensor_handler._get_all_sensors()
print "Sensors:", sensors
time.sleep(0.5)
def main():
"""Get rooms from the user and send the robot there."""
print "Initializing sensor handler..."
sensor_handler = sensorHandler(None, None, True)
# Sleep to make sure the node has settled
time.sleep(3.0)
# Kick off display thread and spin
threading.Thread(target=display_sensors, args=(sensor_handler,)).start()
rospy.spin()
if __name__ == "__main__":
main()