標(biāo)題: 機(jī)器人自動(dòng)導(dǎo)航建圖源碼 xbot_slam-master [打印本頁(yè)]

作者: aaa923124003    時(shí)間: 2018-11-30 10:56
標(biāo)題: 機(jī)器人自動(dòng)導(dǎo)航建圖源碼 xbot_slam-master
機(jī)器人自動(dòng)導(dǎo)航建圖源碼


單片機(jī)源程序如下:
  1. #include "ros/ros.h"
  2. #include "std_msgs/String.h"

  3. #include <sstream>


  4. int main(int argc, char **argv)
  5. {

  6.   ros::init(argc, argv, "subgoal");

  7.   ros::NodeHandle n;

  8.   ros::Publisher chatter_pub = n.advertise<std_msgs::String>("chatter", 1000);

  9.   ros::Rate loop_rate(10);



  10.   int count = 0;
  11.   while (ros::ok())
  12.   {
  13.     /**
  14.      * This is a message object. You stuff it with data, and then publish it.
  15.      */
  16.     std_msgs::String msg;

  17.     std::stringstream ss;
  18.     ss << "hello world " << count;
  19.     msg.data = ss.str();

  20.     ROS_INFO("%s", msg.data.c_str());

  21.     /**
  22.      * The publish() function is how you send messages. The parameter
  23.      * is the message object. The type of this object must agree with the type
  24.      * given as a template parameter to the advertise<>() call, as was done
  25.      * in the constructor above.
  26.      */
  27.     chatter_pub.publish(msg);

  28.     ros::spinOnce();

  29.     loop_rate.sleep();
  30.     ++count;
  31.   }


  32.   return 0;
  33. }
復(fù)制代碼

所有資料51hei提供下載:
xbot_slam-master.zip (390.82 KB, 下載次數(shù): 24)



作者: aaa923124003    時(shí)間: 2018-11-30 10:59
這個(gè)包含了仿真程序,可以直接在linux下使用




歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1