Main Content

computeState

Class: simscape.multibody.CompiledMultibody
Namespace: simscape.multibody

Compute state of compiled multibody system

Since R2022a

Description

state = computeState(cmb,op) computes the state of the simscape.multibody.CompiledMultibody object, cmb, based on the joint targets specified by the simscape.op.OperatingPoint object, op.

The computeState method attempts to satisfy the targeted joint primitives specified by the OperatingPoint object as much as possible. However, in some cases, to find a complete state that satisfies all of the kinematic constraints, some targets may not be met.

To specify joint position and velocity targets, use the OperatingPoint with paths to the joint primitives, appending specific letters. The tables provide a summary of the letters corresponding to each joint primitive type.

Primitive TypePosition TargetVelocity TargetExamples
Revolute (Rz)qw
  • Position:

    op("MyJoint/Rz/q") = simscape.op.Target(60,"deg","High")

  • Velocity:

    op("MyJoint/Rz/w") = simscape.op.Target(simscape.Value(...
    150,"deg/s"),"Low")

Prismatic (Pz)pv
  • Position:

    op("MyJoint/Pz/p") = simscape.op.Target(...
    simscape.Value(50,"cm"),"High")

  • Velocity:

    op("MyJoint/Pz/v") = simscape.op.Target(...
    simscape.Value(10,"cm/s"),"Low")

Spherical (S) angle_axisw
  • Position:

    op("MyJoint/S/angle_axis/ax") = simscape.op.Target(...
    simscape.Value([1 -2 3]),"High");
    op("MyJoint/S/angle_axis/q") = simscape.op.Target(...
    simscape.Value(45,"deg"),"Hight");

  • Velocity:

    target = simscape.op.Target(simscape.Value(...
    [20 -30 50],"deg/s"),"High");
    target.Attributes("ResolutionFrame") = "Follower";
    op("MyJoint/S/w") = target;
Lead Screw (LSz)Angular targetsqw
  • Angular position and velocity:

    op("MyJoint/LSz/q") = simscape.op.Target(simscape.Value(...
    45,"deg"),"High");
    op("MyJoint/LSz/w") = simscape.op.Target(simscape.Value(...
    3,"deg/s"),"High");

  • Linear position and velocity:

    op("MyJoint/LSz/p") = simscape.op.Target(simscape.Value(...
    50,"mm"),"High")
    op("MyJoint/LSz/w") = simscape.op.Target(simscape.Value(...
    3,"deg/s"),"High");

Linear targetspv
Constant Velocity (CV)Bend angleq/b w/b
  • Bend angle position and velocity:

    op("MyJoint/CV/q/b") = simscape.op.Target(simscape.Value(...
    15,"deg"),"High");
    op("MyJoint/CV/w/b") = simscape.op.Target(simscape.Value(...
    30,"deg/s"),"High");

  • Azimuth angle position and velocity:

    op("MyJoint/CV/q/a") = simscape.op.Target(simscape.Value(...
    35,"deg"),"High");
    op("MyJoint/CV/w/a") = simscape.op.Target(simscape.Value(...
    50,"deg/s"),"High");

Azimuth angleq/aw/a

Note

For the lead screw joint primitive, you cannot simultaneously specify both angular and linear position targets, nor both angular and linear velocity targets. However, you can pair a linear position target with an angular velocity target, or an angular position target with a linear velocity target.

Input Arguments

expand all

Compiled multibody system, specified as a simscape.multibody.CompiledMultibody object.

Targeted joint primitives, specified as a simscape.op.OperatingPoint object. Use an OperatingPoint object to target the positions and velocities of desired joint primitives in the compiled multibody system.

You can specify the priority for each individual target. The computeState method searches for a solution that is compatible with all the high-priority targets. However, in some cases, some targets may not be met. When multiple solutions exist, low-priority targets can help bias the method to converge on the desired one.

Output Arguments

expand all

State of the compiled multibody system with specified targets, returned as a simscape.multibody.State object. The State object includes the position and velocity of each joint primitive in the compiled multibody system.

Attributes

Accesspublic

To learn about attributes of methods, see Method Attributes.

Version History

Introduced in R2022a