Revision fa5ca6e3
Fixed pause not working with the GUI. Also removed super annoying printf from MotorControl. And also fixed some pause/resume GUI bugs and the fact that process.kill and process.terminate wouldnt do anything.
scout/scoutsim/BehaviorGUI.py | ||
---|---|---|
21 | 21 |
# ROS functions |
22 | 22 |
# |
23 | 23 |
def AddToSimulator(name, x, y, theta): |
24 |
if name == "": |
|
25 |
return False |
|
24 | 26 |
if name in scouts: |
25 | 27 |
return False |
26 | 28 |
scouts[name] = "" |
... | ... | |
51 | 53 |
return True |
52 | 54 |
else: |
53 | 55 |
if name in processes: |
54 |
processes[name].terminate()
|
|
56 |
subprocess.Popen("rosnode kill /" + name + "_behavior", shell=True)
|
|
55 | 57 |
del processes[name] |
56 |
subprocess.Popen("rosrun libscout libscout " + name + " 0", shell=True) |
|
58 |
processes[name] = subprocess.Popen("rosrun libscout libscout " + name + " 0", shell=True)
|
|
57 | 59 |
print "Scout "+name+" was paused." |
58 | 60 |
behaviorButton.SetLabel("Resume") |
59 | 61 |
behaviorLabel.SetLabel(" | Current Behavior: Paused") |
60 | 62 |
return True |
61 | 63 |
if name in processes: |
62 |
processes[name].terminate()
|
|
64 |
subprocess.Popen("rosnode kill /" + name + "_behavior", shell=True)
|
|
63 | 65 |
# TODO Running a new behavior while paused does not do anything and |
64 | 66 |
# Gives lots of errors. |
65 | 67 |
# |
... | ... | |
79 | 81 |
rospy.wait_for_service('/kill') |
80 | 82 |
service = rospy.ServiceProxy('/kill', Kill) |
81 | 83 |
if name in processes: |
82 |
processes[name].kill()
|
|
84 |
subprocess.Popen("rosnode kill /" + name + "_behavior", shell=True)
|
|
83 | 85 |
del processes[name] |
84 | 86 |
resp = service(name) |
85 | 87 |
if name in scouts: |
... | ... | |
226 | 228 |
if __name__ == '__main__': |
227 | 229 |
ScoutSimGui = subprocess.Popen("rosrun scoutsim scoutsim_node race", shell=True) |
228 | 230 |
rospy.wait_for_service('/spawn') |
229 |
#subprocess.Popen("rosservice call /spawn 1.4 0.275 0 scout1", shell=True) # why was this here? |
|
230 | 231 |
app = wx.App() |
231 | 232 |
GUI(None, title='Colony Scout Manager') |
232 | 233 |
app.MainLoop() |
233 |
# This doesn't run. I'm sure there is a reason why.
|
|
234 |
#Figure out how to terminate this for reals.
|
|
234 | 235 |
for process in processes: |
235 |
process.kill() |
|
236 |
ScoutSimGui.kill() |
|
236 |
process.terminate() |
|
237 |
subprocess.Popen("rosnode kill /scoutsim", shell=True) |
Also available in: Unified diff