¿Is it possible to use the function checkCollision (robotics toolbox) from simulink?

2 ビュー (過去 30 日間)
I've simulated a robotic environment importing a URDF to simulink and getting the multibody representation of the robot. Now I need to check for self collisions, for that purpouse there's an implemented function in the robotics toolbox called checkCollision with two input arguments, the robot implemented as a rigidBodyTree structure and the joint configuration. This function has no implementation in simulink.
¿Is it possible to call this function from simulink?
So far the main issue that I'm facing is that the rigidBodyTree structure that the function takes as a input argument can't be imported to simulink through from workspace block nor from parameters to MatLab function blocks.

採用された回答

Karsh Tharyani
Karsh Tharyani 2022 年 1 月 12 日
編集済み: Karsh Tharyani 2022 年 1 月 12 日
Hi Ignacio,
Thanks for your question. You can use a MATLAB Function Block which creates a rigidBodyTree inside of it and then you can call checkCollision inside the block.
As an illustration, see the MATLAB Function Block "checkSelfCollision" in the model and its code below
function y = checkSelfCollision(q)
persistent rbt
if(isempty(rbt))
rbt=importrobot("kinovaGen3.urdf","DataFormat","row");
end
y=checkCollision(rbt,q);
end
Note that you will have to specify the size of input argument "q" of the function block. The size should correspond to the size of the "rigidBodyTree's" joint configuration. In case of the above snippet, the size for the Kinova Gen 3 robot is [1,7] (1-by-7)
I hope this helps in answering your query.
Best,
Karsh

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCode Generation についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by