找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 2675|回复: 1
打印 上一主题 下一主题
收起左侧

机器人自动导航建图源码 xbot_slam-master

[复制链接]
跳转到指定楼层
楼主
机器人自动导航建图源码


单片机源程序如下:
  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. }
复制代码

所有资料51hei提供下载:
xbot_slam-master.zip (390.82 KB, 下载次数: 24)


分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏1 分享淘帖 顶 踩
回复

使用道具 举报

沙发
ID:232294 发表于 2018-11-30 10:59 | 只看该作者
这个包含了仿真程序,可以直接在linux下使用
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表