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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sebastian Ebert
rosjava_actionlib
Commits
10581318
Commit
10581318
authored
9 years ago
by
Ernesto Corbellini
Browse files
Options
Downloads
Patches
Plain Diff
Added cancel event to the state machine.
parent
08885cec
Branches
Branches containing commit
No related tags found
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/ClientStateMachine.java
+20
-13
20 additions, 13 deletions
...m/github/ekumen/rosjava_actionlib/ClientStateMachine.java
with
20 additions
and
13 deletions
src/rosjava_actionlib/rosjava_actionlib/src/main/java/com/github/ekumen/rosjava_actionlib/ClientStateMachine.java
+
20
−
13
View file @
10581318
...
...
@@ -25,9 +25,6 @@ import java.util.Iterator;
/**
* State machine for the action client.
* @author Ernesto Corbellini ecorbellini@ekumenlabs.com
* Comments:
* - The state returned on a transition is actually a vector of states that should be transitioned in sequence.
* TODO: change class name to ClientStateMachine
*/
public
class
ClientStateMachine
{
// Local class to hold the states
...
...
@@ -45,7 +42,6 @@ public class ClientStateMachine {
public
final
static
int
LOST
=
8
;
}
ActionGoal
goal
;
int
latestGoalStatus
;
int
state
;
int
nextState
;
...
...
@@ -61,14 +57,6 @@ public class ClientStateMachine {
//this.goal = actionGoal;
}
/*
* Compare two objects.
*/
public
boolean
equals
(
ClientStateMachine
obj
)
{
//return actionGoal.goalId.id == obj.actionGoal.goalId.id;
return
true
;
}
public
synchronized
void
setState
(
int
state
)
{
this
.
state
=
state
;
}
...
...
@@ -422,6 +410,25 @@ public class ClientStateMachine {
return
stateList
;
}
/**
* Cancel action goal. The goal can only be cancelled if its in certain
* states. If it can be cancelled the state will be changed to
* WAITING_FOR_CANCEL_ACK.
* @return True if the goal can be cancelled, false otherwise.
*/
public
boolean
cancel
()
{
bolean
ret
=
false
;
switch
(
stateMachine
.
getState
())
{
case
ClientStates
.
WAITING_FOR_GOAL_ACK
:
case
ClientStates
.
PENDING
:
case
ClientStates
.
ACTIVE
:
this
.
state
=
ClientStates
.
WAITING_FOR_CANCEL_ACK
;
ret
=
true
;
break
;
}
return
ret
;
}
public
void
markAsLost
()
{
}
...
...
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