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
f3abd806
Commit
f3abd806
authored
9 years ago
by
Ernesto Corbellini
Browse files
Options
Downloads
Patches
Plain Diff
Modified sending loop in test client.
Added a cancel demo.
parent
a65e7fb6
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
+24
-8
24 additions, 8 deletions
.../java/com/github/ekumen/rosjava_actionlib/TestClient.java
with
24 additions
and
8 deletions
src/rosjava_actionlib/rosjava_actionlib/src/main/java/com/github/ekumen/rosjava_actionlib/TestClient.java
+
24
−
8
View file @
f3abd806
...
@@ -27,28 +27,44 @@ public class TestClient extends AbstractNodeMain implements ActionClientListener
...
@@ -27,28 +27,44 @@ 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
);
FibonacciActionGoal
goalMessage
;
int
repeat
=
3
;
int
repeat
=
3
;
int
i
;
String
goalId
=
"fibonacci_test_"
;
// Attach listener for the callbacks
// Attach listener for the callbacks
ac
.
attachListener
(
this
);
ac
.
attachListener
(
this
);
// Create Fibonacci goal message
// Create Fibonacci goal message
FibonacciActionGoal
goalMessage
=
(
FibonacciActionGoal
)
ac
.
newGoalMessage
();
//
goalMessage = (FibonacciActionGoal)ac.newGoalMessage();
FibonacciGoal
fibonacciGoal
=
goalMessage
.
getGoal
();
//
FibonacciGoal fibonacciGoal = goalMessage.getGoal();
// set Fibonacci parameter
// set Fibonacci parameter
fibonacciGoal
.
setOrder
(
6
);
//
fibonacciGoal.setOrder(6);
while
(
repeat
>
0
)
{
for
(
i
=
0
;
i
<
repeat
;
i
++
)
{
sleep
(
10000
);
sleep
(
10000
);
System
.
out
.
println
(
"Sending goal #"
+
repeat
+
"..."
);
System
.
out
.
println
(
"Sending goal #"
+
i
+
"..."
);
ac
.
sendGoal
(
goalMessage
);
goalMessage
=
(
FibonacciActionGoal
)
ac
.
newGoalMessage
();
goalMessage
.
getGoal
().
setOrder
(
i
);
ac
.
sendGoal
(
goalMessage
,
goalId
+
i
);
System
.
out
.
println
(
"Goal sent."
);
System
.
out
.
println
(
"Goal sent."
);
//while(!resultReceived) sleep(100);
resultReceived
=
false
;
resultReceived
=
false
;
repeat
--;
}
}
// send another message and cancel it
goalId
+=
i
;
goalMessage
=
(
FibonacciActionGoal
)
ac
.
newGoalMessage
();
goalMessage
.
getGoal
().
setOrder
(
i
);
System
.
out
.
println
(
"Sending goal ID: "
+
goalId
+
"..."
);
ac
.
sendGoal
(
goalMessage
,
goalId
);
System
.
out
.
println
(
"Goal sent."
);
sleep
(
2000
);
System
.
out
.
println
(
"Cancelling goal ID: "
+
goalId
);
GoalID
gid
=
ac
.
getGoalId
(
goalMessage
);
ac
.
sendCancel
(
gid
);
sleep
(
10000
);
System
.
exit
(
0
);
System
.
exit
(
0
);
}
}
...
...
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