From 5fae1834a9933249cba5563b0ba0a0d6b3264a7b Mon Sep 17 00:00:00 2001 From: gac-S_Changer Date: Mon, 27 Feb 2017 08:53:46 +0100 Subject: [PATCH] --- .../usr/usrapp/ForceDetection/comTcp.pgx | 13 ++++++++++++- .../usr/usrapp/ForceDetection/onCommandTcp.pgx | 3 --- script/RobotTCP.py | 7 +++++-- script/test/TestRobotTCP.py | 4 +--- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/comTcp.pgx b/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/comTcp.pgx index 9d0fbba..0a0f87b 100644 --- a/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/comTcp.pgx +++ b/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/comTcp.pgx @@ -179,10 +179,21 @@ tx = tx + toString(".4", t.ry) + "|" tx = tx + toString(".4", t.rz) + "|" break + case "get_help" + toNum(args[0], aux, ok) + if ok == true + tx = help(aux) + else + ex = "Invalid code: " + args[0] + endIf + break default //App specific call onCommandTcp(cmd,args, tx, ex) - break + if ((len(tx) == 0) and (len(ex) == 0)) + ex = "Invalid command: " + cmd + endIf + break endSwitch last_id = msg_id endIf diff --git a/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/onCommandTcp.pgx b/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/onCommandTcp.pgx index df201ec..12e6c54 100644 --- a/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/onCommandTcp.pgx +++ b/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/onCommandTcp.pgx @@ -22,9 +22,6 @@ tx = "Mounting sample " + toString("", puck) + ":" + toString("", sample) //taskCreate "mount",10,mount(puck, sample) break - default - ex = "Invalid command: " + cmd - break endSwitch end]]> diff --git a/script/RobotTCP.py b/script/RobotTCP.py index aa43c46..42aa86c 100644 --- a/script/RobotTCP.py +++ b/script/RobotTCP.py @@ -314,8 +314,11 @@ class RobotTCP(TcpDevice, Stoppable): code = self.eval_int('taskStatus("' + str(name)+ '")') #TODO: String assignments in $exec causes application to freeze #status = self.eval_str('help(' + str(code)+ ')') - status = get_help.evaluate('get_help("' + str(code)+ '")')') - return code + if code== -1: status = "Stopped" + elif code== 0: status = "Paused" + elif code== 1: status = "Running" + else: status = self.execute('get_help', code) + return (code,status) #Updating def update_status(self): diff --git a/script/test/TestRobotTCP.py b/script/test/TestRobotTCP.py index 257fc02..f5ce133 100644 --- a/script/test/TestRobotTCP.py +++ b/script/test/TestRobotTCP.py @@ -1,5 +1,4 @@ -""" -#robot_tcp.task_create("simulateEvents",3, name = "test", priority = 20) +robot_tcp.task_create("simulateEvents",3, name = "test", priority = 20) print robot_tcp.get_task_status("test") print robot_tcp.get_task_status("tests") @@ -10,7 +9,6 @@ print robot_tcp.get_task_status("test") robot_tcp.task_kill("test") print robot_tcp.get_task_status("test") -""" print robot_tcp.is_powered()