Gazebo subscribe block error in Simulink
Show older comments
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'.
I have no idea how to solve this problem. Would you let me know if you have any ideas to solve it?
Thanks!
In addition, I defined the contacts to the Gazebo *.world file as shown below. And I have checked these topics are published in Gazebo.
<collision name='m1n6s300_link_finger_tip_1_collision'>
<pose frame=''>0 0 0 0 -0 0</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
<uri>/home/user/catkin_ws/src/kinova-ros/kinova_description/meshes/finger_distal.dae</uri>
</mesh>
</geometry>
<max_contacts>100</max_contacts>
<surface>
<contact>
<ode/>
</contact>
<bounce/>
<friction>
<torsional>
<ode/>
</torsional>
<ode/>
</friction>
</surface>
</collision>
<visual name='m1n6s300_link_finger_tip_1_visual'>
<pose frame=''>0 0 0 0 -0 0</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
<uri>/home/user/catkin_ws/src/kinova-ros/kinova_description/meshes/finger_distal.dae</uri>
</mesh>
</geometry>
</visual>
<self_collide>0</self_collide>
<enable_wind>0</enable_wind>
<kinematic>0</kinematic>
<sensor name = 'con_info_finger_tip_1' type = 'contact'>
<contact>
<collision>m1n6s300_link_finger_tip_1_collision</collision>
</contact>
</sensor>
Accepted Answer
More Answers (2)
Yunsik Jung
on 10 Jun 2021
Gaurav Bhosale
on 10 Jun 2021
0 votes
Hi Yunsik,
1] This issue is more related to mux don't support variable size input. So, might be you need to try with fixed size bus. If you aware of size of incoming message then you can change bus to fixed size and add the bus size. Similar, settings are mentioned in the UR10 Gazebo Example in 'Customize Bus Objects for Simulation' section.
2] You need to increase bus size for Gazebo_SL_Bus_gazebo_msgs_custom_gazebo_msgs_Contacts.contact.wrench.body_1_name
Whenever collision occurs, the wrench.body_1_name contains body name string, which is exceeding bus limits of Contacts.contact.wrench.body_1_name.
So, try with higher value.
Thanks
1 Comment
Yunsik Jung
on 14 Jun 2021
Categories
Find more on Gazebo Co-Simulation in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



