kni_demo.py
Go to the documentation of this file.
00001 ############################################################################################
00002 # Katana450 KNI Python Interface Demo
00003 # Copyright (C) 2008 Neuronics AG
00004 # PKE/JHA, 2008
00005 ############################################################################################
00006 """
00007 This Skript demonstrates the use of the KNI library through the Python wrapper
00008 For API doc, read the kni_wrapper doc or the kni_wrapper.h file.
00009 """
00010 #############################################################################################
00011 import sys
00012 sys.path.append("../")
00013 import KNI
00014 from KNI import TMovement
00015 #############################################################################################
00016 
00017 import KNI
00018 KNI.initKatana("../../configfiles450/katana6M90T.cfg", "192.168.1.1")
00019 KNI.calibrate(0)
00020 
00021 home = TMovement()
00022 KNI.getPosition(home.pos)
00023 home.transition = KNI.PTP
00024 home.velocity = 50
00025 home.acceleration = 2
00026 
00027 raw_input("Press [ENTER] to release robot.")
00028 KNI.allMotorsOff()
00029 
00030 stackname = "test"
00031 
00032 raw_input("Press [ENTER] to store first point (p2p movement).")
00033 m = TMovement()
00034 KNI.getPosition(m.pos)
00035 m.transition = KNI.PTP
00036 m.velocity = 50
00037 m.acceleration = 2
00038 KNI.pushMovementToStack(m, stackname)
00039 
00040 raw_input("Press [ENTER] to store second point (linear movement).")
00041 m = TMovement()
00042 KNI.getPosition(m.pos)
00043 m.transition = KNI.LINEAR
00044 m.velocity = 50
00045 m.acceleration = 2
00046 KNI.pushMovementToStack(m, stackname)
00047 
00048 raw_input("Press [ENTER] to store third point (linear movement).")
00049 m = TMovement()
00050 KNI.getPosition(m.pos)
00051 m.transition = KNI.LINEAR
00052 m.velocity = 50
00053 m.acceleration = 2
00054 KNI.pushMovementToStack(m, stackname)
00055 
00056 raw_input("Press [ENTER] to store fourth point (p2p movement).")
00057 m = TMovement()
00058 KNI.getPosition(m.pos)
00059 m.transition = KNI.PTP
00060 m.velocity = 50
00061 m.acceleration = 2
00062 KNI.pushMovementToStack(m, stackname)
00063 
00064 raw_input("Press [ENTER] to store fifth and last point (p2p movement).")
00065 m = TMovement()
00066 KNI.getPosition(m.pos)
00067 m.transition = KNI.PTP
00068 m.velocity = 50
00069 m.acceleration = 2
00070 KNI.pushMovementToStack(m, stackname)
00071 
00072 raw_input("Press [ENTER] to fix robot.")
00073 KNI.allMotorsOn()
00074 
00075 raw_input("Press [ENTER] to loop through the point list robot.")
00076 repetitions = int(raw_input("How many repetitions? "))
00077 KNI.runThroughMovementStack(stackname, repetitions)
00078 
00079 KNI.executeMovement(home)
00080 
00081 KNI.allMotorsOff()
00082 
00083 #############################################################################################


kni
Author(s): Martin Günther
autogenerated on Thu Aug 27 2015 13:40:07