找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 3273|回復(fù): 1
打印 上一主題 下一主題
收起左側(cè)

機器人自動導(dǎo)航建圖源碼 xbot_slam-master

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
ID:232294 發(fā)表于 2018-11-30 10:56 | 只看該作者 |只看大圖 回帖獎勵 |倒序瀏覽 |閱讀模式
機器人自動導(dǎo)航建圖源碼


單片機源程序如下:
  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)


分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏1 分享淘帖 頂 踩
回復(fù)

使用道具 舉報

沙發(fā)
ID:232294 發(fā)表于 2018-11-30 10:59 | 只看該作者
這個包含了仿真程序,可以直接在linux下使用
回復(fù)

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規(guī)則

手機版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機教程網(wǎng)

快速回復(fù) 返回頂部 返回列表