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

actionlib client, How to get goal ID?

asked 2017-07-07 08:57:03 -0500

Synedx gravatar image

updated 2017-07-10 04:17:40 -0500

Hi all,

I have simple action client and server. What I want to do is to get goal ID in action client.

When I send a goal to action server, it generates a goal ID and publishes all status and feedback messages with this unique goal ID. How can I get this corresponding goal ID in action client?

I want to track status of goals from /action_server/status topic, not from ActionClient's getState() method. So to be able to find my goal from status list array in /status topic, I need to know the generated goal ID.

Any idea?

edit retag flag offensive close merge delete


You want to look from "outside" into the client<->server connection? So both client and server are not written by you?

agutenkunst gravatar image agutenkunst  ( 2017-07-08 08:51:43 -0500 )edit

Not exactly. Client is written by me, however I want to track the status of the goal from /status topic. Not using GoalHandle. So I need goal ID in client side.

Synedx gravatar image Synedx  ( 2017-07-10 04:16:26 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2017-07-10 13:39:19 -0500

tfoote gravatar image

The Simple Action Client is designed to be a simple example of how to write an action client. If you'd like to have more functionality I'd recommend either extending it or using the core ActionClient and implementing your desired extended behavior.

edit flag offensive delete link more


Thanks for the answer, but I could not find any member which I can retrieve goal_id from.ActionClient and ClientGoalHandle do not seem to provide any way to get goal_id.Seems like I need to change src of GoalHandle to reach list_handle_.getElem()->getActionGoal()-> Any clue on this?

Synedx gravatar image Synedx  ( 2017-07-11 01:45:12 -0500 )edit

answered 2017-07-10 05:22:43 -0500

Akif gravatar image

In fact, goal ID is stored in client side but not exposed to public.

In GoalHandle, actionlib uses goal ID to cancel a goal. But list_handle_ is private therefore you cannot get goal ID over it. You can check

Even tough I suggest tracking a goal status over GoalHandle, if you need it, maybe you can fork and change actionlib source accordingly. Or post an issue to upstream repo, if there is no appearent reason preventing it, authors may add a public member function like getGoalID() to ClientGoalHandle class (or you can post a PR).

@Dirk Thomas or @tfoote may help at this point.

edit flag offensive delete link more


Thanks for the answer. In fact I do not want to alter the source code of actionlib to get updates regularly. Still looking for a better option.

Synedx gravatar image Synedx  ( 2017-07-11 01:54:21 -0500 )edit

Question Tools



Asked: 2017-07-07 08:57:03 -0500

Seen: 1,819 times

Last updated: Jul 10 '17