機器人自動導航建圖源碼
0.png (42.7 KB, 下載次數: 74)
下載附件
2018-11-30 15:22 上傳
單片機源程序如下:
- #include "ros/ros.h"
- #include "std_msgs/String.h"
- #include <sstream>
- int main(int argc, char **argv)
- {
- ros::init(argc, argv, "subgoal");
- ros::NodeHandle n;
- ros::Publisher chatter_pub = n.advertise<std_msgs::String>("chatter", 1000);
- ros::Rate loop_rate(10);
- int count = 0;
- while (ros::ok())
- {
- /**
- * This is a message object. You stuff it with data, and then publish it.
- */
- std_msgs::String msg;
- std::stringstream ss;
- ss << "hello world " << count;
- msg.data = ss.str();
- ROS_INFO("%s", msg.data.c_str());
- /**
- * The publish() function is how you send messages. The parameter
- * is the message object. The type of this object must agree with the type
- * given as a template parameter to the advertise<>() call, as was done
- * in the constructor above.
- */
- chatter_pub.publish(msg);
- ros::spinOnce();
- loop_rate.sleep();
- ++count;
- }
- return 0;
- }
復制代碼
所有資料51hei提供下載:
xbot_slam-master.zip
(390.82 KB, 下載次數: 24)
2018-11-30 10:56 上傳
點擊文件名下載附件
下載積分: 黑幣 -5
|