ros_topic poster

#include 
#include

int main(int argc, char *argv[])
{
    ros::init(argc,argv,"ros_fb_node");
    ros::NodeHandle nh;
    
    ros_fb::message msg;
    msg.trueorfalse=1;

    ros::Publisher pub=nh.advertise("message_info",1);
    
    ros::Rate loop_rate(1.0);
    while(ros::ok())
    {
        msg.trueorfalse=!msg.trueorfalse;
        ROS_INFO("post info is %d",msg.trueorfalse) ;
        pub.publish(msg);
        loop_rate.sleep();
    }
    return 0;
}

 

你可能感兴趣的:(ros,topic)