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

Revision history [back]

click to hide/show revision 1
initial version

And here is my callback function:

void chatterCallback(const std_msgs::String::ConstPtr& msg)
{
  int id = msg->id;
}

you define a custom message (SWrite.msg), but in your callback signature you still appear to be using std_msgs::String. That doesn't make sense to me.

The error message ("there is no field id in std_msgs::String) does make sense in that case.

And here is my callback function:

void chatterCallback(const std_msgs::String::ConstPtr& msg)
{
  int id = msg->id;
}

you define a custom message (SWrite.msg), but in your callback signature you still appear to be using std_msgs::String. That doesn't make sense to me.

The error message ("there is no field id in std_msgs::String) ") does make sense in that case.