How can I change the base position of universalUR10 robot model
17 次查看(过去 30 天)
显示 更早的评论
Code:
ur10 = loadrobot('universalUR10');
ur10Moved = rigidBodyTree;
rb = rigidBody('newBaseForUR10');
rb.Joint.setFixedTransform(trvec2tform([3,0,0]));
ur10Moved.addBody(rb, 'base');
ur10Moved.addSubtree('newBaseForUR10', ur10);
show(ur10);
xlim([-2 4])
zlim([0, 1.5])
hold on
show(ur10Moved);
Error:
The name of the body, base, has already been used in the robot. Use a different name for the body.
when I use a different name, i got this error:
Body with name bbase is not found. Check the BodyNames property of the rigidBodyTree object to get a list of body names.
0 个评论
采纳的回答
Hannes Daepp
2021-11-22
This issue is because the default base name in a new rigidBodyTree is "base", which is also a rigid body in the loaded UR10.
This is evident when you first create the new rigid body tree:
ur10Moved = rigidBodyTree
ur10Moved.BaseName
As you can see, the BaseName property of UR10 is already set to "base". Then when you load the UR10, it too has a body named "base":
ur10 = loadrobot('universalUR10');
ur10.showdetails
Since body names must be unique, these two rigid body tree objects cannot be combined as-is.
However, the base name is not fixed after construction, so an easy way to get around this issue would be to change the base name in the new rigid body tree that you are creating so that there are no conflicts once the UR10 is added. That is:
% Load the UR10 from the robot library
ur10 = loadrobot('universalUR10');
% Create the new rigid body tree with a new base name
ur10Moved = rigidBodyTree;
ur10Moved.BaseName = 'newBase';
% Add a new custom base to the renamed base
rb = rigidBody('newBaseForUR10');
rb.Joint.setFixedTransform(trvec2tform([3,0,0]));
ur10Moved.addBody(rb, ur10Moved.BaseName);
Then you should be able to add the UR10 as a subtree without any issue
ur10Moved.addSubtree('newBaseForUR10', ur10);
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Manipulator Modeling 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!