Main Content

Load Predefined Robot Models

To quickly access common robot models, use the loadrobot function, which loads commercially available robot models like the Universal Robots™ UR10 cobot, Boston Dynamics™ Atlas humanoid, and KINOVA™ Gen 3 manipulator. Explore how to generate joint configurations and interact with the robot models.

To import your own universal robot description format (URDF), see the importrobot function.

Specify the robot model type as a string to the loadrobot function. Utilize tab completion to select from the list of provided models as inputs.

To use column vectors for joint configurations, specify the data format as "column".

ur10 = loadrobot("universalUR10");
atlas = loadrobot("atlas");
gen3 = loadrobot("kinovaGen3","DataFormat","column");

The loadrobot function returns a rigidBodyTree object that represents the kinematics and dynamics of each robot model. Some models may not load with dynamics or inertial properties for bodies. Inspect individual rigid bodies using the Bodies property or the getBody function.

  rigidBodyTree with properties:

     NumBodies: 8
        Bodies: {[1x1 rigidBody]  [1x1 rigidBody]  [1x1 rigidBody]  [1x1 rigidBody]  [1x1 rigidBody]  [1x1 rigidBody]  [1x1 rigidBody]  [1x1 rigidBody]}
          Base: [1x1 rigidBody]
     BodyNames: {'Shoulder_Link'  'HalfArm1_Link'  'HalfArm2_Link'  'ForeArm_Link'  'Wrist1_Link'  'Wrist2_Link'  'Bracelet_Link'  'EndEffector_Link'}
      BaseName: 'base_link'
       Gravity: [0 0 0]
    DataFormat: 'column'

Call show to visualize the robot models in the home configuration. Replace the gen3 object with other models to visualize them.




Generate Joint Configurations

Generate random configurations for the KINOVA Gen3 robot. The randomConfiguration function outputs random joint positions within the limits of the model. To verify the model behaves as expected, visualize a set of four configurations.

for i = 1:4
    config = randomConfiguration(gen3);

Interact with Robot Model

To move the robot model around and inspect the behavior, load the interactive rigid body tree GUI. You can set target end-effector positions, manually move joints, and select various elements in your model.

interactiveGUI = interactiveRigidBodyTree(gen3);

Click and drag the center disk to freely move the target end-effector position. The GUI uses Inverse Kinematics to solve for the joint positions of each body. Use the axes to move linearly and the circles to rotate about an axis.

Click a rigidBody to view their specific parameters.

Right-click to set a different target marker body. Changing the target body updates the end-effector of the inverse kinematics solver.

To manually control joints, right-click and toggle the marker control method.

To control the rotation of a revolute joint on the body you selected, click and drag the yellow circle.

Save Joint Configurations

Save specific configurations that you set using the addConfiguration function, which stores the current joint positions in the StoredConfigurations property. This example sets a random configuration before storing.

interactiveGUI.Configuration = randomConfiguration(gen3);


Next Steps

Now that you built your model in MATLAB®, you may want to do many different things.

  • Perform Inverse Kinematics to get joint configurations based on desired end-effector positions. Specify additional robot constraints other than the model parameters including aiming constraints, Cartesian bounds, or pose targets.

  • Generate Trajectory Generation based on waypoints and other parameters with trapezoidal velocity profiles, B-splines, or polynomial trajectories.

  • Perform Manipulator Planning utilizing your robot models and an rapidly-exploring random tree (RRT) path planner.

  • Check for Collision Detection with obstacles in your environment to ensure safe and effective motion of your robot.

See Also