ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Using a action's result

asked 2018-12-05 02:50:44 -0500

waltejon gravatar image

updated 2018-12-10 05:27:46 -0500

Hello together,

together with another student, we have written a action client and server by using actionlib/client/simple_action_client.h and actionlib/server/simple_action_server.h.

At the terminal we can see the result correctly.

Now we would like to use result for further activities. For this the source file of the client contains:

actionlib::SimpleActionClient<manipulator::DetectionAction>::ResultConstPtr result = *(ac.getResult())

ac is our action client, manipulator::DetectionAction is the ActionSpecs from the header file.

We have already started several attempts, but still are unsuccessful.

The compiler error is

actionlib::SimpleActionClient<manipulator::DetectionAction>::ResultConstPtr is private.

We would really appreciate, if someone could help us.

Thanks a lot!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2018-12-06 01:50:44 -0500

mgruhler gravatar image

What should work is the following:

DetectionResultConstPtr result = ac.getResult();

A little bit of background:

With

actionlib::SimpleActionClient<manipulator::DetectionAction>::ResultConstPtr

you are trying to access a private typedef declared in actionlib/action_defintion.h and actionlib/action_client.h. Also, getResult already returns a ResultConstPtr, so adding *(ac....) will not work as well.

As the action definitions are templated, and you want to get the result (which has nothing to do with the client itself), DetectionResultConstPtr is the way to go here.

edit flag offensive delete link more

Comments

Thank you for the support! Your answer is correct.

Now we have another error that can be seen in the picture above. We already inspected this question... Could you help us?

waltejon gravatar image waltejon  ( 2018-12-10 05:14:15 -0500 )edit

If this question is solved, please mark the answer as correct by clicking on the check mark next to it. For a new question, please open a new one ;-) You can cross-link using q#NUMBER (from the url) and mention people using @USERNAME.

mgruhler gravatar image mgruhler  ( 2018-12-10 05:19:09 -0500 )edit

Now, that the image is there: please don't post images of terminal output. This is not searchable by search enginges and the URLs might go away.

Please add a new question, paste the terminal output, and format it using the preformatted text button (the ones with 010101) on it as source code.

mgruhler gravatar image mgruhler  ( 2018-12-10 05:21:16 -0500 )edit

All right, thanks for the advice.

waltejon gravatar image waltejon  ( 2018-12-10 05:26:57 -0500 )edit

It didn't work for me with DetectionResultConstPtr result = ac.getResult(); It needed the package name as well, so manipulator::DetectionResultConstPtr result = ac.getResult(); as mentioned in this question

nimish gravatar image nimish  ( 2020-12-09 15:57:29 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2018-12-05 02:50:44 -0500

Seen: 2,025 times

Last updated: Dec 10 '18