Is there a way to change the position of the origin of the model when displaying a robot arm using the Robotics System Toolbox in Matlab?
Ältere Kommentare anzeigen
I want to detect a collision between two robot arms.
The page below mentions the method in part, but in the sample code shown in the answer, the origin is the same, so the result of the collision detection is true regardless of the posture.
Therefore, as a preliminary step to detecting a collision between two robot arms, I would like to know how to arrange two robot arms with different origins and base positions.
The robot model is one that I imported my own urdf for.
importrobot('original_robot.urdf')
Antworten (1)
Karsh Tharyani
am 28 Jan. 2025
Bearbeitet: Karsh Tharyani
am 28 Jan. 2025
Hi Kohei,
The suggested workflow in your comment is a good way to model your use-case. Another strategy could be to use a "floating" rigidBodyJoint.
See code snippet below which shows how to do collision checking using a Franka Emika and a Kinova Gen 3.
% Load the Franka Emika and Kinova Gen3 robots
franka=loadrobot('franka',d='r');
kinova=loadrobot('kinovagen3',d='r');
% These will become part a common rigid body tree i.e., a fixed inertial frame
% in the world frame located at (0,0,0)
rbt=rigidBodyTree(d='r');
% Create one floating base for each robot, and add it to the fixed base tree.
frankabase=rigidBody("frankafloat");
frankabase.Joint=rigidBodyJoint("franka_float","floating");
kinovabase=rigidBody("kinovabase");
kinovabase.Joint=rigidBodyJoint("kinova_float","floating");
addBody(rbt,frankabase,rbt.BaseName);
addBody(rbt,kinovabase,rbt.BaseName);
% Add the robots to the fixed base tree
addSubtree(rbt,frankabase.Name,franka,replacebase=false);
addSubtree(rbt,kinovabase.Name,kinova,replacebase=false);
% A random configuration of the two trees.
% Code below shows how to encode the joint positions of the two arms and
% their base locations in a single configuration vector called "randconfig"
randconfig=[rotm2quat(eye(3)),0.5,0,0,homeConfiguration(franka),eul2quat([pi/3,pi/2,0]),-0.6,0,0,randomConfiguration(kinova)];
show(rbt,randconfig)
axis('equal')
% Check collision between the two trees in this configuration
iscolling=checkCollision(rbt,randconfig,"SkippedSelfCollisions","parent");
The only downside to using "floating" joints to combine the two trees is that you can't use inverseKinematics solver on them because it can't solve for "floating" joints. For that, though, you can use the following example - https://www.mathworks.com/help/robotics/ug/inverse-kinematics-for-robots-with-floating-base.html
I hope these suggestions help!
Karsh
Kategorien
Mehr zu Robotics finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
