Gazebo subscribe block error in Simulink (bus edit)
2 次查看(过去 30 天)
显示 更早的评论
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,
- 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.position.x size does not match the field Gazebo_SL_Bus_gazebo_msgs_custom_gazebo_msgs_Contacts.contact.position.x size defined in the method 'getOutputDataTypeImpl'.
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 个评论
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.
Thanks,
Jagadeesh K.
采纳的回答
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.
Thanks
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Gazebo Co-Simulation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!