Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
KNI_4.3.0
py
demo
kni_demo.py
Go to the documentation of this file.
1
############################################################################################
2
# Katana450 KNI Python Interface Demo
3
# Copyright (C) 2008 Neuronics AG
4
# PKE/JHA, 2008
5
############################################################################################
6
"""
7
This Skript demonstrates the use of the KNI library through the Python wrapper
8
For API doc, read the kni_wrapper doc or the kni_wrapper.h file.
9
"""
10
#############################################################################################
11
import
sys
12
sys.path.append(
"../"
)
13
import
KNI
14
from
KNI
import
TMovement
15
#############################################################################################
16
17
import
KNI
18
KNI.initKatana
(
"../../configfiles450/katana6M90T.cfg"
,
"192.168.1.1"
)
19
KNI.calibrate
(0)
20
21
home =
TMovement
()
22
KNI.getPosition
(home.pos)
23
home.transition = KNI.PTP
24
home.velocity = 50
25
home.acceleration = 2
26
27
raw_input(
"Press [ENTER] to release robot."
)
28
KNI.allMotorsOff
()
29
30
stackname =
"test"
31
32
raw_input(
"Press [ENTER] to store first point (p2p movement)."
)
33
m =
TMovement
()
34
KNI.getPosition
(m.pos)
35
m.transition = KNI.PTP
36
m.velocity = 50
37
m.acceleration = 2
38
KNI.pushMovementToStack
(m, stackname)
39
40
raw_input(
"Press [ENTER] to store second point (linear movement)."
)
41
m =
TMovement
()
42
KNI.getPosition
(m.pos)
43
m.transition = KNI.LINEAR
44
m.velocity = 50
45
m.acceleration = 2
46
KNI.pushMovementToStack
(m, stackname)
47
48
raw_input(
"Press [ENTER] to store third point (linear movement)."
)
49
m =
TMovement
()
50
KNI.getPosition
(m.pos)
51
m.transition = KNI.LINEAR
52
m.velocity = 50
53
m.acceleration = 2
54
KNI.pushMovementToStack
(m, stackname)
55
56
raw_input(
"Press [ENTER] to store fourth point (p2p movement)."
)
57
m =
TMovement
()
58
KNI.getPosition
(m.pos)
59
m.transition = KNI.PTP
60
m.velocity = 50
61
m.acceleration = 2
62
KNI.pushMovementToStack
(m, stackname)
63
64
raw_input(
"Press [ENTER] to store fifth and last point (p2p movement)."
)
65
m =
TMovement
()
66
KNI.getPosition
(m.pos)
67
m.transition = KNI.PTP
68
m.velocity = 50
69
m.acceleration = 2
70
KNI.pushMovementToStack
(m, stackname)
71
72
raw_input(
"Press [ENTER] to fix robot."
)
73
KNI.allMotorsOn
()
74
75
raw_input(
"Press [ENTER] to loop through the point list robot."
)
76
repetitions = int(raw_input(
"How many repetitions? "
))
77
KNI.runThroughMovementStack
(stackname, repetitions)
78
79
KNI.executeMovement
(home)
80
81
KNI.allMotorsOff
()
82
83
#############################################################################################
KNI.getPosition
getPosition
Definition:
KNI.py:152
KNI.allMotorsOn
allMotorsOn
Definition:
KNI.py:142
KNI.pushMovementToStack
pushMovementToStack
Definition:
KNI.py:166
KNI.initKatana
initKatana
Definition:
KNI.py:154
KNI.calibrate
calibrate
Definition:
KNI.py:143
KNI.runThroughMovementStack
runThroughMovementStack
Definition:
KNI.py:167
KNI.executeMovement
executeMovement
Definition:
KNI.py:149
KNI.TMovement
Definition:
KNI.py:90
KNI.allMotorsOff
allMotorsOff
Definition:
KNI.py:141
kni
Author(s): Martin Günther
autogenerated on Fri Jan 3 2020 04:01:16