Ros does not receive data from MATLAB publishing topics

조회 수: 7 (최근 30일)
黄
2024년 5월 17일
답변: praguna manvi 2024년 11월 29일
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?

답변 (1개)

praguna manvi
praguna manvi 2024년 11월 29일
Hi @黄,
It seems you are unable to receive messages echoed from MATLAB using "rostopic." Here is a link to a useful discussion thread on a similar issue. You could troubleshoot by using regular "ping" in both directions and follow the detailed steps in the link below:

카테고리

Help CenterFile Exchange에서 ROS Network Access in Simulink에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by