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

A string goal with actionlib

asked 2017-07-18 16:07:24 -0600

AndyZe gravatar image

updated 2017-07-18 16:15:40 -0600

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 flag offensive close merge delete

Comments

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"
AndyZe gravatar image AndyZe  ( 2017-07-18 16:32:44 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-07-18 16:28:23 -0600

velveteenrobot gravatar image

updated 2017-07-18 16:30:35 -0600

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
edit flag offensive delete link more

Comments

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.

AndyZe gravatar image AndyZe  ( 2017-07-18 16:34:39 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-07-18 16:07:24 -0600

Seen: 1,481 times

Last updated: Jul 18 '17