Main Content

addFrameVariables

Create kinematic variables from select frame pair in KinematicsSolver object

Description

addFrameVariables(ks,groupName,type,base,follower) creates a set of frame variables for a pair of frames. One of the frames serves as the follower and the other serves as the base. These frame variables share a group name, which must be a valid MATLAB® variable name, and correspond to a position or velocity relationship between the base and follower frames.

Use the type argument to specify the relationship for frame variables. There are four types: Translation, Rotation, LinearVelocity, and AngularVelocity. The base and follower arguments must be full paths to frame ports in the model.

The function outputs a table that includes all frame variables. Each row of the table includes ID, path from the root to the base and follower frames, and unit for its numerical value of a frame variable. The IDs of the frame variables have the form groupName.type.primitiveComponent.

addFrameVariables(ks,groupName,type,base,follower,Name,Value) creates a set of frame variables for a pair of frames that represents a position-based or velocity-based relationship. Use the Name-Value Arguments to specify the unit of the frame variables.

Input Arguments

collapse all

A KinematicsSolver object is the representation of a Simscape Multibody model used for kinematic analysis.

Example: ks = simscape.multibody.KinematicsSolver('sm_double_pendulum')

Data Types: KinematicsSolver object

Name of the group in which to place the new frame variables. If adding variables to an existing group, use the name of that group.

Example: 'wrist_position'

Data Types: char | string

Type of relationship that the new frame variables are to represent, specified as one of the following options:

  • The Translation variables represent to the x-, y-, z-components of the linear position of the follower frame with respect to the base frame.

  • The Rotation variables represent the three angles of the xyz intrinsic rotation sequence specifying the angular position of the follower frame with respect to the base frame.

  • The LinearVelocity variables represent to the x-, y-, z-components of the linear velocity of the follower frame with respect to the base frame.

  • The AngularVelocity variables represent to the x-, y-, z-components of the angular velocity of the follower frame with respect to the base frame.

Note

The Translation, Rotation, and LinearVelocity variables are resolved in the base frame coordinates, but the AngularVelocity variables are resolved in the follower frame coordinates.

Example: 'Translation'

Data Types: char | string

Simulink path from the root of the model to the frame port from which to obtain the base frame. Frame variables each derive from a frame pair, one serving as base, the other as follower.

Example: 'sm_import_humanoid_urdf/World/W'

Data Types: char | string

Simulink path from the root of the model to the frame port from which to obtain the follower frame. Frame variables each derive from a frame pair, one serving as base, the other as follower.

Example: 'sm_import_humanoid_urdf/left_hand/F'

Data Types: char | string

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: addFrameVariables('ks','Link','Rotation','sm_four_bar/'World Frame/W','sm_four_bar/Connector Link/Left End Cap/R','angleUnit','rad');

Unit to replace the default angular unit, specified as the comma-separated pair consisting of 'angleUnit' and a string scalar or character array. Use this argument when the type is 'Rotation'.

Example: rad

Data Types: char | string

Unit to replace the default length unit, specified as the comma-separated pair consisting of 'lengthUnit' and a string scalar or character array. Use this argument when the type is 'Translation'.

Example: in

Data Types: char | string

Unit to replace the default linear velocity unit, specified as the comma-separated pair consisting of 'LinearVelocityUnit' and a string scalar or character array. Use this argument when the type is 'LinearVelocity'.

Example: in/s

Data Types: char | string

Unit to replace the default angular velocity unit, specified as the comma-separated pair consisting of 'AngularVelocityUnit' and a string scalar or character array. Use this argument when the type is 'AngularVelocity'.

Example: rad/s

Data Types: char | string

Introduced in R2019a