Ros does not receive data from MATLAB publishing topics
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Specialized Messages dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!