FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
java4cpp/examples/python/jython/crclclient.py at split_ui_utils · wshackle/java4cpp · GitHub
wshackle
/
java4cpp
Public
Notifications
You must be signed in to change notification settings
Fork
1
Star
9
Code
Issues
1
Pull requests
1
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
java4cpp
/
examples
/
python
/
jython
/
crclclient.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
72 lines (63 loc) · 1.99 KB
Breadcrumbs
java4cpp
/
examples
/
python
/
jython
/
crclclient.py
Copy path
File metadata and controls
72 lines (63 loc) · 1.99 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/jython
# CRCL Client Example using Java CRCL Library and Jython (http://www.jython.org)
# Run with:
# env CLASSPATH=../../../crcl4java-utils/target/crcl4java-utils-1.0-SNAPSHOT-jar-with-dependencies.jar jython crclclient.py
from
crcl
.
base
import
*
from
crcl
.
utils
import
CRCLSocket
from
java
.
math
import
*
import
java
.
lang
.
Boolean
print
"Connect"
s
=
CRCLSocket
(
"localhost"
,
64444
)
instance
=
CRCLCommandInstanceType
()
## Create and send InitCanon command
print
"Send InitCanon"
init
=
InitCanonType
()
init
.
setCommandID
(
BigInteger
.
valueOf
(
7
))
instance
.
setCRCLCommand
(
init
)
s
.
writeCommand
(
instance
)
#
## Create and send MoveTo command.
print
"Send MoveTo"
moveTo
=
MoveToType
()
moveTo
.
setCommandID
(
BigInteger
.
valueOf
(
8
))
pose
=
PoseType
()
pt
=
PointType
()
pt
.
setX
(
BigDecimal
.
valueOf
(
1.1
))
pt
.
setY
(
BigDecimal
.
valueOf
(
0.0
))
pt
.
setZ
(
BigDecimal
.
valueOf
(
0.1
))
pose
.
setPoint
(
pt
)
xAxis
=
VectorType
()
xAxis
.
setI
(
BigDecimal
.
ONE
)
xAxis
.
setI
(
BigDecimal
.
ZERO
)
xAxis
.
setI
(
BigDecimal
.
ZERO
)
pose
.
setXAxis
(
xAxis
)
zAxis
=
VectorType
()
zAxis
.
setI
(
BigDecimal
.
ZERO
)
zAxis
.
setI
(
BigDecimal
.
ZERO
)
zAxis
.
setI
(
BigDecimal
.
ONE
)
pose
.
setXAxis
(
zAxis
)
moveTo
.
setEndPosition
(
pose
)
moveTo
.
setMoveStraight
(
java
.
lang
.
Boolean
.
FALSE
)
s
.
writeCommand
(
instance
)
## Create and send getStatus request.
print
"Send GetStatus"
getStat
=
GetStatusType
()
getStat
.
setCommandID
(
BigInteger
.
valueOf
(
9
))
instance
.
setCRCLCommand
(
getStat
)
s
.
writeCommand
(
instance
)
## Read status from server
stat
=
s
.
readStatus
()
## Print out the status details.
cmdStat
=
stat
.
getCommandStatus
()
IDback
=
cmdStat
.
getCommandID
()
print
"Status:"
print
(
"CommandID = "
+
IDback
.
toString
())
print
(
"State = "
+
cmdStat
.
getCommandState
().
toString
())
pt
=
stat
.
getPose
().
getPoint
()
print
(
"pose = "
+
pt
.
getX
().
toString
()
+
","
+
pt
.
getY
().
toString
()
+
","
+
pt
.
getZ
().
toString
())
jst
=
stat
.
getJointStatuses
()
l
=
jst
.
getJointStatus
()
print
"Joints:"
for
i
in
range
(
0
,
l
.
size
()):
js
=
l
.
get
(
i
)
print
(
"Num="
+
js
.
getJointNumber
().
toString
()
+
" Pos="
+
js
.
getJointPosition
().
toString
())
Back
|
FazBrowse Home
|
New Git URL