Closedown
This commit is contained in:
@@ -20,7 +20,7 @@ class RobotTCP(TcpDevice, Stoppable):
|
||||
self.lock = threading.Lock()
|
||||
self.joint_forces = None
|
||||
self.current_task = None
|
||||
self.high_level_tasks = []
|
||||
self.high_level_tasks = []
|
||||
|
||||
def _sendReceive(self, msg_id, msg = "", timeout = None):
|
||||
tx = self.header if (self.header != None) else ""
|
||||
@@ -344,6 +344,12 @@ class RobotTCP(TcpDevice, Stoppable):
|
||||
#self.setState(State.Busy if self.status=="move" else State.Ready)
|
||||
if self.state==State.Offline:
|
||||
print "Communication resumed"
|
||||
for task in self.high_level_tasks:
|
||||
if self.get_task_status(task)[0]>=0:
|
||||
print "Ongoing task: " + task
|
||||
self.current_task = task
|
||||
|
||||
|
||||
if (not self.settled) or (self.current_task is not None): self.setState(State.Busy)
|
||||
if not self.empty: self.setState(State.Paused)
|
||||
else: self.setState(State.Ready)
|
||||
@@ -380,16 +386,22 @@ class RobotTCP(TcpDevice, Stoppable):
|
||||
|
||||
#High-level, exclusive motion task.
|
||||
def start_task(self, program, *args, **kwargs):
|
||||
for task in (self.high_level_tasks + [program]):
|
||||
if (task is not None) and (self.get_task_status(task)[0]>=0):
|
||||
tasks = [t fot t in self.high_level_tasks]
|
||||
if not program in tasks:
|
||||
tasks.append(pro)
|
||||
for task in task:
|
||||
if self.get_task_status(task)[0]>=0:
|
||||
raise Exception("Ongoing high-level task: " + task)
|
||||
print "Setting ", program
|
||||
self.current_task = program
|
||||
self.task_create(program, *args, **kwargs)
|
||||
|
||||
def stop_task(self):
|
||||
for task in (self.high_level_tasks + [self.current_task]):
|
||||
if (task is not None) and (self.get_task_status(task)[0]>=0):
|
||||
tasks = [t fot t in self.high_level_tasks]
|
||||
if (self.current_task is not None) and (not self.current_task in tasks):
|
||||
tasks.append(pro)
|
||||
for task in task:
|
||||
if self.get_task_status(task)[0]>=0:
|
||||
self.task_kill(task)
|
||||
|
||||
def on_event(self,ev):
|
||||
|
||||
Reference in New Issue
Block a user