[ROStoolbox]How can I exchange messages between Matlab node and Desktop node?

1 回表示 (過去 30 日間)
Hyounjun Oh
Hyounjun Oh 2022 年 5 月 18 日
移動済み: Remo Pillat 2023 年 3 月 2 日
Hi there!
I want to know how can i exchange messages between Matlab node and Desktop node.
This is what I want to make.
I'm using Ubuntu 20.04LTS, Matlab2022a, ROS2 foxy
The left of picture is internal ROS2 node. The right of picture is Matlab node
The left one is Publisher. It publishes message with Topic using std_msg/msg/String.
To subscribe message from left one, I need to make subscriber node from Matlab.
The subscriber node is ready. The commands "ros2 node list" and "ros2 topic list -t" are work correctly.
But when I try to get message with matlab function "receive( )", they give me an error message.
Error using ros2subscriber/receive
Subscriber did not receive any messages and timed out.
So, I checked type of message. And i found that
The left node uses std_msg/msg/String for publish (used ROS2)
The right node uses std_msg/String for subscribe (used ROS1).
Should I use ROS BRIDGE to get message from internal node?
Thank you for reading and I needs good answer : <
  2 件のコメント
Cam Salzberger
Cam Salzberger 2022 年 5 月 18 日
Also, Hyounjun,
When you say "The right node uses std_msg/String for subscribe (used ROS1)", I believe you're just referring to the message type being similar to ROS 1 in the way that it doesn't specify "msg" in the middle between package and name. That was basically mainained that way for legacy reasons, both for similarity to ROS 1 and because the original implementations of ROS 2 also used that notation. It's still a ROS 2 node/subscriber if you use ros2node/ros2subscriber to create it.
-Cam
Hyounjun Oh
Hyounjun Oh 2022 年 5 月 19 日
I am truly grateful to all the staff! : ) And thank you for your kind explanation and quick reply. I'll try it soon. Thank you
-Hyounjun

サインインしてコメントする。

採用された回答

Cam Salzberger
Cam Salzberger 2022 年 5 月 18 日
移動済み: Remo Pillat 2023 年 3 月 2 日
Hello Hyounjun,
I commented extensively on a similar question here. Can you take a look at that and try the steps I suggested to see where the problem is.
-Cam

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNetwork Connection and Exploration についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by