www.gusucode.com > robotics 案例源码程序 matlab代码 > robotics/VisualizeRobotConfigurationsExample.m

    %% Visualize Robot Configurations
% Show different configurations of a robot created using a |RigidBodyTree|
% model. Use the |homeConfiguration| or |randomConfiguation| functions to 
% generate the structure that defines all the joint positions.

%%
% Load example robots as |RigidBodyTree| objects.
load exampleRobots.mat

%%
% Create a structure for the home configuration of a Puma robot. The 
% structure has joint names and positions for each body on the robot model.
config = homeConfiguration(puma1)

%%
% Show the home configuration using |show|. You do not need to specify a 
% configuration input.
show(puma1);

%%
% Modify the configuration and set the second joint position to |pi/2|.
% Show the resulting change in the robot configuration.
config(2).JointPosition = pi/2;
show(puma1,config);

%%
% Create random configurations and show them.
show(puma1,randomConfiguration(puma1));