Questions when Work with ROS2 Messages Using MATLAB Function Block

3 views (last 30 days)
I have a question with the matlab functions while dealing with the ros2 messages.
Following the intructions I run successfully with the ros1 blank message, but when I changed to the ros2 blank like the screenshot, the matlab has no response after typing ros.createSimulinkBus(gcs).
Do you konw why this is no use with the ROS2 blank messages?
The link is:

Accepted Answer

Abhijeet Gadkari
Abhijeet Gadkari on 23 Feb 2022
Edited: Abhijeet Gadkari on 23 Feb 2022
Hello Xiaochen,
The function, ros.createSimulinkBus(modelName), is not intended for use with a Simulink model containing ROS 2 blocks. This function only works (searches) for the ROS blocks in the Simulink model.
For ROS 2 blocks, use ros.ros2.createSimulinkBus(modelName) function instead.
This function will create the buses, if the OpenFcn callback of the model has not done so already, and return the name of the buses as a cell-array.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!