Gazebo subscribe block error in Simulink (bus edit)

12 views (last 30 days)
Yunsik Jung
Yunsik Jung on 17 May 2021
Edited: Gaurav Bhosale on 14 Nov 2021 at 14:10
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 Gazebo_SL_Bus_gazebo_msgs_custom_gazebo_msgs_Contacts.contact.wrench.body_1_wrench.force.x size does not match the field Gazebo_SL_Bus_gazebo_msgs_custom_gazebo_msgs_Contacts.contact.wrench.body_1_wrench.force.x size defined in the method 'getOutputDataTypeImpl'.
or,
In this case, the Gazebo_SL_Bus_gazebo_msgs_custom_gazebo_msgs_Contacts.contact.wrench.body_1_wrench.force.x 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 https://www.mathworks.com/help/robotics/ug/control-manipulator-robot-with-co-simulation.html.
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!
Yunsik
  1 Comment
Jagadeesh Konakalla
Jagadeesh Konakalla on 20 May 2021
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.
Thanks,
Jagadeesh K.

Sign in to comment.

Answers (1)

Gaurav Bhosale
Gaurav Bhosale on 14 Nov 2021 at 14:09
Edited: Gaurav Bhosale on 14 Nov 2021 at 14:10
Hi Yunsik,
The solution is provided in the following susequent post.
Please refer above posts.
Thanks

Community Treasure Hunt

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

Start Hunting!

Translated by