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
95b5c6b8
Commit
95b5c6b8
authored
9 years ago
by
Ernesto Corbellini
Browse files
Options
Downloads
Patches
Plain Diff
Added state translation to get a meaninful string.
parent
ead8f66e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide 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
+49
-18
49 additions, 18 deletions
...m/github/ekumen/rosjava_actionlib/ClientStateMachine.java
with
49 additions
and
18 deletions
src/rosjava_actionlib/rosjava_actionlib/src/main/java/com/github/ekumen/rosjava_actionlib/ClientStateMachine.java
+
49
−
18
View file @
95b5c6b8
...
...
@@ -20,6 +20,8 @@ import java.lang.Exception;
import
actionlib_msgs.GoalStatus
;
import
java.util.Vector
;
import
java.util.Iterator
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
/**
...
...
@@ -40,24 +42,58 @@ public class ClientStateMachine {
public
final
static
int
PREEMPTING
=
6
;
public
final
static
int
DONE
=
7
;
public
final
static
int
LOST
=
8
;
public
static
String
translateState
(
int
state
)
{
String
stateName
;
switch
(
state
)
{
case
INVALID_TRANSITION:
stateName
=
"INVALID_TRANSITION"
;
break
;
case
NO_TRANSITION:
stateName
=
"NO_TRANSITION"
;
break
;
case
WAITING_FOR_GOAL_ACK:
stateName
=
"WAITING_FOR_GOAL_ACK"
;
break
;
case
PENDING:
stateName
=
"PENDING"
;
break
;
case
ACTIVE:
stateName
=
"ACTIVE"
;
break
;
case
WAITING_FOR_RESULT:
stateName
=
"WAITING_FOR_RESULT"
;
break
;
case
WAITING_FOR_CANCEL_ACK:
stateName
=
"WAITING_FOR_CANCEL_ACK"
;
break
;
case
RECALLING:
stateName
=
"RECALLING"
;
break
;
case
PREEMPTING:
stateName
=
"PREEMPTING"
;
break
;
case
DONE:
stateName
=
"DONE"
;
break
;
case
LOST:
stateName
=
"LOST"
;
break
;
default
:
stateName
=
"UNKNOWN_STATE"
;
break
;
}
return
stateName
;
}
}
int
latestGoalStatus
;
int
state
;
int
nextState
;
/**
* Constructor
*/
public
void
ClientStateMachine
()
{
// interface object for the callbacks?
// store arguments locally in the object
//this.goal = actionGoal;
}
private
Log
log
=
LogFactory
.
getLog
(
ActionClient
.
class
);
public
synchronized
void
setState
(
int
state
)
{
log
.
info
(
"ClientStateMachine - State changed from "
+
this
.
state
+
" to "
+
state
);
this
.
state
=
state
;
}
...
...
@@ -89,9 +125,7 @@ public class ClientStateMachine {
// Determine the next state
//if (this.state
}
}
/**
...
...
@@ -107,6 +141,8 @@ public class ClientStateMachine {
nextStates
=
getTransition
(
goalStatus
);
iterStates
=
nextStates
.
iterator
();
log
.
info
(
"ClientStateMachine - State transition invoked."
);
while
(
iterStates
.
hasNext
())
{
this
.
state
=
iterStates
.
next
();
}
...
...
@@ -432,9 +468,4 @@ public class ClientStateMachine {
public
void
markAsLost
()
{
}
public
void
updateResult
(
int
statusResult
)
{
}
}
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