m.setAccessible(true);// workaround for known bug http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6924232
h=(Header)m.invoke(goalMessage);
}
catch(Exceptione){
e.printStackTrace(System.out);
}
}
returnh;
}
publicvoidsetHeaderMessage(Headerh){
publicstaticclassGoalStates
{
publicfinalstaticintPENDING=0;// The goal has yet to be processed by the action server
publicfinalstaticintACTIVE=1;// The goal is currently being processed by the action server
publicfinalstaticintREJECTED=2;// The goal was rejected by the action server without being processed and without a request from the action client to cancel
publicfinalstaticintSUCCEEDED=3;// The goal was achieved successfully by the action server
publicfinalstaticintABORTED=4;// The goal was aborted by the action server
publicfinalstaticintPREEMPTING=5;// Processing of the goal was canceled by either another goal, or a cancel request sent to the action server
publicfinalstaticintPREEMPTED=6;// The goal was preempted by either another goal, or a preempt message being sent to the action server
publicfinalstaticintRECALLING=7;// The goal has not been processed and a cancel request has been received from the action client, but the action server has not confirmed the goal is canceled
publicfinalstaticintRECALLED=8;// The goal was canceled by either another goal, or a cancel request before the action server began processing the goal
publicfinalstaticintLOST=9;// The goal was sent
}
}
intfindStatus(intstatusArray)
publicStringgetGoalId(){
{
Stringid=null;
return0;
GoalIDgid=getGoalIdMessage();
if(gid!=null){
try{
Methodm=gid.getClass().getMethod("getId");
m.setAccessible(true);// workaround for known bug http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6924232
id=(String)m.invoke(gid);
}
catch(Exceptione){
e.printStackTrace(System.out);
}
}
returnid;
}
/**
* Set the action goal's goal ID string and timestamp.