Revision ffaa3e81
Fixed GUI bug to kill all the processes related to behavior when killing scouts
scout/scoutsim/GUI.py | ||
---|---|---|
133 | 133 |
def terminateOldBehavior(self): |
134 | 134 |
if self.process != None: |
135 | 135 |
# now terminate the process |
136 |
self.process.terminate() #TODO: this kills the process
|
|
136 |
self.process.kill() #TODO: this kills the process
|
|
137 | 137 |
# but maybe not the rosnode |
138 | 138 |
# change to "rosnode kill" instead |
139 | 139 |
# make sure old behavior is terminated before we run the new one |
... | ... | |
142 | 142 |
# the following lines causes lag and does not solve real issues |
143 | 143 |
# first unregister the node |
144 | 144 |
cmd = "rosnode kill /%sBehavior"%self.name |
145 |
temp = subprocess.Popen(cmd, shell=True)
|
|
145 |
temp = subprocess.Popen(shlex.split(cmd), shell=False)
|
|
146 | 146 |
temp.wait() |
147 |
# this node loses contact but still is not cleaned up in rosnode |
|
148 |
# however, this should not affect usage at all. |
|
149 | 147 |
|
150 | 148 |
def changeBehavior(self, behavior): |
151 | 149 |
self.behavior = behavior |
... | ... | |
185 | 183 |
# terminate its current behavior |
186 | 184 |
self.terminateOldBehavior() |
187 | 185 |
|
186 |
#terminate old behavior seems to not kill the processes related |
|
187 |
# this brutally kill all the process related to the specific scout |
|
188 |
cmd = "pkill -9 -f %s"%self.name |
|
189 |
subprocess.Popen(shlex.split(cmd), shell=False) |
|
190 |
|
|
188 | 191 |
# ros call to kill scout in simulator |
189 | 192 |
try: |
190 | 193 |
rospy.wait_for_service("/kill") |
Also available in: Unified diff