¿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 CenterFile Exchange에서 Code Generation에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by