Main Content

show

Visualize deep-learning-based CHOMP trajectory of rigid body tree

Since R2024a

    Description

    The show object function shows one or more configuration trajectories in a Deep-Learning-Based Covariant Hamiltonian Optimization for Motion Planning (DLCHOMP) environment with obstacles. CHOMP is a gradient-descent-based planner that plans and optimizes trajectories for smoothness and collision avoidance. For more information about CHOMP, see the manipulatorCHOMP or dlCHOMP object.

    show(dlchomp) visualizes the rigid body tree in the home configuration of the rigid body tree and spherical obstacles. The function overlays the spherical approximation of the rigid body tree on top of the rigid body tree meshes.

    show(dlchomp,optimtraj) visualizes the rigid body tree at each of the specified waypoints in the optimized trajectory.

    example

    show(___,Parent=parentAx) plots the DLCHOMP visualization on the specified axes, in addition to any combination of input arguments from previous syntaxes.

    ax = show(___) returns the axes on which the function plots the DLCHOMP visualization.

    Examples

    collapse all

    Download a pretrained dlCHOMP object for the KUKA LBR iiwa 7 robot.

    dataZip = matlab.internal.examples.downloadSupportFile("rst/data/dlCHOMP/R2024a/","kukaIiwa7DLCHOMPTrained.zip");
    dataFilePaths = unzip(dataZip);

    Load the trainedDLCHOMP MAT file. The file contains the trained DLCHOMP optimizer, obstacles, and start and goal configurations.

    load trainedDLCHOMP.mat
    Warning: Cannot load an object of class 'dlCHOMPDatastore':
    Its class cannot be found.
    

    Add the obstacles to the dlCHOMP object and show the robot in the home configuration with the loaded obstacles.

    trainedDLCHOMP.SphericalObstacles = unseenObstacles;
    show(trainedDLCHOMP);
    title(["Robot at Home Configuration","in Obstacle Environment"])
    axis auto

    Figure contains an axes object. The axes object with title Robot at Home Configuration in Obstacle Environment, xlabel X, ylabel Y contains 46 objects of type patch. These objects represent world, iiwa_link_0, iiwa_link_1, iiwa_link_2, iiwa_link_3, iiwa_link_4, iiwa_link_5, iiwa_link_6, iiwa_link_7, iiwa_link_ee, iiwa_link_ee_kuka, iiwa_link_0_mesh, iiwa_link_1_mesh, iiwa_link_2_mesh, iiwa_link_3_mesh, iiwa_link_4_mesh, iiwa_link_5_mesh, iiwa_link_6_mesh, iiwa_link_7_mesh, iiwa_link_0_coll_mesh, iiwa_link_1_coll_mesh, iiwa_link_2_coll_mesh, iiwa_link_3_coll_mesh, iiwa_link_4_coll_mesh, iiwa_link_5_coll_mesh, iiwa_link_6_coll_mesh, iiwa_link_7_coll_mesh.

    Optimize trajectory between the start and goal configuration.

    trainedDLCHOMP.RigidBodyTree.DataFormat = "column"
    trainedDLCHOMP = 
      dlCHOMP with properties:
    
               RigidBodyTree: [1×1 rigidBodyTree]
        RigidBodyTreeSpheres: [11×1 table]
           SmoothnessOptions: [1×1 chompSmoothnessOptions]
               SolverOptions: [1×1 chompSolverOptions]
            CollisionOptions: [1×1 chompCollisionOptions]
          SphericalObstacles: [4×24 double]
                  BPSEncoder: [1×1 bpsEncoder]
                NumWaypoints: 40
                     Network: [1×1 dlnetwork]
                   NumInputs: [14 10000]
                  NumOutputs: 266
    
    
    [wpts,tpts,solninfo] = optimize(trainedDLCHOMP,unseenStart,unseenGoal);

    Visualize the trajectory.

    figure
    a = show(trainedDLCHOMP,wpts);
    title("Optimized Trajectory")
    axis equal

    Figure contains an axes object. The axes object with title Optimized Trajectory, xlabel X, ylabel Y contains 464 objects of type patch. These objects represent world, iiwa_link_0, iiwa_link_1, iiwa_link_2, iiwa_link_3, iiwa_link_4, iiwa_link_5, iiwa_link_6, iiwa_link_7, iiwa_link_ee, iiwa_link_ee_kuka, iiwa_link_0_mesh, iiwa_link_1_mesh, iiwa_link_2_mesh, iiwa_link_3_mesh, iiwa_link_4_mesh, iiwa_link_5_mesh, iiwa_link_6_mesh, iiwa_link_7_mesh, iiwa_link_0_coll_mesh, iiwa_link_1_coll_mesh, iiwa_link_2_coll_mesh, iiwa_link_3_coll_mesh, iiwa_link_4_coll_mesh, iiwa_link_5_coll_mesh, iiwa_link_6_coll_mesh, iiwa_link_7_coll_mesh.

    Input Arguments

    collapse all

    Deep-learning-based CHOMP optimizer, specified as a dlCHOMP object.

    DLCHOMP-optimized trajectory waypoints, specified as an M-by-N matrix. M is the number of waypoints, and N is the number of joints in the rigid body tree of dlchomp.

    Specify this argument using the optimtraj output of the optimize function.

    Parent axes of the trajectory visualization, specified as an Axes object.

    Output Arguments

    collapse all

    Axes graphic handle, returned as an Axes object. This object contains the properties of the figure that you plot the DLCHOMP visualization onto.

    Version History

    Introduced in R2024a