Ros does not receive data from MATLAB publishing topics
1 次查看(过去 30 天)
显示 更早的评论
I use ubuntu18.04 melodic ros and matlabR2021a.
My linux operate system IP is: 172.20.10.3
My windows operate system IP is: 172.20.10.11
First, in my linux operate system:
I set the
explore ROS_MASTER_URI = https://172.20.10.3:11311
explore ROS_HOST_NAME = 172.20.10.3
explore ROS_IP = 172.20.10.3
Then, I start the "roscore" in my linux.
Second, in my windows10 operate system:
I use the matlab and set
setenv('ROS_MASTER_URI','http://172.20.10.3:11311/')
setenv('ROS_HOSTNAME','172.20.10.11')
setenv('ROS_IP','172.20.10.11')
rosinit()
Then, in the matlab terminal, use
ros topic list
could see all the ros topic in the matlab terminal.
Then, I run the code in the matlab
chatterpub = rospublisher('/chatter',rostype.std_msgs_String)
chattermsg = rosmessage(chatterpub)
chattermsg.Data = 'hello world'
send(chatterpub,chattermsg)
pause(5)
in the ros terminal, i can see the topic '/chatter', when i use 'topic echo /chatter', the ros can't receive the data 'hello world'.
To sum up, i can see all the topic list and topic node in the matlab and ros, but ros can't receive the data from matlab.
How do i deal withe this problem?
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Specialized Messages 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!