Main Content

mpnetPrepareData

Prepare training data for Motion Planning Networks

Since R2023b

    Description

    ds = mpnetPrepareData(dataset,mpnet) preprocesses the input data for training the Motion Planning Networks (MPNet) on an SE(2) state space model.

    The mpnetPrepareData function:

    • Converts the format of the state space variables to the form [x y cosθ sinθ]

    • Normalizes the values of the state space variables x and y to lie within the range [0, 1].

    • Encodes the input map environment to a compact representation. The function calls the bpsEncoder object and the encode object function to encode the input map by using basis point set encoding approach. The size of the encoded environment is specified by the EncodingSize property of the input mpnetSE2 object.

    The function returns the processed input data as a CombinedDatastore object.

    Note

    To run this function, you will require the Deep Learning Toolbox™.

    example

    Examples

    collapse all

    Load a sample data set into the MATLAB® workspace.

    load("mazeMapDatasetSmall.mat","dataset")

    The sample data set contains maze maps and path states for randomly selected start and goal poses.

    dataset
    dataset=4000×2 table
                 Map                  Path     
        ______________________    _____________
    
        1x1 binaryOccupancyMap    {14x3 single}
        1x1 binaryOccupancyMap    {17x3 single}
        1x1 binaryOccupancyMap    { 4x3 single}
        1x1 binaryOccupancyMap    {14x3 single}
        1x1 binaryOccupancyMap    {12x3 single}
        1x1 binaryOccupancyMap    {23x3 single}
        1x1 binaryOccupancyMap    {17x3 single}
        1x1 binaryOccupancyMap    {21x3 single}
        1x1 binaryOccupancyMap    {11x3 single}
        1x1 binaryOccupancyMap    {12x3 single}
        1x1 binaryOccupancyMap    {13x3 single}
        1x1 binaryOccupancyMap    {21x3 single}
        1x1 binaryOccupancyMap    {22x3 single}
        1x1 binaryOccupancyMap    {15x3 single}
        1x1 binaryOccupancyMap    {15x3 single}
        1x1 binaryOccupancyMap    {12x3 single}
          ⋮
    
    

    Inspect the state samples corresponding to a path in the data set.

    dataset(1,2).Path{1}
    ans = 14x3 single matrix
    
        8.1186    8.7496    1.1838
        7.8296    7.8000    1.5686
        7.8519    6.8003    1.5859
        7.9013    6.0160    1.4482
        7.9458    5.0708    1.8336
        8.2926    4.5001    1.6930
        8.2603    3.8021    0.8278
        8.1499    2.8538    0.5393
        8.1577    2.7802    0.5799
        8.3016    2.4010    0.8270
          ⋮
    
    

    Create a MPNet object.

    mpnet = mpnetSE2;

    Preprocess the input data for training the MPNet. The mpnetPrepareData function preprocesses the data and stores it in a datastore.

    ds = mpnetPrepareData(dataset,mpnet);

    Preview a subset of the data stored in the datastore object. Inspect the values.

    The mpnetPrepareData function encodes (rescales) all the input maps to a size of 10-by-10 meters and replaces the state space variable θ with its cosine and sine components. Therefore, the state space variables passed as input to the MPNet is in the format [x,y,cosθ,sinθ]. The function normalizes the state space variables x and y to lie within the range [0, 1]. The first column of the datastore stores the preprocessed current state, goal state, and states in the encoded maps. The second column stores the preprocessed next state.

    ProcessedData = preview(ds);
    ProcessedData(1,2)
    ans = 1x1 cell array
        {[0.5391 0.5390 0.5011 1.0000]}
    
    

    Input Arguments

    collapse all

    Data set for training MPNet, specified as a cell array or table.

    • If you use only one map environment for training and testing the MPNet, the cell array or table must be of size M-by-1. M is the number of optimal path samples to be used for training the MPNet.

    • If you use the MPNet for training and testing on multiple map environments, the cell array or table must be of size M-by-2. M is the total number of optimal path samples. For example, if you consider 2 different map environments with 10 optimal path samples each, then the value of M is 20.

      The first column of the table must contain the input map environments for which the optimal path samples are generated. The second column of the table must contain the generated optimal path samples. Thus, each row of the table contains a map and an associated optimal path sample. You must store the input maps as occupancyMap or binaryOccupancyMap objects.

    The optimal path samples in the data set must be generated for random values of start pose and goal pose on each map. You must specify each optimal path as a row vector of form [x y θ]. x, y, and θ are the state space variables.

    Data Types: cell | table

    MPNet to train on the data set, specified as an mpnetSE2 object.

    Output Arguments

    collapse all

    Preprocessed data for training the MPNet, returned as a CombinedDatastore object. The datastore contains two columns. The first column stores the preprocessed current state, goal state, and the states in the input map environment. The second column stores the preprocessed next state.

    References

    [1] Prokudin, Sergey, Christoph Lassner, and Javier Romero. “Efficient Learning on Point Clouds with Basis Point Sets.” In 2019 IEEE/CVF International Conference on Computer Vision Workshop (ICCVW), 3072–81. Seoul, Korea (South): IEEE, 2019. https://doi.org/10.1109/ICCVW.2019.00370.

    [2] Qureshi, Ahmed Hussain, Yinglong Miao, Anthony Simeonov, and Michael C. Yip. “Motion Planning Networks: Bridging the Gap Between Learning-Based and Classical Motion Planners.” IEEE Transactions on Robotics 37, no. 1 (February 2021): 48–66. https://doi.org/10.1109/TRO.2020.3006716.

    Version History

    Introduced in R2023b