5.1 roscpp
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-IB6savAI-1591966456237)(/home/swc/.config/Typora/typora-user-images/image-20200601160445663.png)]
ros提供的使用C++和topic,service,param等交互的接口
-
官方文档
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-yMSRsogh-1591966456239)(/home/swc/.config/Typora/typora-user-images/image-20200601160652061.png)]
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-tcatPHD2-1591966456241)(/home/swc/.config/Typora/typora-user-images/image-20200601160723747.png)]
5.1.1 ros::init()
void ros::init() //解析ross参数,为本node命名
5.1.2 ros::NodeHandle Class (类)
//常用 成员函数
//创建话题的publisher
ros::Publisher advertise(const string& topic,uint32_t queue_size);
//例子
ros::NodeHandle nh;
ros::Publisher pub = nh.advertise(...,...);
pub.publish(msg);
//创建话题的subscriber
ros::Subscribe subscribe(const string& topic,uint32_t queue_size,void(*)(M)); //M是回调函数,处理msg
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-spJeyyBb-1591966456243)(/home/swc/.config/Typora/typora-user-images/image-20200601163556216.png)]
5.1.3 ros::master Namespace
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-FVEM18V8-1591966456244)(/home/swc/.config/Typora/typora-user-images/image-20200601163845780.png)]
5.1.4 ros::this_node Namespace
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-4OHCtrK5-1591966456246)(/home/swc/.config/Typora/typora-user-images/image-20200601165216228.png)]
5.1.5 ros::service Namespce
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-Mc4APoIJ-1591966456247)(/home/swc/.config/Typora/typora-user-images/image-20200601192523926.png)]
5.1.6 ros::names Namespace
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-ScE5bgvl-1591966456247)(/home/swc/.config/Typora/typora-user-images/image-20200601192651443.png)]
5.2 topic_demo
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-4dlttcVk-1591966456248)(/home/swc/.config/Ty