Skip to content
Snippets Groups Projects
Commit b865a703 authored by Ernesto Corbellini's avatar Ernesto Corbellini
Browse files

Fixed string compare in goal id.

Made private most of the properties in ActionClient class.
parent 5aaded2f
No related branches found
No related tags found
No related merge requests found
...@@ -46,21 +46,21 @@ public class ActionClient<T_ACTION_GOAL extends Message, ...@@ -46,21 +46,21 @@ public class ActionClient<T_ACTION_GOAL extends Message,
T_ACTION_GOAL actionGoal; T_ACTION_GOAL actionGoal;
ClientGoalManager<T_ACTION_GOAL> goalManager; ClientGoalManager<T_ACTION_GOAL> goalManager;
String actionGoalType; private String actionGoalType;
String actionResultType; private String actionResultType;
String actionFeedbackType; private String actionFeedbackType;
Publisher<T_ACTION_GOAL> goalPublisher = null; private Publisher<T_ACTION_GOAL> goalPublisher = null;
Publisher<GoalID> cancelPublisher = null; private Publisher<GoalID> cancelPublisher = null;
Subscriber<T_ACTION_RESULT> serverResult = null; private Subscriber<T_ACTION_RESULT> serverResult = null;
Subscriber<T_ACTION_FEEDBACK> serverFeedback = null; private Subscriber<T_ACTION_FEEDBACK> serverFeedback = null;
Subscriber<GoalStatusArray> serverStatus = null; private Subscriber<GoalStatusArray> serverStatus = null;
ConnectedNode node = null; private ConnectedNode node = null;
String actionName; private String actionName;
ActionClientListener callbackTarget = null; private ActionClientListener callbackTarget = null;
GoalIDGenerator goalIdGenerator = null; GoalIDGenerator goalIdGenerator = null;
volatile boolean statusReceivedFlag = false; private volatile boolean statusReceivedFlag = false;
volatile boolean feedbackPublisherFlag = false; private volatile boolean feedbackPublisherFlag = false;
volatile boolean resultPublisherFlag = false; private volatile boolean resultPublisherFlag = false;
private Log log = LogFactory.getLog(ActionClient.class); private Log log = LogFactory.getLog(ActionClient.class);
/** /**
...@@ -263,6 +263,10 @@ public class ActionClient<T_ACTION_GOAL extends Message, ...@@ -263,6 +263,10 @@ public class ActionClient<T_ACTION_GOAL extends Message,
* depends on the application. * depends on the application.
*/ */
public void gotFeedback(T_ACTION_FEEDBACK message) { public void gotFeedback(T_ACTION_FEEDBACK message) {
ActionFeedback<T_ACTION_FEEDBACK> af = new ActionFeedback(message);
if (af.getGoalStatusMessage().getGoalId().getId().equals(goalManager.actionGoal.getGoalId())) {
goalManager.updateStatus(af.getGoalStatusMessage().getStatus());
}
// Propagate the callback // Propagate the callback
if (callbackTarget != null) { if (callbackTarget != null) {
callbackTarget.feedbackReceived(message); callbackTarget.feedbackReceived(message);
...@@ -281,6 +285,8 @@ public class ActionClient<T_ACTION_GOAL extends Message, ...@@ -281,6 +285,8 @@ public class ActionClient<T_ACTION_GOAL extends Message,
if (gstat != null) { if (gstat != null) {
// update the goal status tracking // update the goal status tracking
goalManager.updateStatus(gstat.getStatus()); goalManager.updateStatus(gstat.getStatus());
} else {
log.info("Status update is not for our goal!");
} }
// Propagate the callback // Propagate the callback
if (callbackTarget != null) { if (callbackTarget != null) {
...@@ -300,7 +306,8 @@ public class ActionClient<T_ACTION_GOAL extends Message, ...@@ -300,7 +306,8 @@ public class ActionClient<T_ACTION_GOAL extends Message,
GoalStatus gstat = null; GoalStatus gstat = null;
List<GoalStatus> statusList = statusMessage.getStatusList(); List<GoalStatus> statusList = statusMessage.getStatusList();
for (GoalStatus s : statusList) { for (GoalStatus s : statusList) {
if (s.getGoalId().getId() == goalManager.actionGoal.getGoalId()) { log.info("Found >> " + s.getGoalId().getId() + " when searching for >> " + goalManager.actionGoal.getGoalId());
if (s.getGoalId().getId().equals(goalManager.actionGoal.getGoalId())) {
// this is the goal we are interested in // this is the goal we are interested in
gstat = s; gstat = s;
} }
...@@ -347,6 +354,9 @@ public class ActionClient<T_ACTION_GOAL extends Message, ...@@ -347,6 +354,9 @@ public class ActionClient<T_ACTION_GOAL extends Message,
} }
} }
public int getGoalState() {
return goalManager.getGoalState();
}
/** /**
* Finish the action client. Unregister publishers and listeners. * Finish the action client. Unregister publishers and listeners.
*/ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment