Main Content

updateErrorDynamicsFromStep

Update values ofNaturalFrequencyandDampingRatioproperties given desired step response

Description

example

updateErrorDynamicsFromStep(motionModel,settlingTime,overshoot)updates the values of theNaturalFrequencyandDampingRatioproperties of the givenjointSpaceMotionModelobject given the desired step response.

updateErrorDynamicsFromStep(motionModel,settlingTime,overshoot,jointIndex)updates theNaturalFrequencyandDampingRatioproperties for a specific joint. In this case, the values ofSettlingTimeandOvershootmust be provided as scalars because they apply to a single joint.

Examples

collapse all

This example shows how to create and use ajointSpaceMotionModelobject for a manipulator robot in joint-space.

Create the Robot

机器人= loadrobot ("kinovaGen3","DataFormat","column","Gravity",[0 0 -9.81]);

Set Up the Simulation

Set the timespan to be 1 s with a timestep size of 0.01 s. Set the initial state to be the robots, home configuration with a velocity of zero.

tspan = 0:0.01:1; initialState = [homeConfiguration(robot); zeros(7,1)];

Define the a reference state with a target position, zero velocity, and zero acceleration.

targetState = [pi/4; pi/3; pi/2; -pi/3; pi/4; -pi/4; 3*pi/4; zeros(7,1); zeros(7,1)];

Create the Motion Model

模型系统和计算转矩控制error dynamics defined by a moderately fast step response with 5% overshoot.

motionModel = jointSpaceMotionModel("RigidBodyTree",robot); updateErrorDynamicsFromStep(motionModel,.3,.05);

Simulate the Robot

Use the derivative function of the model as the input to theode45solver to simulate the behavior over 1 second.

[t,robotState] = ode45(@(t,state)derivative(motionModel,state,targetState),tspan,initialState);

Plot the Response

Plot the positions of all the joints actuating to their target state. Joints with a higher displacement between the starting position and the target position actuate to the target at a faster rate than those with a lower displacement. This leads to an overshoot, but all of the joints have the same settling time.

figure plot(t,robotState(:,1:motionModel.NumJoints)); holdall; plot(t,targetState(1:motionModel.NumJoints)*ones(1,length(t)),"--"); title("Joint Position (Solid) vs Reference (Dashed)"); xlabel("Time (s)") ylabel("Position (rad)");

Figure contains an axes object. The axes object with title Joint Position (Solid) vs Reference (Dashed) contains 14 objects of type line.

Input Arguments

collapse all

ThejointSpaceMotionModelobject, which defines the properties of the motion model.

Settling time required to reach a 2% tolerance band in seconds, specified as a scalar or ann-element vector.nis the number of nonfixed joints in therigidBodyTreeof thejointSpaceMotionModelin themotionModelargument.

The overshoot relative to a unit step, specified as a scalar or ann-element vector.nis the number of nonfixed joints in therigidBodyTreeof thejointSpaceMotionModelin themotionModelargument.

The index of the joint for whichNaturalFrequencyandDampingRatiois updated given the unit-step error dynamics. In this case, settling time and overshoot must be specified as scalars.

References

[1] Ogata, Katsuhiko.Modern Control Engineering4th ed. Englewood Cliffs, NJ: Prentice-Hall, 2002.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced in R2019b