共 8 篇文章 |
|
ROS TF.$ roslaunch turtle_tf turtle_tf_demo.launch.-- Axes --> <param name="scale_linear" value="2" type="double"/> <param name="scale_angular" value="2" type="double"/> <node pkg="learning_tf" type="turtle_tf_broadcaster"... 阅125 转0 评0 公众公开 19-08-22 10:12 |
#C++代码void chatterCallback(const std_msgs::String::ConstPtr& msg,type1 arg1, type2 arg2,...,typen argN) { ROS_INFO("I heard: [%s]", msg->data.c_str()); } int main(int argc, char** argv){ ros::Subscriber sub = n.subscribe("chatter", 1000, boost::bind(&chatterCallback,_1,arg1,arg2,...,a... 阅999 转0 评0 公众公开 19-02-27 11:15 |
ros消息中使用数组,段错误最近学习ros新建自定义消息并使用,发现如果在msg文件中声明一个数组:char[] data,然后在cpp中使用该数据,便会报错。如果定义定长数组,则不会出错,很奇怪,经过同事指导,原来在msg文件中,数据都是vector类型,访问vector类型应该使用push_back()函数:for(int j=0;j<8;j++) msg.data.push_back(buf[j]);... 阅1121 转0 评0 公众公开 19-02-01 13:55 |
ros 消息发布和订阅在一个包的src文件夹内,创建pubvel.cpp和listener.cpppubvel.cpp:#include<ros/ros.h>#include<geometry_msgs/Twist.h>#include<stdlib.h>geometry_msgs::Twist msg;#include<ros/ros.h>#include<geometry_msgs/Twist.h>#include<stdlib.h>#include <iomanip>ROS_INFO_STREAM( &... 阅916 转4 评0 公众公开 19-02-01 13:50 |
阅805 转1 评0 公众公开 19-02-01 11:40 |