- Are you able to receive message sent from MATLAB instead of Simulink?
- Check the setting for ROS_MASTER_URI and ROS_IP for both MALTAB and Ubuntu (See more details in this post)
- Are you using VMware Player? If yes, what kind of Network connection did you pick? We always find "NAT" is a good option.
- In general, you could probably just start ROS Master in VM, and use "rosinit('<ip_address>')" in MATLAB to make the connection. Please feel free to reach out to our technical support team if you are still facing this issue.
Why can't I publish ROS messages using simulink?
8 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I am testing exchange data between simulink and ROS. I have a laptop running a ROS project called tuetlesim, which is a example project of ROS. In this ROS project, a turtle will move according to the command from the topic called /turtle1/cmd_vel . The type of the message of the topic is geometry_msgs/Twist.
What I want to do is using simulink to publish the message and move the turtle. So,
Firstly, I set my network in matlab and ubuntu
% in matlab
setenv('ROS_MASTER_URI','http://192.168.1.250:11311')
% in ubuntu ~/.bashrc
export ROS_IP=192.168.1.250
Secondly, I test the network in matlab. It works and can show all topics
rosinit
rostopic list
Finally, I create a model as below. In this model, I also use a subscriber to subscribe the topic called /turtle1/pose, which contains the position(X/Y) of the turtle. This subscriber work perfectly. However, the publisher doesn't work.
In ubuntu, I check the node by rqt_graph. It shows that simulink successfully connect to the master.
However, there is no message can be receive from the /turtle1/cmd_vel.
Can anyone give me any hint about why this behaviour?
Thank you very much in advance,
Regards,
Liam
0 件のコメント
回答 (1 件)
Josh Chen
2023 年 4 月 24 日
Hello Liam,
When this kind of "only one way communication available" happens, it usually has something to do with the setting of environment variables or virtual machine.
Some ideas of troubleshooting for your reference:
Hope this helps,
Thanks,
Josh
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Publishers and Subscribers についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!