From b7dff16bc71f0e55ff0385528c03d9e5be29aa45 Mon Sep 17 00:00:00 2001 From: gac-S_Changer Date: Thu, 26 Jan 2017 16:21:24 +0100 Subject: [PATCH] Startup --- script/TestRobotCmds2.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 script/TestRobotCmds2.py diff --git a/script/TestRobotCmds2.py b/script/TestRobotCmds2.py new file mode 100644 index 0000000..048e20e --- /dev/null +++ b/script/TestRobotCmds2.py @@ -0,0 +1,25 @@ +if robot_req.read() != 0: + raise Exception("Ongoing command") +if robot_ack.read() != 0: + raise Exception("Robot is not ready") +robot_cmd.write(1) +args = [0,0,0,0,0,0] + +robot_args.write(to_array(args, 'i')) + + +robot_req.write(1) +while robot_ack.read() == 0: + time.sleep(0.001) + +err = robot_ack.take() +if err == 1: + ret = robot_ret.read() + print ret +if err == 2: + print ("Invalid command: " + str(command)) +print ("Unknown error: " + str(err)) +robot_req.write(0) +while robot_ack.read() != 0: + time.sleep(0.001) +