how to publish int8,float ...and function ? [closed]
i can't publish int8 .. can you help me?
#include "ros/ros.h"
#include "std_msgs/Int8.h"
#include <sstream>
int main(int argc, char **argv)
{
ros::init(argc, argv, "talker");
ros::NodeHandle n;
ros::Publisher chatter_pub = n.advertise<std_msgs::Int8>("mytopic", 1000);
ros::Rate loop_rate(10);
int8_t count = 0;
while (ros::ok())
{
std_msgs::Int8 msg;
msg.data = count++;
ROS_INFO("%s", msg.data);
chatter_pub.publish(msg);
ros::spinOnce();
loop_rate.sleep();
}
return 0;
}
display : NULL