Gazebo subscribe block error in Simulink (bus edit)

3 ビュー (過去 30 日間)
Yunsik Jung
Yunsik Jung 2021 年 5 月 17 日
編集済み: Gaurav Bhosale 2021 年 11 月 14 日
Hi, all. I have created Gazebo plugin including several message types, such as contacts, pose, link, joint, and etc. using gazebogenmsg to communicate Simulink and Gazebo.
The plugin works appropriately, and I can read forces and torques using the Gazebo subscribe block in Simulink.
However, when I try to read contacts, then there is an error as shown below.
[Error in Simulink]
An error occurred while running the simulation and the simulation was terminated
Caused by:
  • For 'Output Port 2' of 'gazeboCosimControl_ys_v3/Gazebo Robot/Gazebo Subscribe con_info_redbox/SourceBlock', the method 'outputImpl' of the System object 'robotics.slgazebo.internal.GazeboSubscribeBlk' returns a bus type whose field size does not match the field size defined in the method 'getOutputDataTypeImpl'.
In this case, the is of variable length. The received message data is excceding dimension limit ( default is 128), so I need to increase dimension limit from Bus Editor.
When I get these errors, I know that I need to customize Bus objects for sumulation using the Bus Editor from
My question is, how to determine the mode, data type, dimension and dimension mode?
For instance, I would like to read the following topics from Gazebo.
1) collision1: "redBox::link::collision_redbox"
2) collision2: "ground_plane::link::collision"
3) wrench {
body_1_name: "redBox::link::collision_redbox"
body_1_id: 87
body_2_name: "ground_plane::link::collision"
body_2_id: 6
body_1_wrench {
force {
x: -0.0040215821663263434
y: -0.0035342300169850984
z: 0.00612709962277502
torque {
x: 8.4268671424788638e-05
y: -6.842890014103444e-05
z: 1.5792249417875155e-05
Current setting of the bus editor for them,
collision1, 2: Model=built in, Data type=unit8, Dimensions=128, DimensionModel=Variable
Wrench: Model=bus object, Dimensions=1, DimensionsMode=Fixed
Could you let me know how to modify them?
Thank you very much!
  1 件のコメント
Jagadeesh Konakalla
Jagadeesh Konakalla 2021 年 5 月 20 日
Hi Yunsik,
We have a detailed example on how to set variable size arrays in ROS toolbox. Here are the useful links. Can you please follow these examples and topic section.
Let me know if it does not address your issue.
Jagadeesh K.



Gaurav Bhosale
Gaurav Bhosale 2021 年 11 月 14 日
編集済み: Gaurav Bhosale 2021 年 11 月 14 日
Hi Yunsik,
The solution is provided in the following susequent post.
Please refer above posts.

その他の回答 (0 件)


Help Center および File ExchangeGazebo Co-Simulation についてさらに検索




Community Treasure Hunt

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

Start Hunting!

Translated by