ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
ROS_INFO("%s", msg.data);
For std_msgs::Int8
, the data
field is of the int8
type (see the msg doc). The %s
format string is for strings (or char*
), so that won't work. Try %d
.
PS: are you sure you aren't ignoring some compiler warning?
PPS: the question title says you cannot publish an Int8
, but in your actual question it would seem you only have difficulty logging the data
field using ROS_INFO(..)
. Perhaps you should update the title to reflect your actual issue.