FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
java4cpp/src/test/resources/use_crcl.cpp at java4cpp-1.2 · 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
/
src
/
test
/
resources
/
use_crcl.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
82 lines (69 loc) · 2.57 KB
Breadcrumbs
java4cpp
/
src
/
test
/
resources
/
use_crcl.cpp
Copy path
File metadata and controls
82 lines (69 loc) · 2.57 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
73
74
75
76
77
78
79
80
81
82
#
include
"
crclj.h
"
#
include
<
iostream
>
using
namespace
crclj
;
using
namespace
crclj
::crcl::base
;
using
namespace
crclj
::crcl::utils
;
using
namespace
crclj
::java::math
;
using
namespace
crclj
::java::util
;
using
namespace
std
;
int
main
(
int
argc,
const
char
**argv) {
try
{
//
Connect to the server
CRCLSocket
s
(
"
localhost
"
,
64444
);
//
Create an instance to wrap all commands.
CRCLCommandInstanceType instance;
//
Create and send init command.
InitCanonType initCmd;
initCmd.
setCommandID
(
BigInteger::valueOf
(
7
));
instance.
setCRCLCommand
(initCmd);
s.
writeCommand
(instance,
JNI_FALSE
);
//
Create and send MoveTo command.
MoveToType moveTo;
moveTo.
setCommandID
(
BigInteger::valueOf
(
8
));
PoseType pose;
PointType pt;
pt.
setX
(
BigDecimal::valueOf
(
1.1
));
pt.
setY
(
BigDecimal::valueOf
(
0.0
));
pt.
setZ
(
BigDecimal::valueOf
(
0.1
));
pose.
setPoint
(pt);
VectorType xAxis;
xAxis.
setI
(
BigDecimal::getONE
());
xAxis.
setI
(
BigDecimal::getZERO
());
xAxis.
setI
(
BigDecimal::getZERO
());
pose.
setXAxis
(xAxis);
VectorType zAxis;
zAxis.
setI
(
BigDecimal::getZERO
());
zAxis.
setI
(
BigDecimal::getZERO
());
zAxis.
setI
(
BigDecimal::getZERO
());
pose.
setXAxis
(zAxis);
moveTo.
setEndPosition
(pose);
moveTo.
setMoveStraight
(
false
);
s.
writeCommand
(instance,
false
);
GetStatusType getStat;
getStat.
setCommandID
(
BigInteger::valueOf
(
9
));
instance.
setCRCLCommand
(getStat);
s.
writeCommand
(instance,
JNI_FALSE
);
CRCLStatusType stat = s.
readStatus
(
JNI_FALSE
);
CommandStatusType cmdStat = stat.
getCommandStatus
();
BigInteger IDback = cmdStat.
getCommandID
();
PrintObject
(
"
Command ID=
"
, IDback);
PrintObject
(
"
stat=
"
,stat);
pose = stat.
getPose
();
PrintObject
(
"
pose=
"
,pose);
pt = pose.
getPoint
();
PrintObject
(
"
X:
"
,pt.
getX
());
PrintObject
(
"
Y:
"
,pt.
getY
());
PrintObject
(
"
Z:
"
,pt.
getZ
());
JointStatusesType jst = stat.
getJointStatuses
();
List l = jst.
getJointStatus
();
for
(
int
i =
0
; i < l.
size
(); i++) {
JointStatusType elem;
elem =
JointStatusType::cast
(l.
get
(i));
PrintObject
(
"
Joint Number :
"
,elem.
getJointNumber
());
PrintObject
(
"
Joint Position :
"
,elem.
getJointPosition
());
}
cout <<
"
End of C++ main() reached.
"
<< endl;
}
catch
(jthrowable t) {
PrintJThrowable
(
"
Exception Thrown :
"
, t);
}
}
Back
|
FazBrowse Home
|
New Git URL