Jamespiper asked . 2021-04-02

Unexpected behaviour of checkCollision for robot collision detection

I am using the function checkCollision (R2020b version) to detect wheter a robot is in collision with itself. The basic code I use for this is:
 
 
robot = importrobot(robotPath,'MeshPath',collisionMeshPath);
isCollision = checkCollision(robot,jointAngles); % joint angles = [a1 a2 a3 a4 a5 a6]'
This function works great when the robot model does not have a tool attached. However, with a tool attached, the behaviour is not as expected anymore since it always returns true.
 
I need to shift the mesh of the tool away from the robot so far that no point of the robot sticks into the bottom of the tool even though there is a cut out. I have now removed the entire bottom part covering the tool and still get this problem. You can clearly see that the robot arm is far away from touching the tool but still the output is always true. In the image below, I added 18mm of vertical offset and still get the error. Once I add 19mm, no part of the robot stick into the tool and the error goes away. I want to use the function with no or very small z-offset in order to do a realistic collision detection.
 
Is this just the normal behaviour of this function or am I doing something wrong here? Is there maybe a workaround?

matlab , matrix , simulink , robot , robotics

Expert Answer

John Williams answered . 2024-12-21 01:47:09

It will help to view the robot's collision geometry data instead of the visual data as they might be different. To do so,
 
show(robot, config, "Visuals", "off", "Collisions", "on");
You can also view the end-effector body's collision data by inspecting the Collisions property of the rigidBody
 
The next good step will be to find out which bodies are in collision. This can be done by viewing the separation distances between the bodies.
 
[isColliding, sepDist] = checkCollision(robot, config, "Exhaustive", "on");
In order to find out which bodies are colliding, you can view the entries in the sepDist matrix which are NaNs
 
[b1, b2] = find(isnan(sepDist));
robot.BodyNames{b1}
robot.BodyNames{b2}
Note that the rows and columns correspond to the body indices. The last row and column corresponds to the robot.Base body's collision with other bodies.
Adjacent bodies are ignored for collisions hence their separation distances are Inf.
Once you have found out which bodies are in collision, you can modify the collision data associated with that body to make the robot self-collision free for that configuration.


Not satisfied with the answer ?? ASK NOW

Frequently Asked Questions

MATLAB offers tools for real-time AI applications, including Simulink for modeling and simulation. It can be used for developing algorithms and control systems for autonomous vehicles, robots, and other real-time AI systems.

MATLAB Online™ provides access to MATLAB® from your web browser. With MATLAB Online, your files are stored on MATLAB Drive™ and are available wherever you go. MATLAB Drive Connector synchronizes your files between your computers and MATLAB Online, providing offline access and eliminating the need to manually upload or download files. You can also run your files from the convenience of your smartphone or tablet by connecting to MathWorks® Cloud through the MATLAB Mobile™ app.

Yes, MATLAB provides tools and frameworks for deep learning, including the Deep Learning Toolbox. You can use MATLAB for tasks like building and training neural networks, image classification, and natural language processing.

MATLAB and Python are both popular choices for AI development. MATLAB is known for its ease of use in mathematical computations and its extensive toolbox for AI and machine learning. Python, on the other hand, has a vast ecosystem of libraries like TensorFlow and PyTorch. The choice depends on your preferences and project requirements.

You can find support, discussion forums, and a community of MATLAB users on the MATLAB website, Matlansolutions forums, and other AI-related online communities. Remember that MATLAB's capabilities in AI and machine learning continue to evolve, so staying updated with the latest features and resources is essential for effective AI development using MATLAB.

Without any hesitation the answer to this question is NO. The service we offer is 100% legal, legitimate and won't make you a cheater. Read and discover exactly what an essay writing service is and how when used correctly, is a valuable teaching aid and no more akin to cheating than a tutor's 'model essay' or the many published essay guides available from your local book shop. You should use the work as a reference and should not hand over the exact copy of it.

Matlabsolutions.com provides guaranteed satisfaction with a commitment to complete the work within time. Combined with our meticulous work ethics and extensive domain experience, We are the ideal partner for all your homework/assignment needs. We pledge to provide 24*7 support to dissolve all your academic doubts. We are composed of 300+ esteemed Matlab and other experts who have been empanelled after extensive research and quality check.

Matlabsolutions.com provides undivided attention to each Matlab assignment order with a methodical approach to solution. Our network span is not restricted to US, UK and Australia rather extends to countries like Singapore, Canada and UAE. Our Matlab assignment help services include Image Processing Assignments, Electrical Engineering Assignments, Matlab homework help, Matlab Research Paper help, Matlab Simulink help. Get your work done at the best price in industry.