- There were some improvements made in performance for checkCollision in R2021b. Try and see if it meets your expectation.
- You can also try turning "off" self-collision checking if you are confident that the configurations you pass to the collision checking routine don't result in the robot colliding with itself. See ("IgnoreSelfCollision") here: https://www.mathworks.com/help/robotics/ref/rigidbodytree.checkcollision.html#namevaluepairarguments
- Alternatively you can try generating a MEX for an entry point function (See rbtCheckCollision) that accepts a configuration and returns whether the robot is in collision.
Speed up collision checking
6 views (last 30 days)
Show older comments
I am using Matlab's "checkCollision" function with four additional collision objects and a UR5 robot. Function is working great and returns logical 1 or 0, which is later used in the program (I am checking overall reachability of the workpiece).
The only problem I am facing is computation time. I already limited points on the workpiece but it still takes too long, 80% of the time is used only for collision checking.
Is there a way to speed things up? If not, is there any other available collision checking library (maybe with use of voxels or spheres) which works with Matlab in similar fashion?
0 Comments
Accepted Answer
Karsh Tharyani
on 11 Nov 2021
Edited: Karsh Tharyani
on 17 Nov 2021
Hi RoboTomo,
Thanks for your question.
function isColliding=rbtCheckCollision(config)
% Use persistence if the robot and the environment are not changing.
persistent rbt env
if(isempty(rbt))
rbt=importrobot("universalUR5.urdf","DataFormat","row");
end
if(isempty(env))
c1=collisionBox(0.1,0.1,0.1);
c1.Pose=trvec2tform([0.2,0.2,0.4]);
c2=collisionSphere(0.3);
c2.Pose=trvec2tform([0.4,-0.2,0.4]);
env={c1,c2};
end
isColliding=rbt.checkCollision(config,env);
end
>> codegen rbtCheckCollision -args {zeros(1,6)}
I would be glad if you could also reach out to Technical Support and convey any performance requirements that you have for your use case, and we would be happy to enhance checkCollision in a future release of MATLAB.
Best,
Karsh
5 Comments
More Answers (0)
See Also
Categories
Find more on Robotics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!