Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
rosjava_actionlib
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sebastian Ebert
rosjava_actionlib
Commits
f0d5d8f7
Commit
f0d5d8f7
authored
9 years ago
by
Ernesto Corbellini
Browse files
Options
Downloads
Patches
Plain Diff
Testing.
parent
4e616144
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/rosjava_actionlib/rosjava_actionlib/src/main/java/com/github/ekumen/rosjava_actionlib/TestClient.java
+30
-7
30 additions, 7 deletions
.../java/com/github/ekumen/rosjava_actionlib/TestClient.java
with
30 additions
and
7 deletions
src/rosjava_actionlib/rosjava_actionlib/src/main/java/com/github/ekumen/rosjava_actionlib/TestClient.java
+
30
−
7
View file @
f0d5d8f7
...
@@ -13,6 +13,7 @@ import actionlib_tutorials.FibonacciResult;
...
@@ -13,6 +13,7 @@ import actionlib_tutorials.FibonacciResult;
public
class
TestClient
extends
AbstractNodeMain
implements
ActionClientListener
<
FibonacciActionFeedback
,
FibonacciActionResult
>
{
public
class
TestClient
extends
AbstractNodeMain
implements
ActionClientListener
<
FibonacciActionFeedback
,
FibonacciActionResult
>
{
ActionClient
ac
;
ActionClient
ac
;
volatile
private
boolean
responded
=
false
;
@Override
@Override
public
GraphName
getDefaultNodeName
()
{
public
GraphName
getDefaultNodeName
()
{
...
@@ -22,6 +23,7 @@ public class TestClient extends AbstractNodeMain implements ActionClientListener
...
@@ -22,6 +23,7 @@ public class TestClient extends AbstractNodeMain implements ActionClientListener
@Override
@Override
public
void
onStart
(
ConnectedNode
node
)
{
public
void
onStart
(
ConnectedNode
node
)
{
ac
=
new
ActionClient
<
FibonacciActionGoal
,
FibonacciActionFeedback
,
FibonacciActionResult
>(
node
,
"/fibonacci"
,
FibonacciActionGoal
.
_TYPE
,
FibonacciActionFeedback
.
_TYPE
,
FibonacciActionResult
.
_TYPE
);
ac
=
new
ActionClient
<
FibonacciActionGoal
,
FibonacciActionFeedback
,
FibonacciActionResult
>(
node
,
"/fibonacci"
,
FibonacciActionGoal
.
_TYPE
,
FibonacciActionFeedback
.
_TYPE
,
FibonacciActionResult
.
_TYPE
);
int
repeat
=
3
;
// Attach listener for the callbacks
// Attach listener for the callbacks
ac
.
attachListener
(
this
);
ac
.
attachListener
(
this
);
...
@@ -34,15 +36,26 @@ public class TestClient extends AbstractNodeMain implements ActionClientListener
...
@@ -34,15 +36,26 @@ public class TestClient extends AbstractNodeMain implements ActionClientListener
fibonacciGoal
.
setOrder
(
6
);
fibonacciGoal
.
setOrder
(
6
);
goalMessage
.
setGoal
(
fibonacciGoal
);
goalMessage
.
setGoal
(
fibonacciGoal
);
while
(
true
)
{
while
(
repeat
>
0
)
{
sleep
(
1000
);
System
.
out
.
println
(
"Sending goal #"
+
repeat
+
"..."
);
ac
.
sendGoal
(
goalMessage
);
ac
.
sendGoal
(
goalMessage
);
try
{
System
.
out
.
println
(
"Goal sent."
);
Thread
.
sleep
(
10000
)
;
repeat
--
;
}
}
catch
(
InterruptedException
ex
)
{
;
while
(
repeat
>
0
)
{
responded
=
false
;
ac
.
sendGoal
(
goalMessage
);
while
(!
responded
)
{
}
}
repeat
--;
}
}
System
.
out
.
println
(
"Finishing node!!"
);
sleep
(
30000
);
ac
.
finish
();
node
.
shutdown
();
}
}
@Override
@Override
...
@@ -51,6 +64,8 @@ public class TestClient extends AbstractNodeMain implements ActionClientListener
...
@@ -51,6 +64,8 @@ public class TestClient extends AbstractNodeMain implements ActionClientListener
int
[]
sequence
=
result
.
getSequence
();
int
[]
sequence
=
result
.
getSequence
();
int
i
;
int
i
;
responded
=
true
;
System
.
out
.
print
(
"Got Fibonacci result sequence! "
);
System
.
out
.
print
(
"Got Fibonacci result sequence! "
);
for
(
i
=
0
;
i
<
sequence
.
length
;
i
++)
for
(
i
=
0
;
i
<
sequence
.
length
;
i
++)
System
.
out
.
print
(
Integer
.
toString
(
sequence
[
i
])
+
" "
);
System
.
out
.
print
(
Integer
.
toString
(
sequence
[
i
])
+
" "
);
...
@@ -73,4 +88,12 @@ public class TestClient extends AbstractNodeMain implements ActionClientListener
...
@@ -73,4 +88,12 @@ public class TestClient extends AbstractNodeMain implements ActionClientListener
public
void
statusReceived
(
Message
status
)
{
public
void
statusReceived
(
Message
status
)
{
}
}
private
void
sleep
(
long
msec
)
{
try
{
Thread
.
sleep
(
msec
);
}
catch
(
InterruptedException
ex
)
{
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment