-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_motion_controller.py
More file actions
executable file
·47 lines (35 loc) · 1.19 KB
/
test_motion_controller.py
File metadata and controls
executable file
·47 lines (35 loc) · 1.19 KB
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
40
41
42
43
44
45
46
47
#!/usr/bin/env python
"""Test moving the robot around and getting its location.
Before using this, run:
roslaunch subtle_launch static-sim.launch
roslaunch controller run.launch
"""
import time
import threading
import rospy
from controller_handlers.motion import MotionController
def display_interface(motion):
"""Ask the user for locations and send the robot there."""
print "Enter the name of a room to go to, or ctrl-d to quit."
while not rospy.is_shutdown():
room = raw_input("> ").strip()
if not room:
continue
# Send the command out
result = motion.send_move_command(room)
if not result:
print "Could not find room {!r}.".format(room)
continue
else:
print "The robot is moving to {!r}.".format(room)
def main():
"""Get rooms from the user and send the robot there."""
print "Initializing motion controller..."
motion = MotionController(True)
# Sleep to make sure the node has settled
time.sleep(3.0)
# Kick off interface thread and spin
threading.Thread(target=display_interface, args=(motion,)).start()
rospy.spin()
if __name__ == "__main__":
main()