%% Create Rigid Body Tree Code Generating Function
% Load a robot model as a rigidBodyTree object.

robot = loadrobot("kinovaGen3")

% Show the robot model in a figure.

show(robot);

% Create a code generating function that constructs the rigidBodyTree object.

writeAsFunction(robot,'KG3Codegen')

% Construct the robot model using the generated function.

rbt = KG3Codegen

% Show the robot model in a figure.

show(rbt);

% Copyright 2020 The MathWorks, Inc.