Using a action's result - Pt. 2
Hello together,
I already had a problem using the result of an action.
After implementing the solution of @mgruhler, another problem occurred.
This time I have another problem: The result
is defined in the action file and consists of several float values:
translationx
translationy
translationz
I would like to see the result by using ROS_INFO("X value: %f", result.translationx)
.
Unfortunately the compiler says: DetectionResult has no member named 'translationx'.
EDIT
The full action file is:
#goal definition
float64 ObjectID
---
#result definition
float64 translationx
float64 translationy
float64 translationz
---
#feedback
bool isProcessing
In the following you see the C++ source code within the main
function:
bool finished_before_timeout = ac.waitForResult(ros::Duration(30.0));
if (finished_before_timeout){
actionlib::SimpleClientGoalState state = ac.getState();
manipulator::DetectionResultConstPtr result = ac.getResult();
ROS_INFO("Action finished: %s", state.toString().c_str());
ROS_INFO("X Value: %f", result.translationx);
}
else{
ROS_INFO("Action did not finish before the time out.");
}
ac
is the action client.
can you please show your full action definition? This seems to be a non-standard ROS action. This will help in debugging.
Please don't edit anything (except for maybe removing comments).
Can you post your full source (or at least all of this that's relevant) we can't help you much from a single line. The same goes for the compiler error, the full error text is far more useful.
The full action definition is added to question above. The design in the comment section is suitable, so I edited my original question.
Thanks for the update. But your c++ source is more important in this case, sorry if I wasn't clear.
Now I added the source code too.