Main Content

addTargetVariables

Assign kinematic variables from KinematicsSolver object as targets

Description

addTargetVariables(ks,ids) assigns the kinematic variables, ids, of the KinematicsSolver object, ks, as targets.

The output of the addTargetVariables object function is a table that lists the targeted variables in rows. Each row shows the details of a variable. For a joint variable, the table shows the ID, joint type, block path, and unit. For a frame variable, the table shows the ID, base and follower frames, and unit.

You can assign both frame and joint variables as target variables and add them in any order. When adding target variables, note that:

  • You cannot specify LinearVelocity frame variables as targets.

  • You cannot specify AngularVelocity frame variables as targets.

  • When using a Rotation type frame variable as target, you must specify the x and y components of the frame variable simultaneously.

  • You must target the four joint position variables of a spherical primitive simultaneously.

  • You must target three joint velocity variables of a spherical primitive simultaneously.

  • You cannot target the joint position variable for the azimuth angle of a constant velocity primitive unless you also target the corresponding bend angle.

  • You cannot target the joint velocity variable for the azimuth velocity of a constant velocity primitive unless you also target the corresponding bend angle velocity.

During a search, the target variables serve as constraints for the system, and the solver searches for a solution that is compatible with the targeted joint and frame variables. Do not overconstrain the system with target variables. A system is overconstrained if a kinematic loop in the system has a target for every joint. One way of avoiding overconstraining is to reassign one of the joint variables from a target to an initial guess by using the addInitialGuessVariables object function.

A variable can serve as both target and output. However, a variable cannot serve as both target and guess.

Input Arguments

collapse all

Kinematics solver object, specified as a KinematicsSolver object that is the representation of the Simscape™ Multibody™ model used for kinematic analysis.

Example: ks = simscape.multibody.KinematicsSolver("DoublePendulumExample​'​')

Identifiers of the kinematic variables, specified as either a cell array of characters or string vector. The cell array of character and string vector can be 1-by-N or N-by-1, where N is a positive integer. Use the jointPositionVariables or jointVelocityVariables object function to show the IDs for joint variables. Use the frameVariables object function to show the IDs for frame variables.

Example: "j1.Rz.q", ["j1.Rz.q", "j2.Rz.q"], {'j1.Rz.q'}, or {'j1.Rz.q'; 'j2.Rz.q'};

Version History

Introduced in R2019a