Gazebo Customized Plugin: Read contact positions that contains both a variable sized element and an array of sub-buses
1 回表示 (過去 30 日間)
古いコメントを表示
Hello,
I have tired to use the customized Gazebo plugin with Simulink and Gazebo in the virtual machine (Ubuntu).
The communication works between Gazebo in the virtual machine and Simulink.
However, when I try to read the contact-positions information (multiple contacts), the error occurs as shown below.
Simulation 1
04:28 AM Elapsed: 3 sec
Diagnostics 1
01:52 AM Elapsed: 20 sec
Simulation 1
01:52 AM Elapsed: 2 sec
Simulation 1
02:30 AM Elapsed: 3 sec
Simulation 1
02:31 AM Elapsed: 3 sec
The bus object 'Gazebo_SL_Bus_gazebo_msgs_custom_gazebo_msgs_Contacts' associated with
the block 'gazeboCosimControl_ys_v3/Gazebo Robot/Bus Selector13' contains both a variable sized element
and an array of sub-buses. Arrays of buses cannot be used in conjunction with bus objects that
contain variable sized elements.
Component: Simulink | Category: Block error
In addition, the contact-positions have the following variable sized elements based on Gazebo simulation. I mean multiple contacts can include to this information as shown below.
To solve this issue, I have tried to use several blocks related to 'bus' such as, bus to vector, to virtual bus, bus selector, etc, but I couldn't solve it.
Do you have any advice to address this issue?
Thank you so much in advance,
Yun
0 件のコメント
採用された回答
Gaurav Bhosale
2021 年 6 月 28 日
Hi Yunsik,
I created Simulink model for Contacts message and able to subscribe Contacts message data. To enable this, I did following changes.
1] The Contacts message is repeatative so you have to change few messages as follows.
You should change Dimensions as per you message length. Also, don't forget to change DimesnionMode to 'Variable' ( Highlighted in red ). The contacts message keep changing its size so it should be variable. Make sure, you do all following changes.
Contact
JointWrench
Time
Vector3d
2] The Simulink model look as follows,
Basically, you we get values in array form. e.g. If Contacts message contains 14 Contact messages/details, which you see as repeated fields in protobuf but in Simulink, these messages are in array form as shown above.
In above figure, <x> contains Wrench.force.x in array form, in which, each index define force.x value for each body.
You can separate these values in MATLAB function.
Thanks.
その他の回答 (2 件)
Gaurav Bhosale
2021 年 6 月 14 日
Hi Yunsik,
You can directly get Position.x at Bus Selector 13 by selection/expanding Position in Bus Selector.
Any specific reason to have two bus selector?
2 件のコメント
Gaurav Bhosale
2021 年 6 月 29 日
Hi Yunsik,
Add 'MATLAB function' block in Simulink and add following code lines in the function
function y = fcn(u)
y = string(char(u'));
Thanks
参考
カテゴリ
Help Center および File Exchange で General Applications についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!