Why 6 Action messages? Where are the Actions messages for Cancel and Status?

Hi all,

I am wondering why there are 6 action messages. And where is the cancel and result message, as the picture shows?

my_custom_action_msg_pkg/NameAction
my_custom_action_msg_pkg/NameActionFeedback
my_custom_action_msg_pkg/NameActionGoal
my_custom_action_msg_pkg/NameActionResult
my_custom_action_msg_pkg/NameFeedback
my_custom_action_msg_pkg/NameGoal
my_custom_action_msg_pkg/NameResult

image

Best regards,
Kailin

Hi @kailin.tong,

These are not six messages, only three, each corresponding three of the topics below. I think which three should be obvious :wink:.

First, let’s see these topics:

user:~$ rostopic list
/action_custom_msg_as/cancel
/action_custom_msg_as/feedback
/action_custom_msg_as/goal
/action_custom_msg_as/result
/action_custom_msg_as/status
# ...

I suppose your doubt is coming from the fact that nothing was mentioned about messages for cancel and status, which are somewhat unpopular. I’ll address this shortly.

The ‘popular’ Action messages

Let’s address the three popular messages first. As mentioned in the notebook,

When working from the terminal and you want to interact with these topics, you need to use these messages:

my_custom_action_msg_pkg/NameActionGoal
my_custom_action_msg_pkg/NameActionFeedback
my_custom_action_msg_pkg/NameActionResult

You will typically only use the first one (‘goal’) because you’re typically acting as a "client’ from the shell. It would be rather awkward to send feedback and result from the shell.

However, when working from code, you need to use the following, which are equivalent to the three above - they work on the same topics:

my_custom_action_msg_pkg/NameGoal
my_custom_action_msg_pkg/NameFeedback
my_custom_action_msg_pkg/NameResult

In this case, you use the first one in a client and the other two in a server.

The ‘unpopular’ Action messages

Now let’s talk about cancel and status.

To interact with this from the shell, you use the messages below (shown under Type). Please also note that you’re more likely to use the cancel message because it’s the one used by the client. You’ll hardly publish a status message from the shell because it’s done by the server.

user:~$ rostopic info /action_custom_msg_as/cancel
Type: actionlib_msgs/GoalID

Publishers: None

Subscribers:
 * /action_custom_msg_server (http://rosdscomputer:33535/)


user:~$ rostopic info /action_custom_msg_as/status
Type: actionlib_msgs/GoalStatusArray

Publishers:
 * /action_custom_msg_server (http://rosdscomputer:33535/)

Subscribers: None


user:~$

To interact with cancel and status programmatically, the popular way is to use convenience functions provided by actionlib, from the client:

client = actionlib.SimpleActionClient('/ardrone_action_server', ArdroneAction)
# ...
client.get_status() # 'status'
#...
client.cancel_all_goals() # 'cancel'

Hope this helps.

Cheers.

2 Likes