Main Content

taskSpaceMotionModel

Model rigid body tree motion given task-space reference inputs

罪ce R2019b

Description

ThetaskSpaceMotionModelobject models the closed-loop task-space motion of a manipulator, specified as a rigid body tree object. The motion model behavior is defined by theMotionTypeproperty.

For more details about the equations of motion, seeTask-Space Motion Model.

Creation

Description

motionModel= taskSpaceMotionModelcreates a motion model for a default two-joint manipulator.

motionModel= taskSpaceMotionModel("RigidBodyTree",tree)creates a motion model for the specifiedrigidBodyTreeobject.

example

motionModel= taskSpaceMotionControlModel(Name,Value)sets additional properties specified as name-value pairs. You can specify multiple properties in any order.

Properties

expand all

Rigid body tree robot model, specified as arigidBodyTreeobject that defines the inertial and kinematic properties of the manipulator.

This property defines the body that will be used as the end effector, and for which the task space motion is defined. The property must correspond to a body name in therigidBodyTreeobject of theRigidBodyTreeproperty. If the rigid body tree is updated without also updating the end effector, the body with the highest index becomes the end-effector body by default.

Proportional gain for PD control, specified as a 6-by-6 matrix.

Derivative gain for proportional-derivative (PD) control, specified as a 6-by-6 matrix.

Joint damping constant, specified as ann-element vector, wherenis the number of non-fixed joints in the robot model specified by theRigidBodyTreeproperty. Joint damping units are N/(m/s) or N/(rad/s) for prismatic and revolute joints, respectively.

Type of motion, specified as"PDControl", which uses proportional-derivative (PD) control mapped to the joints via a Jacobian-Transpose controller. The control is based on the specifiedKpandKdproperties.

Object Functions

derivative Time derivative of manipulator model states
updateErrorDynamicsFromStep Update values ofNaturalFrequencyandDampingRatioproperties given desired step response

例子

collapse all

This example shows how to create and use ataskSpaceMotionModelobject for a manipulator robot arm in task-space.

Create the Robot

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

Set Up the Simulation

Set the time span to be 1 second with a timestep size of 0.02 seconds. Set the initial state to the home configuration of the robot, with a velocity of zero.

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

Define a reference state with a target position and zero velocity.

refPose = trvec2tform([0.6 -.1 0.5]); refVel = zeros(6,1);

Create the Motion Model

Model the behavior as a system under proportional-derivative (PD) control.

motionModel = taskSpaceMotionModel("RigidBodyTree",robot,"EndEffectorName","EndEffector_Link");

Simulate the Robot

Simulate the behavior over 1 second using a stiff solver to more efficiently capture the robot dynamics.Usingode15senables higher precision around the areas with a high rate of change.

[t,robotState] = ode15s(@(t,state)derivative(motionModel,state,refPose,refVel),tspan,initialState);

Plot the Response

Plot the robot's initial position and mark the target with an X.

figure show(robot,initialState(1:7)); holdallplot3(refPose(1,4),refPose(2,4),refPose(3,4),"x","MarkerSize",20)

Observe the response by plotting the robot in a 5 Hz loop.

r = rateControl(5);fori = 1:size(robotState,1) show(robot,robotState(i,1:7)',"PreservePlot",false); waitfor(r);end

Figure contains an axes object. The axes object with xlabel X, ylabel Y contains 26 objects of type line, patch. One or more of the lines displays its values using only markers These objects represent base_link, Shoulder_Link, HalfArm1_Link, HalfArm2_Link, ForeArm_Link, Wrist1_Link, Wrist2_Link, Bracelet_Link, EndEffector_Link, Shoulder_Link_mesh, HalfArm1_Link_mesh, HalfArm2_Link_mesh, ForeArm_Link_mesh, Wrist1_Link_mesh, Wrist2_Link_mesh, Bracelet_Link_mesh, base_link_mesh.

References

[1] Craig, John J.Introduction to Robotics: Mechanics and Control. Upper Saddle River, NJ: Pearson Education, 2005.

[2] Spong, Mark W., Seth Hutchinson, and Mathukumalli Vidyasagar.Robot Modeling and Control. Hoboken, NJ: Wiley, 2006.

Extended Capabilities

C / c++代码生成
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced in R2019b