Gazebo subscribe block error in Simulink
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Yunsik Jung
il 12 Mag 2021
Commentato: Yunsik Jung
il 14 Giu 2021
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>
0 Commenti
Risposta accettata
Gaurav Bhosale
il 13 Mag 2021
Hi Yunsik,
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 you need to increase dimension limit from Bus Editor.
Check Customize Bus Objects for Simulation from https://www.mathworks.com/help/robotics/ug/control-manipulator-robot-with-co-simulation.html
Try to change bus dimension and let me know if you face any issue in doing that.
2 Commenti
Gaurav Bhosale
il 21 Mag 2021
Hi Yunsik,
You can check message sizes from Gazebo but that is not straightforward. Currently, there is no direct way to determine bus size is MATLAB.
You can keep larger dimension size such that you never exceed bus dimension limit.
Further, there are several fields in Contacts message which are variable size. So, I recommend you to check field name mentioned in the error and try to increase dimension size of that field.
I used Contacts message below. The Contacts message is repeatative Contact message. So, if you are using just Contact message then ignore 3rd modification from below.
For Contacts message, I modify bus sizes as follows,
1] I modifed bus sizes for Vector3d message as,
2] I modified bus sizes for bodyname, body id from JointWrench message as,
3] I modified bus sizes for Contact message as follows,
Basically, these sizes can vary with input message. Also, there are many messages which are repeatative in Contacts message, so you need to tune those fields as per your Gazebo message.
Try to modify above fields and let me know if you still face same issue.
Thanks
Più risposte (2)
Gaurav Bhosale
il 10 Giu 2021
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
Vedere anche
Categorie
Scopri di più su Gazebo Co-Simulation in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!