replaceJoint
Replace joint on body
Description
Examples
Modify a Robot Rigid Body Tree Model
Make changes to an existing rigidBodyTree
object. You can get replace joints, bodies and subtrees in the rigid body tree.
Load an ABB IRB-120T manipulator from the Robotics System Toolbox™ loadrobot
. It is specified as a rigidBodyTree
object.
manipulator = loadrobot("abbIrb120T");
View the robot with show
and read the details of the robot using showdetails
.
show(manipulator); showdetails(manipulator)
Get a specific body to inspect the properties. The only child of the link_3
body is the link_4
body. You can copy a specific body as well.
body3 = getBody(manipulator,"link_3");
childBody = body3.Children{1}
body3Copy = copy(body3);
Replace the joint on the link_3
body. You must create a new Joint
object and use replaceJoint
to ensure the downstream body geometry is unaffected. Call setFixedTransform
if necessary to define a transform between the bodies instead of with the default identity matrices.
newJoint = rigidBodyJoint("prismatic"); replaceJoint(manipulator,"link_3",newJoint); showdetails(manipulator)
Remove an entire body and get the resulting subtree using removeBody
. The removed body is included in the subtree.
subtree = removeBody(manipulator,"link_4")
show(subtree);
Remove the modified link_3
body. Add the original copied link_3
body to the link_2
body, followed by the returned subtree. The robot model remains the same. See a detailed comparison through showdetails
.
removeBody(manipulator,"link_3"); addBody(manipulator,body3Copy,"link_2") addSubtree(manipulator,"link_3",subtree) showdetails(manipulator)
Input Arguments
robot
— Robot model
rigidBodyTree
object
Robot model, specified as a rigidBodyTree
object.
bodyname
— Body name
string scalar | character vector
Body name, specified as a string scalar or character vector. This body
must be on the robot model specified in robot
.
Data Types: char
| string
joint
— Replacement joint
rigidBodyJoint
object
Replacement joint, specified as a rigidBodyJoint
object.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Usage notes and limitations:
When creating the rigidBodyTree
object, use the syntax that
specifies the MaxNumBodies
as an upper bound for adding bodies to
the robot model. You must also specify the DataFormat
property as
a name-value pair. For example:
robot = rigidBodyTree("MaxNumBodies",15,"DataFormat","row")
To minimize data usage, limit the upper bound to a number close to the expected
number of bodies in the model. All data formats are supported for code generation.
To use the dynamics functions, the data format must be set to
"row"
or "column"
.
The show
and showdetails
functions do not
support code generation.
Version History
Introduced in R2016b
See Also
MATLAB 명령
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 MATLAB 명령을 지원하지 않습니다.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)