Open Kinematics Solver Viewer window to visualize KinematicsSolver solution
An error occurs if the
solve function was not invoked
before calling the
statusFlag corresponding to the last call to
solve is -3, the state returned by the solver is not kinematically feasible. In
this case, the mechanism rendered in the viewer is not physically
The Kinematics Solver Viewer window is shown in the following figure. This pane
provides visual feedback on the mechanism that you are analysing. Select the Update
Visualization button or press F5 to view the mechanism
that corresponds to the latest solution of
ks. Use the viewer to
examine the mechanism from different perspectives by selecting the standard view or by
rotating, panning, and zooming the mechanism. Right-click the window to access a
context-sensitive menu. This menu provides additional options that allow you to change the
background color, split the visualization window into multiple tiles, and modify the view
convention from the default +Z up (XY Top) setting.
Kinematics Solver Viewer Window
Create a KinematicsSolver object for the sm_double_pendulum model.
mdl = 'sm_double_pendulum'; open_system(mdl); ks = simscape.multibody.KinematicsSolver(mdl);
List all of the joint position variables.
ans = 2×4 table ID JointType BlockPath Unit _________ ________________ ___________________________________ _____ "j1.Rz.q" "Revolute Joint" "sm_double_pendulum/Lower Revolute" "deg" "j2.Rz.q" "Revolute Joint" "sm_double_pendulum/Upper Revolute" "deg"
Assign the upper and lower revolute joint angles as target variables.
targetIDs = ["j1.Rz.q";"j2.Rz.q"]; addTargetVariables(ks,targetIDs);
Solve the forward kinematics problem with given joint angles.
targets = [90,0]; outputVec = solve(ks,targets);
Open the Kinematics Solver Viewer.
Click the Front view button to view the solution.
Close the viewer.
ks— Kinematics solver object
KinematicsSolver object is the representation of a Simscape
Multibody model used for kinematic analysis.
Example: ks = simscape.multibody.KinematicsSolver('sm_double_pendulum')