Main Content

addComponent

Class: simscape.multibody.RigidBody
Namespace: simscape.multibody

Add component object to rigid body

Since R2022a

Description

addComponent(rb,componentName,attachmentFrame,C) adds a component object to the top level of the simscape.multibody.RigidBody object, rb. The componentName argument specifies the name of the new component object, the attachmentFrame argument specifies the frame to which the new component object is attached, and the C argument is the object of the new component object. A RigidBody object can have only two types of component objects: simscape.multibody.Solid and simscape.multibody.RigidBody.

Note that the addCompoment method adds a copy of a component object. In other words, after being passed to the addCompoment method, any subsequent modifications to the original component object do not affect the added object.

addComponent(___,connectionFrame) adds a component object to the rb object via the specified connector, connectionFrame. Use the connectionFrame argument when the added component object has more than one connectors.

Input Arguments

expand all

Rigid body, specified as a simscape.multibody.RigidBody object. The rb object represents the rigid body to which you add the new component object.

Name of the new component object, specified as a string scalar or character vector. The name must be unique among the names of frames and component objects at the top level of the RigidBody object to which you add the component object. In addition, the name must be a valid MATLAB® identifier. You can use the isvarname function to check if the name is a valid identifier.

Example: "subbody"

Data Types: char | string

Name of the frame to which the new component object is attached, specified as a string scalar or character vector. The name must correspond to an existing frame at the top level of the RigidBody object. In addition, the name must be a valid MATLAB identifier. You can use the isvarname function to check if the name is a valid identifier.

Note that the frame does not need to have a connector to connect a component object and can connect to more than one component objects.

Example: "reference"

Data Types: char | string

Component object that you add to the simscape.multibody.RigidBody object, specified as a simscape.multibody.Solid or simscape.multibody.RigidBody object. The new component object must have at least one frame connector.

Name of the connector on the new component, specified as a string scalar or character vector. You must use this argument to specify the connector used for the connection when the new component object has multiple connectors.

The name must be a valid MATLAB identifier. You can use the isvarname function to check if the name is a valid identifier.

Example: "left"

Data Types: char | string

Attributes

Accesspublic

To learn about attributes of methods, see Method Attributes.

Version History

Introduced in R2022a