Unstable communication of turtlesim in ROS2 in Simulink

3 ビュー (過去 30 日間)
健
2023 年 4 月 21 日
回答済み: Josh Chen 2023 年 4 月 21 日
We are testing to run turtlesim from simulink using the "turtle1/cmd_vel" topic.
When the "turtle1/pose" topic is used to get the coordinates of turtlesim in simulink, the communication is paused about every second.
While "turtle1/pose" is not used in simulink, the coordinates can be obtained on the host PC without interruption, and as soon as the block diagram is started in simulink, the "ros2 topic echo" on the host PC is also interrupted periodically.
The message type used in the topic "turtle1/pose" does not exist in MATLAB, so it is registered as a custom message. Is this the cause of the delay? Is it that custom messages are not supported?

回答 (1 件)

Josh Chen
Josh Chen 2023 年 4 月 21 日
Hello 健,
Custom messages are supported in Simulink as well.
If I understand your question correctly, you are trying to subscribe to "turtle1/pose" topic in Simulink using Subscribe block, write your own control algorithm, and send out the "turtle1/cmd_vel" message with Publish block in Simulink.
This should be feasible with custom messages. There is an example that does something similar - Feedback Control of a ROS-Enabled Robot Over ROS 2. You may want to check the model in this example and see if that's helpful.
Given the fact that you are able to select the custom message in Simulink blocks, I don't see an issue with custom message here. If you would like to share the model and have further assistant, please feel free to also reach out to our technical support team.
Thanks,
Josh

カテゴリ

Help Center および File ExchangeROS Network Access in Simulink についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by