日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

ROS与Arduino学习(六)Logging日志

發布時間:2023/12/10 编程问答 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 ROS与Arduino学习(六)Logging日志 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

ROS與Arduino學習(六)Logging日志

?

Tutorial Level:客戶端與服務器

Next Tutorial:小案例節點通信

???? 本節較為簡單告訴大家如何向系統發布日志信息。

Tips 1 日志信息發布

節點提供了五種日志消息,分別是debug、information、warn、error、fatal。可以分別用以下函數調用。其中參數為一個字符串

nh.logdebug(debug);nh.loginfo(info);nh.logwarn(warn);nh.logerror(error);nh.logfatal(fatal);

?

Tips 2 案例程序

/** rosserial PubSub Example* Prints "hello world!" and toggles led*/#include <ros.h> #include <std_msgs/String.h> #include <std_msgs/Empty.h>ros::NodeHandle nh;std_msgs::String str_msg; ros::Publisher chatter("chatter", &str_msg);char hello[13] = "hello world!";char debug[]= "debug statements"; char info[] = "infos"; char warn[] = "warnings"; char error[] = "errors"; char fatal[] = "fatalities";void setup() {pinMode(13, OUTPUT);nh.initNode();nh.advertise(chatter); }void loop() {str_msg.data = hello;chatter.publish( &str_msg );nh.logdebug(debug);nh.loginfo(info);nh.logwarn(warn);nh.logerror(error);nh.logfatal(fatal);nh.spinOnce();delay(500); }

?

Tips 3 測試程序

?

#新終端打開 $ roscore #新終端打開 $ rosrun rosserial_python serial_node.py _port:=/dev/ttyUSB0

?

轉載于:https://www.cnblogs.com/flyingjun/p/8951162.html

總結

以上是生活随笔為你收集整理的ROS与Arduino学习(六)Logging日志的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。