rosjava actionlib waitForResult() function [closed]

asked 2012-04-28 05:59:10 -0600

safzam gravatar image

updated 2012-04-30 04:54:31 -0600

Hi All, Follwoing code is in a Callback, Each time Callback is executed I need to wait for the result from Action Server. I observed that only first time WaitForResult() works but then it does not wait at all. Can anyone help me fix this? Thanks

DiagnosisRepairActionNodeSpec spec = new DiagnosisRepairActionNodeSpec(); SimpleActionClient<diagnosisrepairactionfeedback, diagnosisrepairactiongoal,="" diagnosisrepairactionresult,="" diagnosisrepairfeedback,="" diagnosisrepairgoal,="" diagnosisrepairresult=""> sac = (SimpleActionClient) spec.buildSimpleActionClient("abc");

System.out.println("[Test] Waiting for action server to start!"); sac.waitForServer(); System.out.println("Server started....");

DiagnosisRepairGoal repairGoal= spec.createGoalMessage();

ArrayList<string> params = new ArrayList<string>(); params.add("start_node"); repairGoal.parameter = params; sac.sendGoal(repairGoal);

SimpleClientGoalState state = sac.getState(); System.out.println("state before getting result:="+state.toString());

finished_before_timeout = sac.waitForResult(10, TimeUnit.SECONDS);

if (finished_before_timeout) { state = sac.getState(); System.out.println("state after getting result="+state.toString()); DiagnosisRepairResult res = sac.getResult(); System.out.println("Result is back in time is."+Integer.toString(res.result)); }else{ log.info("[Test] Action did not finish before the time out");
}

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by tfoote
close date 2014-08-16 23:57:42.173662