Assign kinematic variables from the KinematicsSolver object as targets


addTargetVariables(ks,ids) assigns as target variables the kinematic variables listed in the KinematicsSolver object ks under the names given in the ids argument. Those that do serve as constraints to apply during analysis. Their values must be later defined in order to run the analysis. The solver, when called, searches for a solution compatible with the targeted joint and frame variables.

The output is an updated table with the target variables—both new and old—in rows. Each row gives the ID of a variable, the type and block path of the joint to which it belongs if a joint variable, the base and follower frames from which it spawns if a frame variable, and the unit for its numerical value. The variables rank in the order added.

Most variables can be assigned individually. A few must be assigned in groups—axis components alongside rotation angle in spherical primitives; bend angle alongside azimuth angle in constant-velocity primitives. (A bend angle can be assigned individually but the azimuth angle cannot.)

The figure shows the variables of a general KinematicsSolver object. Target (T), guess (G), and output (O) variables can be joint variables (J) or frame variables (F). The same variable can serve as target and output, but if it serves as target, it cannot double as guess. Assigning a guess variable as target clears it as guess.

As with position targets in joint blocks in regular Simulink models, target variables should not overconstrain the system they describe. An assembly is overconstrained if a kinematic loop within it has a target for every joint. Kinematic loops such as four-bars and crank-sliders are evident from the model. Others arise when formulating a kinematic problem to solve.

Kinematic chains such as robotic arms and other serial manipulators become kinematic loops when subject to closure constraints. A target for a frame variable between base and end effector frames adds the equivalent of such a constraint. If the closed chain is to be underconstrained, at least one of its joints must stay free of target variables.

Adding a target variable that overconstrains the assembly causes addTargetVariables to fail with an error. Consider initial guess variables for the last joint of a kinematic loop, if necessary, to guide the joint into place without overconstraining the assembly. Use the addInitialGuessVariables object function to assign a kinematic variable as an initial guess.

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

Identifiers of the kinematic variables to use. Enter the identifiers as shown in the ID column of the jointPositionVariables or jointVelocityVariables, for joint variables, or frameVariables, for frame variables.

Example: 'j1.Rz.q'

Data Types: char | string

Introduced in R2019a