首先,ubuntu下打开roscore
然后查看ipconfig 192.168.163.128
在matlab中:
setenv('ROS_MASTER_URI','http://192.168.163.128:11311');
rosinit,即可
用rostopic list查看话题:
rostopic echo topicname
rostopic info topicname
rostopic type topicname
转成函数从而可以调用:
topiclist = rostopic('list')
msg = rostopic('echo', topicname)
topicinfo = rostopic('info', topicname)
msgtype = rostopic('type', topicname)
利用matlab 订阅topic 并用matlab显示:
sub = rossubscriber('scan') %订阅
msg = receive(sub) %接收
Matlab同样可以编写节点并发布数据: