# A string goal with actionlib

I'm just starting out with ROS actions. The example uses the goal type uint32, but I wanted to use a std_msgs::String. This is my action file:

# Define the goal
string sequence_name  # Name the sequence to run, e.g. "turn handle clockwise"
---
# Define the result (typically an incremental result, but just boolean in this case)
bool in_progress
---
# Define a feedback message
bool success


Although I stated "string" for the goal, it looks like the goal message compiles as an unsigned int type. Passing an int argument like this compiles successfully:

temoto::PreplannedSequenceGoal goal;
goal.sequence_name = 1;
preplanned_sequence_client_.waitForServer();
preplanned_sequence_client_.sendGoal(goal);


Whereas passing a std_msgs::String does not compile (type mismatch).

So, in short, can I use datatypes other than uint32 and float32 for the Action message components?

edit retag close merge delete

Actually, here's the autogenerated msg file. It is a uint32, not a string, so I guess uint32 is the only option.

# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======
# Define the goal
uint32 sequence_name  # Name the sequence to run, e.g. "turn handle clockwise"

( 2017-07-18 16:32:44 -0500 )edit

Sort by » oldest newest most voted

std_msgs/String is different the string type that you used when defining the action. I would imagine that if you did:

goal.sequence_name = "string";


it would probably also work.

Additionally, if you want the type to be std_msgs/String, you would have to do this in your action file:

# Define the goal
std_msgs/String sequence_name  # Name the sequence to run, e.g. "turn handle clockwise"
---
# Define the result (typically an incremental result, but just boolean in this case)
bool in_progress
---
# Define a feedback message
bool success

more

Eventually I found out-- you are right... There was an older Action file that never got deleted, so changing the new Action file didn't have any effect.

( 2017-07-18 16:34:39 -0500 )edit